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.

Option to enabled/disable pan zoom

See original GitHub issue

This library has made my job easier. I would like to see option or function to enable/disable pan and or zoom. Right now the only way to achieve is to dispose() and recreate;

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:6
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
awulkancommented, Apr 24, 2018

I was wondering the same. It would be really nice to disable/enable these things manually.

I added some functions to make it possible in my code.

      function disable() {
        wheel.removeWheelListener(owner, onMouseWheel)
        owner.removeEventListener('mousedown', onMouseDown)
        owner.removeEventListener('keydown', onKeyDown)
        owner.removeEventListener('dblclick', onDoubleClick)
        if (frameAnimation) {
          window.cancelAnimationFrame(frameAnimation)
          frameAnimation = 0
        }
      }

      function enable() {
        owner.addEventListener('mousedown', onMouseDown)
        owner.addEventListener('dblclick', onDoubleClick)
        owner.addEventListener('touchstart', onTouch)
        owner.addEventListener('keydown', onKeyDown)
        wheel.addWheelListener(owner, onMouseWheel)
      }
      return {
        enable: enable,
        disable: disable,
        dispose: dispose,
        moveBy: internalMoveBy,
        moveTo: moveTo,
        centerOn: centerOn,
        zoomTo: publicZoomTo,
        zoomAbs: zoomAbs,
        getTransform: getTransformModel,
        showRectangle: showRectangle
      }

It might not be the optimal solution though.

0reactions
anvakacommented, Aug 25, 2018

HI guys, just added three methods pause(), resume(), isPaused(). Documentation is here. Should be available in v6.1.0

Read more comments on GitHub >

github_iconTop Results From Across the Web

Panzoom - How to disable the drag option? - Stack Overflow
Use the disablePan option: $section.find('.panzoom').panzoom({ disablePan: true, $zoomIn: $section.find(".zoom-in"), $zoomOut: $section.find(".zoom-out"), ...
Read more >
Disable pan and zoom - Adobe Support Community - 11692553
Is there a way to disable the pan and zoom feature by default? When I add a photo it is automatically on and...
Read more >
Disable pan and zoom in OpenLayers - GIS Stack Exchange
I'm using the latest version of OpenLayers in my map application, and I need disable all zoom functions and panning for users.
Read more >
Panning and zooming in 2D | Maya 2020
Tip: You can also toggle between enabling and disabling 2D Pan/Zoom by clicking the hotkey \ or the button in the Panel toolbar....
Read more >
How do I disable pan and zoom on a map? - Esri Community
Solved: How do I disable pan and zoom on a map? Here is my map definition: Yet it doesn't disable any of the...
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