Skip to content
April 13, 2012 / fastr.de

Drag and Select at Once – get mouseevents working propertly

Described in my previous Post about Drag and Select i didn’t add the SelectFeature control to the map nor activate it. So the handler that manage the click events doesn’t get activated at all.
Now i run into the problem, that i can’t figure out where someone has clicked on a polygon or somthing like that.

The solution is to share the handler from the DragFeature control with the SelectFeature control.

/**
 * overrides the activate function in the OpenLayers SelectFeature Class
 * @override
 */
/* snip */
activate: function(){
   this.handlers.feature = dragFeature.handlers.feature;
 }
/* snip */

Now you should call the selectFeature.activate() function…

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: