[OpenLayers-Users] Handler.Hover

Lehtonen, Mika mika at digikartta.net
Wed Dec 10 11:37:48 EST 2008


Hi,

please help me understand. I just can't undestand how the hover 
handler's delay parameter works.

http://dev.openlayers.org/releases/OpenLayers-2.7/doc/apidocs/files/OpenLayers/Handler/Hover-js.html

Actually what I would like to accomplish is to restrict what happens 
during the mousemove over the map. Just registering mousemove freezes my 
application. There is a couple of hundreds polygons from which I'd like 
to get info while mouse moving over. But I don't want nothing to happen 
during the sudden mouse over. Something can be done with pixelTolerance 
but I would also like to use time as a parameter. Here is what I tried 
(modified click handler example):

            OpenLayers.Control.Hover = 
OpenLayers.Class(OpenLayers.Control, {               
                defaultHandlerOptions: {
            'delay': 1000,
            'pixelTolerance': 10,
                },
                initialize: function(options) {
                    this.handlerOptions = OpenLayers.Util.extend(
                        {}, this.defaultHandlerOptions
                    );
                    OpenLayers.Control.prototype.initialize.apply(
                        this, arguments
                    );
                    this.handler = new OpenLayers.Handler.Hover(
                        this, {
                            'move': this.trigger
                        }, this.handlerOptions
                    );
                },

                trigger: doSomethingFunction
            });

And like this I activate my control:

                var hover = new OpenLayers.Control.Hover();
                map.addControl(hover);
                hover.activate();

- mika -



More information about the Users mailing list