[OpenLayers-Users] registering a click event on a map
Richard Greenwood
richard.greenwood at gmail.com
Mon Sep 10 19:16:45 PDT 2012
On Mon, Sep 10, 2012 at 1:38 PM, Puneet Kishor <punk.kish at gmail.com> wrote:
> In OL 2.11 I used to do the following successfully
>
> map.events.register(
> "click",
> map,
> function(e) {
> fancyFunction({evt: e, other_params: "foo"});
> }
> );
>
> The above has stopped working in Firefox (currently using FF v. 15.0.1) without any errors. It does work in Safari 6, but gives the following warning in the console.log
>
>> event.layerX and event.layerY are broken and deprecated in WebKit. They will be removed from the engine in the near future.
>
> Suggestions to fix both problems would be welcomed with thanks.
I believe the correct way to register a click handler is something like:
var click = new OpenLayers.Control.Click( {
trigger: function(e) {
/* do stuff */
}
});
map.addControl(click);
click.activate();
--
Richard Greenwood
richard.greenwood at gmail.com
www.greenwoodmap.com
More information about the Users
mailing list