[OpenLayers-Users] OpenLayers equivalent of ka-map pause event?

Eric Lemoine eric.c2c at gmail.com
Tue Jan 8 11:10:24 EST 2008


On Jan 4, 2008 6:24 AM, Steve Lime <Steve.Lime at dnr.state.mn.us> wrote:
> For completeness here's what has worked for me, as hijacked from ka-map:
>
> var timer=null, delay=2000;
> var paused=false;
>
> function mousePaused(e) {
>    var coord = map.getLonLatFromViewPortPx(e.xy);
>    ... do something with the coordinate ...
> }
>
> function mouseMove(e) {
>    if(timer) clearTimeout(timer);
>    if(paused == false)
>      self.timer = setTimeout(function(){clearTimeout(timer); paused = true; mousePaused(e); paused=false;}, delay);
> }
>
> function mouseOut(e) {
>    clearTimeout(timer);
> }
>
> and in the onload function...
>
> map.events.register("mousemove", map, mouseMove);
> map.events.register("mouseout", map, mouseOut);
>
> I can file a ticket if that would help

I implemented an hover handler that more or less does what you showed
us above. See <http://trac.openlayers.org/ticket/1255>.

--
Eric



More information about the Users mailing list