neo4j-contrib / graphgist

Easy publishing with graph data included
http://gist.neo4j.org/
208 stars 68 forks source link

Fix panning and console.log errors #25

Closed trengrj closed 10 years ago

trengrj commented 10 years ago

This should fix the panning issues and also the ".on" errors that were coming up before.

I'm not sure what to do with things like double click zooming and touches. I've enabled them for now but check out if this behaviour is what you want.

nawroth commented 10 years ago

I found double-clicking nice, but I can't zoom using the mouse any more.

trengrj commented 10 years ago

@nawroth Are you running ubuntu unity?

nawroth commented 10 years ago

@trengrj Yes I am. Forgot to say that and that it was in Chrome.

trengrj commented 10 years ago

@nawroth I've added two more events. Unfortunately in d3.js there seems no way to cleanly disable and then reenable zoom.behavior functionality: https://github.com/mbostock/d3/issues/894

nawroth commented 10 years ago

I don't see any difference. Does it matter that I actually use a touchpad with two-finger-scroll? Worked previously. And doesn't work in Chrome or Firefox using this PR.

trengrj commented 10 years ago

That could be the issue. I've added touch* events which I thought were for mobile devices.

trengrj commented 10 years ago

With unity you may need to hold down Ctrl+Alt then two finger zoom as unity intercepts the Alt key.

nawroth commented 10 years ago

No change, doesn't work in Chrome (Ctrl+Alt triggers page zoom) or Firefox (triggers nothing). I wonder why it worked before!

nawroth commented 10 years ago

I messed up a bit when testing it seems. Zoom now works in Chrome under Ubuntu, but not in Firefox!

nawroth commented 10 years ago

Changing to accept both Alt and Shift keys: d3.event.altKey || d3.event.shiftKey I get the following result: In Chrome I can pan with Shift, and zoom using Alt. In Firefox I can pan and zoom with Shift.

Any disadvantages with adding that?

jexp commented 10 years ago

What about panning the whole image with a transform when clicking on the blank background? Would that work too?

nawroth commented 10 years ago

@trengrj I added this: https://github.com/neo4j-contrib/graphgist/commit/b098399e305dcb21fc27f648d63c6c9fb74348a7 We'll see if it blows up in some browser.

trengrj commented 10 years ago

@nawroth adding the optional shift key was a good idea! I'll try to do some testing on an ubuntu machine and see if I can isolate the issue.