update 优化类型
This commit is contained in:
parent
2fc98d8016
commit
c5e161482b
@ -173,13 +173,13 @@ const initDiagram = (xml?: string) => {
|
||||
*/
|
||||
const fitViewport = () => {
|
||||
zoom.value = bpmnModeler.value.get<Canvas>('canvas').zoom('fit-viewport');
|
||||
const bbox = (document.querySelector('.app-containers .viewport') as SVGGElement).getBBox();
|
||||
const currentViewBox = bpmnModeler.value.get('canvas').viewbox();
|
||||
const bbox = document.querySelector<SVGGElement>('.app-containers .viewport').getBBox();
|
||||
const currentViewBox = bpmnModeler.value.get<Canvas>('canvas').viewbox();
|
||||
const elementMid = {
|
||||
x: bbox.x + bbox.width / 2 - 65,
|
||||
y: bbox.y + bbox.height / 2
|
||||
};
|
||||
bpmnModeler.value.get('canvas').viewbox({
|
||||
bpmnModeler.value.get<Canvas>('canvas').viewbox({
|
||||
x: elementMid.x - currentViewBox.width / 2,
|
||||
y: elementMid.y - currentViewBox.height / 2,
|
||||
width: currentViewBox.width,
|
||||
@ -192,9 +192,9 @@ const fitViewport = () => {
|
||||
* @param zoomIn true 放大 | false 缩小
|
||||
*/
|
||||
const zoomViewport = (zoomIn = true) => {
|
||||
zoom.value = bpmnModeler.value.get('canvas').zoom();
|
||||
zoom.value = bpmnModeler.value.get<Canvas>('canvas').zoom();
|
||||
zoom.value += zoomIn ? 0.1 : -0.1;
|
||||
bpmnModeler.value.get('canvas').zoom(zoom.value);
|
||||
bpmnModeler.value.get<Canvas>('canvas').zoom(zoom.value);
|
||||
};
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user