[OpenLayers-Users] "hover: true" together with callback "over" problem

Daniel Kastl orkney at gmx.de
Thu May 14 20:43:51 EDT 2009


Hi list,

I have a problem with hovering over features of my vector layer.
When moving over a feature with the mouse, the icon should resize, so I 
did this in StyleMap:

var myLayer = new OpenLayers.Layer.Vector( "Vector Layer", {
    styleMap: new OpenLayers.StyleMap({
        'default': new OpenLayers.Style({
                        pointRadius: 20,
                        externalGraphic: 'img/icon.png'
        }),
        'select': new OpenLayers.Style({
                        pointRadius: 24
        })
    })
});

Additionally I wanted to open a popup (or do something else) when my 
mouse is over a feature, so I add this control:

var select = new OpenLayers.Control.SelectFeature( myLayer, {
    hover: true,
    callbacks: {
        over: function(e){
            console.info(e);
        }
    },
});
map.addControl(select);
select.activate();

Resizing the icon works fine if I only set "hover: true". But when I use 
"hover" together with "callbacks + over" it just calls the function, but 
doesn't resize anymore.

I'm using GeoExt, so OpenLayers version should be the current 2.8 branch.

Can anyone give me an advice what I'm doing wrong or how to solve this?
Thanks in advance,

Daniel



More information about the Users mailing list