From da0d1ea0e8616bf6fd8d0bee11d79de67f918225 Mon Sep 17 00:00:00 2001 From: Nevermore <15972699417@163.com> Date: Tue, 5 Dec 2023 18:13:28 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E7=BC=A9=E6=94=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/hooks/useCanvasScale.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/hooks/useCanvasScale.ts b/src/hooks/useCanvasScale.ts index 4f034b55..8e152d01 100644 --- a/src/hooks/useCanvasScale.ts +++ b/src/hooks/useCanvasScale.ts @@ -5,6 +5,7 @@ import { useElementBounding } from '@vueuse/core' import { Group, Point } from 'fabric' import useCanvas from '@/views/Canvas/useCanvas' import useCenter from '@/views/Canvas/useCenter' +import { WorkSpaceThumbType } from '@/configs/canvas' export default () => { const fabricStore = useFabricStore() @@ -88,7 +89,7 @@ export default () => { // canvas.setDimensions({width: width.value, height: height.value}) // canvas.renderAll() const { zoom } = storeToRefs(fabricStore) - const objects = canvas.getObjects() + const objects = canvas.getObjects().filter(ele => !WorkSpaceThumbType.includes(ele.id)) const boundingBox = Group.prototype.getObjectsBoundingBox(objects) if (!boundingBox) return zoom.value = Math.min(canvas.getWidth() / boundingBox.width, canvas.getHeight() / boundingBox.height,) * scalePercentage.value / 100