Skip to content

API change with `focal` option

Compare
Choose a tag to compare
@timmywil timmywil released this 27 Mar 15:28
· 365 commits to main since this release

By default, whenever the focal option was used it disabled animations. It was meant to be used with pinch zooming and mousewheel zooming, which should not animate. However, I've seen some cases where focal has been used and animating is necessary.

Migrating

If you've been using the focal option with the mousewheel, make sure to set animate to false.

$panzoom.parent().on('mousewheel.focal', function( e ) {
  e.preventDefault();
  var delta = e.delta || e.originalEvent.wheelDelta;
  var zoomOut = delta ? delta < 0 : e.originalEvent.deltaY > 0;
  $panzoom.panzoom('zoom', zoomOut, {
    increment: 0.1,
    focal: e,
    animate: false
  });
});

Aside from this change, the latest updates to panzoom are also really exciting.

  1. Improved performance across the board. Every panzoom element now has its own compositor layer.
  2. Improved support for CommonJS loading.