ef-pan-zoom

Pan and zoom container. Drag or swipe to pan, pinch to zoom.

Wraps slotted content in a translate + scale transform. Drag or swipe to pan, pinch to zoom. Provides panZoomTransformContext to descendants so overlay elements like ef-overlay-layer stay in sync with the transform.

Interactive example
js
document.querySelector('ef-pan-zoom').addEventListener('transform-changed', (e) => {
  console.log(e.detail); // { x: -120, y: -40, scale: 1.5 }
});

Attributes

4 of 4

auto-fit

React prop
autoFit
Type
boolean
Default
false
Description
Automatically fits content to the viewport instead of using explicit x/y/scale.

scale

React prop
scale
Type
number
Default
1
Description
Current zoom scale factor.

x

React prop
x
Type
number
Default
0
Description
Current horizontal pan offset in pixels.

y

React prop
y
Type
number
Default
0
Description
Current vertical pan offset in pixels.

CSS Parts

Events

Methods

4 of 4