Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Option to enabled/disable pan zoom #11

Closed
msuntharesan opened this issue Oct 18, 2017 · 6 comments
Closed

Option to enabled/disable pan zoom #11

msuntharesan opened this issue Oct 18, 2017 · 6 comments

Comments

@msuntharesan
Copy link

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;

@C05CDA
Copy link

C05CDA commented Oct 22, 2017

i agree 100%.

@awulkan
Copy link

awulkan commented 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.

@DavidMellul
Copy link

Is there any plan to implement this functionality ?

@torinberger
Copy link

this would be great for a project of mine? Any developments?

@torinberger
Copy link

Just found it, https://www.npmjs.com/package/jquery.panzoom#disable

Thanks alot!

@anvaka
Copy link
Owner

anvaka commented Aug 25, 2018

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

@anvaka anvaka closed this as completed Aug 25, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants