API Documentation | All Packages | All Classes | Index | Frames No Frames |
Class ClickHandler

Package | org.openscales.core.handler.mouse
Class | public class ClickHandler
Inheritance | ClickHandler Handler
Subclasses | SelectFeaturesHandler

ClickHandler detects a click-actions on the map: simple click, double click and drag&drop are managed. To use this handler, it's necessary to add it to the map. It is a pure ActionScript class. Flex wrapper and components can be found in the openscales-fx module (same name prefixed by Fx).

Public Properties
Hide Inherited Public Properties
Show Inherited Public Properties

| Property | Defined by
--- | --- | ---
|  | active : Boolean Getter and setter of the boolean defining the activity of the handler | Handler
|  | click : Function Click function getter and setter | ClickHandler
|  | doubleClick : Function Double click function getter and setter | ClickHandler
|  | drag : Function Drag function getter and setter | ClickHandler
|  | drop : Function Drop function getter and setter | ClickHandler
|  | map : Map Getter and setter of the map associated to the handler | Handler
|  | toggleHandlerActivity : Function Getter and setter of the callback function used when the handler's activity changes | Handler

Protected Properties

| Property | Defined by
--- | --- | ---
|  | _ctrlKey : Boolean = false CTRL is pressed ? | ClickHandler
|  | _downPixel : Pixel = null Pixel under the cursor when the mouse is down | ClickHandler
|  | _dragging : Boolean = false | ClickHandler
|  | _shiftKey : Boolean = false SHIFT is pressed ? | ClickHandler
|  | _upPixel : Pixel = null Pixel under the cursor when the mouse is up | ClickHandler

Public Methods

| Method | Defined by
--- | --- | ---
|  | ClickHandler(map:Map = null, active:Boolean = false) Constructor of the handler. | ClickHandler

Protected Methods

| Method | Defined by
--- | --- | ---
|  | mouseDown(evt:MouseEvent):void The MouseDown Listener | ClickHandler
|  | mouseMove(evt:MouseEvent):void The MouseMove Listener | ClickHandler
|  | mouseUp(evt:MouseEvent):void MouseUp Listener | ClickHandler
|  | registerListeners():void Add the listeners to the associated map | ClickHandler
|  | selectionBoxCoordinates(p:Pixel, buffer:Number = 0):Bounds The select box, in map's coordinates, defining by the point clicked at the beginning of the drag (mouseDown) and the point where the mouseUp event occurs. | ClickHandler
|  | selectionBoxPixels(p:Pixel, buffer:Number = 0):Rectangle The select box, in pixels, defining by the pixel clicked at the beginning of the drag (mouseDown) and the pixel where the mouseUp event occurs. | ClickHandler
|  | startCoordinates():LonLat Map coordinates (in its baselayer's SRS) of the point clicked (at the beginning of the drag) | ClickHandler
|  | unregisterListeners():void Remove the listeners to the associated map | ClickHandler

Property detail

click | property

`click:Function` [read-write]

Click function getter and setter

Implementation
`public function get click():Function`
`public function set click(value:Function):void`

_ctrlKey | property |

`protected var _ctrlKey:Boolean = false`

CTRL is pressed ?

doubleClick | property |

`doubleClick:Function` [read-write]

Double click function getter and setter

Implementation
`public function get doubleClick():Function`
`public function set doubleClick(value:Function):void`

_downPixel | property |

`protected var _downPixel:Pixel = null`

Pixel under the cursor when the mouse is down

drag | property |

`drag:Function` [read-write]

Drag function getter and setter

Implementation
`public function get drag():Function`
`public function set drag(value:Function):void`

_dragging | property |

`protected var _dragging:Boolean = false`

drop | property |

`drop:Function` [read-write]

Drop function getter and setter

Implementation
`public function get drop():Function`
`public function set drop(value:Function):void`

_shiftKey | property |

`protected var _shiftKey:Boolean = false`

SHIFT is pressed ?

_upPixel | property |

`protected var _upPixel:Pixel = null`

Pixel under the cursor when the mouse is up

Constructor detail

ClickHandler | () | constructor

`public function ClickHandler(map:Map = null, active:Boolean = false)`

Constructor of the handler.

Parameters

| `map:Map` (default = `null`)`` — the map associated to the handler
| `active:Boolean` (default = `false`)`` — boolean defining if the handler is active or not

Method detail

mouseDown | () | method

`protected function mouseDown(evt:MouseEvent):void`

The MouseDown Listener

Parameters

| `evt:MouseEvent` — the MouseEvent

mouseMove | () | method |

`protected function mouseMove(evt:MouseEvent):void`

The MouseMove Listener

Parameters

| `evt:MouseEvent` — the MouseEvent

mouseUp | () | method |

`protected function mouseUp(evt:MouseEvent):void`

MouseUp Listener

Parameters

| `evt:MouseEvent` — the MouseEvent

registerListeners | () | method |

`protected override function registerListeners():void`

Add the listeners to the associated map

selectionBoxCoordinates | () | method |

`protected function selectionBoxCoordinates(p:Pixel, buffer:Number = 0):Bounds`

The select box, in map's coordinates, defining by the point clicked at the beginning of the drag (mouseDown) and the point where the mouseUp event occurs. This function calls selectBoxPixels and convert the Rectangle of pixels in a Bounds of map's coordinates.

Parameters

| `p:Pixel` — the MouseEvent that defines the second point of the box
| `buffer:Number` (default = `0`)`` — the buffer, in pixels (not in coordinates), to use to enlarge the selection box (useful to improve the ergonomy)

Returns

| `Bounds`

selectionBoxPixels | () | method |

`protected function selectionBoxPixels(p:Pixel, buffer:Number = 0):Rectangle`

The select box, in pixels, defining by the pixel clicked at the beginning of the drag (mouseDown) and the pixel where the mouseUp event occurs.

Parameters

| `p:Pixel` — the MouseEvent that defines the second point of the box
| `buffer:Number` (default = `0`)`` — the buffer, in pixels, to use to enlarge the selection box (useful to improve the ergonomy)

Returns

| `Rectangle`

startCoordinates | () | method |

`protected function startCoordinates():LonLat`

Map coordinates (in its baselayer's SRS) of the point clicked (at the beginning of the drag)

Returns

| `LonLat`

unregisterListeners | () | method |

`protected override function unregisterListeners():void`

Remove the listeners to the associated map