simplegeo / polymaps

Polymaps is a free JavaScript library for making dynamic, interactive maps in modern web browsers.
http://polymaps.org/
Other
1.6k stars 213 forks source link

No way to catch when move event ends? #99

Closed RyanEwen closed 12 years ago

RyanEwen commented 12 years ago

Is there a way to be notified when the move event is over? I can obviously catch when it starts, and I can set a variable to be read from elsewhere, but I can't reset it back once the move is over. Therefore I can't tell when the map is no longer moving from outside code.

mbostock commented 12 years ago

You could listen for mouseup events? As for mousewheel, no; there's no concept of merging multiple mousewheel events into a single move gesture, so there's no concept of a moveend event.

RyanEwen commented 12 years ago

Ah, that makes sense (the mousewheel issue). Thanks.

RyanEwen commented 12 years ago

I am using d3.js in conjunction with Polymaps. What do you think the easiest way would be for me to tell if the map is being clicked/moved (mousedown event)?

I am not exactly sure what object/element I should be listening for the event on (or how to do so). Kind of a noob question even though I'm not a noob. I'm just not versed in mouse events or svg :(

RyanEwen commented 12 years ago

I managed to accomplish what I needed by listening for the clicks in the window object. I found that I needed to listen on that level in case the mouse was dragged past the map bounds or the window bounds. Mouseup doesn't happen in those situations if I only listen on an element.

Thanks