Handler to draw a point on the map. Point is displayed on activation, moves on mouse move, and is finished on mouse up. The handler triggers callbacks for ‘done’, ‘cancel’, and ‘modify’. The modify callback is called with each change in the sketch and will receive the latest point drawn. Create a new instance with the ALKMaps.Handler.Point constructor.
ALKMaps. | Handler to draw a point on the map. |
Properties | |
point | {ALKMaps.Feature.Vector} The currently drawn point |
layer | {ALKMaps.Layer.Vector} The temporary drawing layer |
multi | {Boolean} Cast features to multi-part geometries before passing to the layer. |
citeCompliant | {Boolean} If set to true, coordinates of features drawn in a map extent crossing the date line won’t exceed the world bounds. |
mouseDown | {Boolean} The mouse is down |
stoppedDown | {Boolean} Indicate whether the last mousedown stopped the event propagation. |
lastDown | {ALKMaps.Pixel} Location of the last mouse down |
lastUp | {ALKMaps.Pixel} |
persist | {Boolean} Leave the feature rendered until destroyFeature is called. |
stopDown | {Boolean} Stop event propagation on mousedown. |
stopUp | {Boolean} Stop event propagation on mouse. |
layerOptions | {Object} Any optional properties to be set on the sketch layer. |
pixelTolerance | {Number} Maximum number of pixels between down and up (mousedown and mouseup, or touchstart and touchend) for the handler to add a new point. |
touch | {Boolean} Indicates the support of touch events. |
lastTouchPx | {ALKMaps.Pixel} The last pixel used to know the distance between two touches (for double touch). |
Constructor | |
ALKMaps. | Create a new point handler. |
Functions | |
activate | turn on the handler |
createFeature | Add temporary features |
deactivate | turn off the handler |
destroyFeature | Destroy the temporary geometries |
destroyPersistedFeature | Destroy the persisted feature. |
finalize | Finish the geometry and call the “done” callback. |
cancel | Finish the geometry and call the “cancel” callback. |
click | Handle clicks. |
dblclick | Handle double-clicks. |
modifyFeature | Modify the existing geometry given a pixel location. |
drawFeature | Render features on the temporary layer. |
getGeometry | Return the sketch geometry. |
geometryClone | Return a clone of the relevant geometry. |
mousedown | Handle mousedown. |
touchstart | Handle touchstart. |
mousemove | Handle mousemove. |
touchmove | Handle touchmove. |
mouseup | Handle mouseup. |
touchend | Handle touchend. |
down | Handle mousedown and touchstart. |
move | Handle mousemove and touchmove. |
up | Handle mouseup and touchend. |
mouseout | Handle mouse out. |
passesTolerance | Determine whether the event is within the optional pixel tolerance. |
{ALKMaps.Feature.Vector} The currently drawn point
{ALKMaps.Layer.Vector} The temporary drawing layer
{ALKMaps.Pixel} Location of the last mouse down
{ALKMaps.Pixel} The last pixel used to know the distance between two touches (for double touch).
Create a new point handler.
control | {ALKMaps.Control} The control that owns this handler |
callbacks | {Object} An object with a properties whose values are functions. Various callbacks described below. |
options | {Object} An optional object with properties to be set on the handler |
create | Called when a sketch is first created. Callback called with the creation point geometry and sketch feature. |
modify | Called with each move of a vertex with the vertex (point) geometry and the sketch feature. |
done | Called when the point drawing is finished. The callback will receive a single argument, the point geometry. |
cancel | Called when the handler is deactivated while drawing. The cancel callback will receive a geometry. |
createFeature: function( pixel )
Add temporary features
pixel | {ALKMaps.Pixel} A pixel location on the map. |
modifyFeature: function( pixel )
Modify the existing geometry given a pixel location.
pixel | {ALKMaps.Pixel} A pixel location on the map. |
getGeometry: function()
Return the sketch geometry. If multi is true, this will return a multi-part geometry.
turn on the handler
activate: function()
Add temporary features
createFeature: function( pixel )
turn off the handler
deactivate: function()
Destroy the temporary geometries
destroyFeature: function( force )
Destroy the persisted feature.
destroyPersistedFeature: function()
Finish the geometry and call the “done” callback.
finalize: function( cancel )
Finish the geometry and call the “cancel” callback.
cancel: function()
Handle clicks.
click: function( evt )
Handle double-clicks.
dblclick: function( evt )
Modify the existing geometry given a pixel location.
modifyFeature: function( pixel )
Render features on the temporary layer.
drawFeature: function()
Return the sketch geometry.
getGeometry: function()
Return a clone of the relevant geometry.
geometryClone: function()
Handle mousedown.
mousedown: function( evt )
Handle touchstart.
touchstart: function( evt )
Handle mousemove.
mousemove: function( evt )
Handle touchmove.
touchmove: function( evt )
Handle mouseup.
mouseup: function( evt )
Handle touchend.
touchend: function( evt )
Handle mousedown and touchstart.
down: function( evt )
Handle mousemove and touchmove.
move: function ( evt )
Handle mouseup and touchend.
up: function ( evt )
Handle mouse out.
mouseout: function( evt )
Determine whether the event is within the optional pixel tolerance.
passesTolerance: function( pixel1, pixel2, tolerance )