[OpenLayers-Users] Clicks on permalink control trigger clickout on vector layer

Christoph Böhme christoph at b3e.net
Sat Nov 14 07:40:16 EST 2009


Hi all,

in my application [1] a vector layer with an number of features is
displayed on top of a base map. When users select one of the markers
the permalink will be updated to include the id of the selected feature.
This works all fine. The problem comes when users click on the
permalink. This click will not only activate the permalink but also
trigger a mouseout event on the vector layer which unselects the
current feature and updates the permalink. This happens before the
browser follows the link which makes it impossible to follow a
permalink with a selected feature.

I tried to add an event listener to the permalink control in the hope
of catching and stopping the click event before it falls through to
the map. However, for some reason the event handler is not called.

This is the code I used for adding the event listener:

this.permalink_control = new OpenLayers.Control.Permalink(null, null,
{ eventListeners: {
	"click": function(e) {
		alert("Test");
		OpenLayers.Event.stop(e ? e: window.event);
	}
}});
this.map.addControl(this.permalink_control);
this.permalink_control.activate();

Is this the correct way to add an event listener? And would it solve
the original problem?

Please note that the application does not use the default SelectFeature
control but a custom one which includes a Drag handler in addition to
the Feature handler. I compared the handling of clickout events in the
SelectFeature control and in my control and could not find any
differences that might affect the permalink. 

Cheers,
Christoph

[1] http://mappa-mercia.org/novam/



More information about the Users mailing list