remove currentTransform (unnecessary)

master
Tomáš Mládek 2021-01-11 19:51:05 +01:00
parent 70759c7a69
commit 97b4aae360
1 changed files with 6 additions and 9 deletions

View File

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