actual scale from anchor

master
Tomáš Mládek 2021-01-09 18:35:55 +01:00
parent d597aa9ae0
commit 28a200ee13
1 changed files with 2 additions and 1 deletions

View File

@ -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;