question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

startScale and startX ignored when disableZoom and disablePan set to true

See original GitHub issue

Describe the bug

When initiating panzoom, I have set a startScale and startX. These work fine. Until you also want to disable panning and zooming. If you set disablePan and disableZoom when you call the Panzoom() method, startScale and startX are ignored. I’ve also tried using setOptions to set disablePan and disableZoom after calling Panzoom() with startScale and startX - this fixes the problem with scaling, but not with panning.

Your environment

  • Version of panzoom: 4.4.0
  • Browser and browser version: Chrome 91.0.4472.114 (Official Build) (x86_64)

Expected behaviour

Panzoom objects should start at scale and translation specified by startScale and startX even if disablePan and disableZoom are set to true.

Actual behaviour

Panzoom objects ignore startScale and startX when disablePan and disableZoom are set to true.

Steps to reproduce

As described. Demo: https://jsbin.com/joquhey/4/edit?js,output

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
jdjoshuadavisoncommented, Jun 29, 2021

I tried it in your jsbin just now and it all works. Only thing was the last example needed to wait for the scale to paint before calling pan. See the note on async.

Can confirm this is now working as expected. Many thanks.

1reaction
timmywilcommented, Jun 28, 2021

I tried it in your jsbin just now and it all works. Only thing was the last example needed to wait for the scale to paint before calling pan. See the note on async.

Read more comments on GitHub >

github_iconTop Results From Across the Web

panzoom/panzoom/README.md - UNPKG
Panzoom ensures the defaults are set to what it expects to calculate focal ... 241, override and ignore options such as disablePan, ......
Read more >
D3 disable pan & zoom when scrolling - Stack Overflow
The filter actually really ignores what's going on, it seems. To implement: let isZooming = true; // Use controls to set to true...
Read more >
Panning and Zooming Any Elements - panzoom - jQuery Script
panzoom is a simple JavaScript plugin that allows you to drag, pan, zoom in/out any elements of your webpage using CSS3.
Read more >
Disable pan and zoom in OpenLayers - GIS Stack Exchange
In OpenLayers 5 using ES modules: import Map from 'ol/Map'; import View from 'ol/View'; import TileLayer from 'ol/layer/Tile'; ...
Read more >
Zoom | Blockly - Google Developers
Set to true to allow the mouse wheel to zoom. Defaults to false . startScale. Initial magnification factor. For applications with multiple ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found