giscloud / tracker

2 stars 0 forks source link

"featureOver" event needs delay #3

Open tjwebb opened 12 years ago

tjwebb commented 12 years ago

We need a built-in delay option to avoid being barraged with thousands of featureOver events from accidental mouse/map intersection. A zero-delay should be possible, but easily supplantable without having to write custom logic.

neno-giscloud commented 12 years ago

One could use a throttling function like this https://gist.github.com/3084030. This way you event handler would be called at most once in a set period.

tjwebb commented 12 years ago

Yes, and I've already implemented a solution. But the semantics implied by "featureOver" are ill-defined. A DOM "mouseover" event is fired only once when the mouse enters the element that is listening. It seems like a "featureOver" event should fire one event when I hover over a feature. You could have a separate event called "featureMouseMove" or similar, which would fire on every mouse move.

neno-giscloud commented 12 years ago

Naming is a bit off, yes.

The 'featureOver' now behaves like something which would be more appropriately referred to as 'featureMouseMove'. What do you think, should we implement the other two events as featureOver/featureOut or featureEnter/featureLeave?