From 28a200ee13971b58f5d055495adff2b135805efb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Ml=C3=A1dek?= Date: Sat, 9 Jan 2021 18:35:55 +0100 Subject: [PATCH] actual scale from anchor --- app/src/components/SVGContent.vue | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/src/components/SVGContent.vue b/app/src/components/SVGContent.vue index a6dc675..5311ad6 100644 --- a/app/src/components/SVGContent.vue +++ b/app/src/components/SVGContent.vue @@ -54,7 +54,8 @@ export default defineComponent({ panToAnchor.value = (anchor: SVGRectElement) => { const transform = pz.getTransform(); const currentRatio = svg.clientWidth * transform.scale / svg.viewBox.baseVal.width; - const targetScale = 1; // todo + const ratio = svg.clientWidth / svg.viewBox.baseVal.width; + const targetScale = anchor.width.baseVal.value * ratio / window.innerWidth; const svgTargetX = anchor.x.baseVal.value + anchor.width.baseVal.value / 2; const svgTargetY = anchor.y.baseVal.value + anchor.height.baseVal.value / 2;