comments, remove bbox

This commit is contained in:
Tomáš Mládek 2021-01-09 18:45:53 +01:00
parent af6694f890
commit 1ce3b244f0

View file

@ -4,7 +4,7 @@
</template>
<script lang="ts">
import {defineComponent, onMounted, reactive, ref} from "vue";
import {defineComponent, onMounted, ref} from "vue";
import createPanZoom, {PanZoom} from "panzoom";
export default defineComponent({
@ -18,16 +18,9 @@ export default defineComponent({
setup(props) {
const root = ref(null);
const panzoom = ref<null | PanZoom>(null);
const bbox = reactive({
x: 0,
y: 0,
width: undefined,
height: undefined
});
const anchors = ref<SVGRectElement[]>([]);
const panToAnchor = ref();
onMounted(async () => {
const element = root.value as unknown as HTMLDivElement;
@ -36,20 +29,14 @@ export default defineComponent({
const svgParsed = new DOMParser().parseFromString(await fetchResult.text(), "image/svg+xml") as Document;
const svg = element.appendChild(svgParsed.firstElementChild as Element) as any;
// PanZoom
const pz = createPanZoom(element, {
smoothScroll: false,
zoomSpeed: 0.05
});
panzoom.value = pz;
function updateBBox(panzoom: PanZoom) {
const transform = panzoom.getTransform();
// console.log(transform);
}
updateBBox(pz);
pz.on("transform", updateBBox);
// Anchors
anchors.value = processAnchors(svg);
panToAnchor.value = (anchor: SVGRectElement) => {
const transform = pz.getTransform();