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

Change mouse cursor when panning #154

Open
calanor opened this issue Oct 12, 2015 · 2 comments
Open

Change mouse cursor when panning #154

calanor opened this issue Oct 12, 2015 · 2 comments
Milestone

Comments

@calanor
Copy link

calanor commented Oct 12, 2015

I add two simple lines for change the cursor when pan. It could be improved by putting it as an option.

Git diff from 3.2.3 version:

diff --git a/svg-pan-zoom_3.2.3.js b/svg-pan-zoom_3.2.3.js
index c1a10fd..afea72a 100755
--- a/svg-pan-zoom_3.2.3.js
+++ b/svg-pan-zoom_3.2.3.js
@@ -961,6 +961,7 @@ SvgPanZoom.prototype.handleMouseMove = function(evt) {
       , viewportCTM = this.firstEventCTM.translate(point.x - this.stateOrigin.x, point.y - this.stateOrigin.y)

     this.viewport.setCTM(viewportCTM)
+    evt.target.style.cursor = 'move';
   }
 }

@@ -981,6 +982,7 @@ SvgPanZoom.prototype.handleMouseUp = function(evt) {
   if (this.state === 'pan') {
     // Quit pan mode
     this.state = 'none'
+    evt.target.style.cursor = 'default';
   }
 }

@bumbu bumbu changed the title Idea: change cursor when pan Change mouse cursor when panning Oct 16, 2015
@bumbu
Copy link
Owner

bumbu commented Oct 16, 2015

Hi @calanor,

Thank you for sharing your solution. This seems to be simple and practical. But we'd prefer to see a more universal approach. Or something that is pluggable will be even better.

I'll not merge this into codebase, but I'll leave it open as an idea for #98.
If we'll add hooks/events for pan start and pan end then it will transform into a more universal solution.

@bumbu bumbu added this to the v4.0 milestone Dec 16, 2015
@ariutta ariutta mentioned this issue Dec 28, 2015
34 tasks
@michaelfagan
Copy link

I would also like to see this implemented, and I think this warrants being a default ON that can be turned off. Not having this seems almost like a bug... users have no indication that dragging is possible. See https://en.wikipedia.org/wiki/Affordance#As_perceived_action_possibilities

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants