thecodealer / vue-panzoom

Vue plugin to zoom/pan dom elements
MIT License
89 stars 20 forks source link

Vue 3 Support? #49

Open michaelsboost opened 2 months ago

michaelsboost commented 2 months ago

How can I use this with Vue 3 to test on codepen?

arifhussain353 commented 1 month ago

I guess Vue 3 is not supported yet.

I am using panzoom instead of vue-panzoom.

Install $ npm install --save @panzoom/panzoom

Import this as import Panzoom from '@panzoom/panzoom in your vue component.

 const instance = Panzoom(canvasElement, {
        minScale: 1,
        maxScale: 2,
        contain: "outside",

        // startX: -5000,
        // startY: -5000,
    });

    canvasElement.addEventListener("wheel", instance.zoomWithWheel);

It works fine for me.

Note: Don't forget to remove the listener in unmounted.