startScale and startX ignored when disableZoom and disablePan set to true
See original GitHub issueDescribe 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:
- Created 2 years ago
- Comments:5 (3 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Can confirm this is now working as expected. Many thanks.
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.