OpenLayers.Handler.Click

A handler for mouse clicks.  The intention of this handler is to give controls more flexibility with handling clicks.  Browsers trigger click events twice for a double-click.  In addition, the mousedown, mousemove, mouseup sequence fires a click event.  With this handler, controls can decide whether to ignore clicks associated with a double click.  By setting a pixelTolerance, controls can also ignore clicks that include a drag.  Create a new instance with the OpenLayers.Handler.Click constructor.

Inherits from

Summary
OpenLayers.Handler.ClickA handler for mouse clicks.
Properties
delay{Number} Number of milliseconds between clicks before the event is considered a double-click.
single{Boolean} Handle single clicks.
double{Boolean} Handle double-clicks.
pixelTolerance{Number} Maximum number of pixels between mouseup and mousedown for an event to be considered a click.
dblclickTolerance{Number} Maximum distance in pixels between clicks for a sequence of events to be considered a double click.
stopSingle{Boolean} Stop other listeners from being notified of clicks.
stopDouble{Boolean} Stop other listeners from being notified of double-clicks.
Constructor
OpenLayers.Handler.ClickCreate a new click handler.
Functions
deactivateDeactivate the handler.

Properties

delay

{Number} Number of milliseconds between clicks before the event is considered a double-click.

single

{Boolean} Handle single clicks.  Default is true.  If false, clicks will not be reported.  If true, single-clicks will be reported.

double

{Boolean} Handle double-clicks.  Default is false.

pixelTolerance

{Number} Maximum number of pixels between mouseup and mousedown for an event to be considered a click.  Default is 0.  If set to an integer value, clicks with a drag greater than the value will be ignored.  This property can only be set when the handler is constructed.

dblclickTolerance

{Number} Maximum distance in pixels between clicks for a sequence of events to be considered a double click.  Default is 13.  If the distance between two clicks is greater than this value, a double- click will not be fired.

stopSingle

{Boolean} Stop other listeners from being notified of clicks.  Default is false.  If true, any listeners registered before this one for click or rightclick events will not be notified.

stopDouble

{Boolean} Stop other listeners from being notified of double-clicks.  Default is false.  If true, any click listeners registered before this one will not be notified of any double-click events.

The one caveat with stopDouble is that given a map with two click handlers, one with stopDouble true and the other with stopSingle true, the stopSingle handler should be activated last to get uniform cross-browser performance.  Since IE triggers one click with a dblclick and FF triggers two, if a stopSingle handler is activated first, all it gets in IE is a single click when the second handler stops propagation on the dblclick.

Constructor

OpenLayers.Handler.Click

Create a new click handler.

Parameters

control{OpenLayers.Control} The control that is making use of this handler.  If a handler is being used without a control, the handler’s setMap method must be overridden to deal properly with the map.
callbacks{Object} An object with keys corresponding to callbacks that will be called by the handler.  The callbacks should expect to recieve a single argument, the click event.  Callbacks for ‘click’ and ‘dblclick’ are supported.
options{Object} Optional object whose properties will be set on the handler.

Functions

deactivate

deactivate: function()

Deactivate the handler.

Returns

{Boolean} The handler was successfully deactivated.

deactivate: function()
Deactivate the handler.
{Number} Maximum number of pixels between mouseup and mousedown for an event to be considered a click.
Create a new click handler.
Base class to construct a higher-level handler for event sequences.
Controls affect the display or behavior of the map.
Close