[OpenLayers-Users] Handler.Hover

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


Thanks Alexandre,

that's just what I was looking for. It's just isn't so easy to find any 
documentation. I guess I should start digging more stuff straight from 
the code..

- mika -

Alexandre Dube kirjoitti:
> Hi Mika,
>
> Instead of 'move', try 'pause' and set 'delay' to 100. Is that better ?
>
> Alexandre
>
> Lehtonen, Mika wrote:
>> 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 -
>> _______________________________________________
>> Users mailing list
>> Users at openlayers.org
>> http://openlayers.org/mailman/listinfo/users
>>   
>
>



More information about the Users mailing list