actual scale from anchor

This commit is contained in:
Tomáš Mládek 2021-01-09 18:35:55 +01:00
parent d597aa9ae0
commit 28a200ee13

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;