The `vue-panzoom` library is a Vue.js plugin that provides intuitive pan and zoom capabilities for various DOM elements, including images, regular HTML content, and SVG. It serves as a Vue.js wrapper around the well-regarded `anvaka/panzoom` JavaScript library, inheriting its robust features and mobile-friendly design. The current stable version, 1.1.6, offers flexibility through attributes like `selector` to target specific elements within the component's scope and supports all options provided by the underlying `panzoom` library. Developers can also customize the component's name and listen to a comprehensive set of events, including its own `init` event and all `panzoom` lifecycle events, allowing for fine-grained control over the pan and zoom experience. While a strict release cadence isn't specified, the recent updates addressing Vue 3 compatibility (starting from v1.1.4) indicate active maintenance and adaptation to the Vue ecosystem's evolution. Its primary differentiator is its seamless integration into Vue applications, abstracting the complexities of direct `panzoom` library usage while exposing its full power.
npm install vue-panzoomVerified import paths — ran on the pinned version, not inferred.
Demonstrates global plugin installation with a custom component name, and basic usage within a Vue template showcasing pan/zoom on both DOM images and SVG elements, including custom options and event handling.
For Vue 2 projects, downgrade your `vue-panzoom` dependency to version 1.1.3: `npm install vue-panzoom@1.1.3`. For Vue 3 projects, ensure Vue 3 is correctly installed in your project.
If your project uses Vue 2, you must install `vue-panzoom@1.1.3` to ensure compatibility: `npm install vue-panzoom@1.1.3`. If using Vue 3, verify your Vue setup is correct.
Ensure that `import panZoom from 'vue-panzoom'; Vue.use(panZoom);` is present and executed in your main application entry point (e.g., `main.js`) before your Vue application instance is created and mounted. Also, verify that if a custom component name was provided during installation (e.g., `Vue.use(panZoom, { componentName: 'MyZoom' })`), you are using that custom name (`<MyZoom>`) in your templates.