remove currentTransform (unnecessary)

This commit is contained in:
Tomáš Mládek 2021-01-11 19:51:05 +01:00
parent 70759c7a69
commit 97b4aae360

View file

@ -11,7 +11,7 @@
Current position: {{ Math.round(bbox.x) }}x{{ Math.round(bbox.y) }}
</div>
<div>
Zoom level: {{ currentTransform ? (Math.round(currentTransform.scale * 1000) / 1000) : '???' }}
Zoom level: {{ (Math.round(bbox.z * 1000) / 1000) }}
</div>
<label>
<input v-model="showInternal" type="checkbox">
@ -23,7 +23,7 @@
<script lang="ts">
import {defineComponent, onMounted, reactive, ref} from "vue";
import createPanZoom, {PanZoom, Transform} from "panzoom";
import createPanZoom, {PanZoom} from "panzoom";
import VideoScroll, {VideoScrollDef, VideoScrollDirection} from "@/components/VideoScroll.vue";
import AudioArea, {AudioAreaDef} from "@/components/AudioArea.vue";
import Stats from "stats.js";
@ -56,12 +56,12 @@ export default defineComponent({
const scrolls = ref<VideoScrollDef[]>([]);
const panToAnchor = ref();
const audioAreas = ref<AudioAreaDef[]>([]);
const currentTransform = ref<Transform | null>(null);
const bbox = reactive({
x: ref(0),
y: ref(0),
w: ref(0),
h: ref(0)
h: ref(0),
z: ref(1)
});
onMounted(async () => {
@ -96,7 +96,6 @@ export default defineComponent({
}
});
panzoom.value = pz;
currentTransform.value = pz.getTransform();
// Calculate SVG-unit bounding box, update transform
pz.on("transform", function (_) {
@ -107,8 +106,7 @@ export default defineComponent({
bbox.y = transform.y / currentRatio * -1;
bbox.w = window.innerWidth / currentRatio;
bbox.h = window.innerHeight / currentRatio;
currentTransform.value = transform;
bbox.z = transform.scale;
});
function panToElement(target: SVGRectElement, smooth: boolean) {
@ -228,8 +226,7 @@ export default defineComponent({
panToAnchor,
scrolls,
audioAreas,
bbox,
currentTransform
bbox
};
},
});