Last updated

API / geotoolkit / controls / tools / CrossHair / CrossHair

Class: CrossHair

tools.CrossHair.CrossHair

Creates a CrossHair tool. The tool supports events shown below. It provides built-in functions to customise the styles for the tool and its labels.

Events [Events](../enums/geotoolkit.controls.tools.crosshair.events.md)
EventArgumentsDescription
onPositionChanged[CrossHairEventArgs](../classes/geotoolkit.controls.tools.crosshaireventargs.crosshaireventargs.md)This Event is fired when the Cross Hair Mouse position has been changed
onPointerUp[CrossHairEventArgs](../classes/geotoolkit.controls.tools.crosshaireventargs.crosshaireventargs.md)This Event is fired when the Cross Hair pointer is up
onPointerDown[CrossHairEventArgs](../classes/geotoolkit.controls.tools.crosshaireventargs.crosshaireventargs.md)This Event is fired when the Cross Hair pointer is down

Hierarchy

Table of contents

Constructors
[new CrossHair(layer, name)](/solutions/geotoolkit/apis/classes/geotoolkit.controls.tools.crosshair.crosshair.md#new crosshair(layer, name))[new CrossHair(options)](/solutions/geotoolkit/apis/classes/geotoolkit.controls.tools.crosshair.crosshair.md#new crosshair(options))
Methods
Css Properties
Name Type Description
eastLabelSettingsJSON for east label. See setLabelSettings for more details
east-alignmentAnchorTypeAlignment of the text
east-cssclassstringThe css class name of this node
east-displaymodeLabelDisplayModeLabel display mode, default is LabelDisplayMode.Shape
east-fillstylestringFill style of the text
east-fillstyleFillStyleFill style of the text
east-fillstyle-colorstringColor in CSS form
east-fillstyle-evenoddmodebooleanEven-odd fill mode
east-fillstyle-fillpatternPatternPattern
east-fillstyle-fillpattern-containernamestringAn optional container name, which creates an image pattern. This parameter is used for serialization if you want to save are reference to pattern instead of the pattern itself
east-fillstyle-fillpattern-patternnamestringName of this pattern for indexing
east-fillstyle-fillpattern-scalablebooleanFlag that sets scalability of the pattern coordinates, or relative to the shape it is filling (It is not supported)
east-fillstyle-foregroundstringForeground color
east-fillstyle-patternPatternPattern
east-linestylestringLine style of the text border
east-linestyleLineStyleLine style of the text border
east-linestyle-colorstringColor in CSS form
east-linestyle-fillstringOptional fill style to be used to fill lines generated with this style
east-linestyle-fillFillStyleOptional fill style to be used to fill lines generated with this style
east-linestyle-linecapCapStyleThe line cap style
east-linestyle-linedashoffsetnumberLine dash offset of dashed line
east-linestyle-linejoinJoinStyleThe line join style
east-linestyle-pixelsnapmodebooleanPixel Snap Mode, default(
east-linestyle-scalablebooleanTrue if width should depend on transformation
east-linestyle-unitstringOptional unit for the width
east-linestyle-widthnumber | stringThe line thickness
east-offsetnumber | stringLabel offset between the text and cross-hair cursor, use padding in case of undefined
east-paddingnumber
east-paddingstylenumber | stringPadding style between the text and the border
east-radiusnumberRadius of the text shape border
east-textstylestringText style of the text
east-textstyleTextStyleText style of the text
east-textstyle-alignmentAlignmentStyleAlignment
east-textstyle-autosizebooleanAuto font size on high definition display
east-textstyle-backgroundstringBackground style
east-textstyle-backgroundFillStyleBackground style
east-textstyle-baselineBaseLineStyleBase line
east-textstyle-colorstringColor in CSS form
east-textstyle-fillFillStyleText fill style
east-textstyle-fontstringFont see
east-textstyle-fonturlstringThe place from which the font will be loaded, if null - uses system fonts. It can be base64 with url keyword
east-textstyle-lineheightstring | numberLine height
east-textstyle-multilinebooleanAllow multi-line text
east-textstyle-outlinestringOutline style
east-textstyle-outlineLineStyleOutline style
east-textstyle-overflowwrapOverflowWrapStyleOverflow wrap
east-textstyle-strikethroughstringStrikethrough style
east-textstyle-strikethroughLineStyleStrikethrough style
east-textstyle-textoverflowTextOverflowStyleText overflow
east-textstyle-underlinestringUnderline style
east-textstyle-underlineLineStyleUnderline style
east-textstyle-underlineoffsetstring | numberUnderline offset distance
east-textstyle-whitespaceWhiteSpaceStyleWhite space
east-textstyle-wordbreakWordBreakStyleWord break
east-tooltipPropertiesTooltip properties, this options applyes only in case if displaymode:LabelDisplayMode.DivElement
east-tooltip-alignmentAnchorTypeTooltip alignment according to the point set by offsets
east-tooltip-autoflipbooleanTrue to automatically flip tooltip alignment if it doesn't fit the window
east-tooltip-cssclassesstringCSS classes' names to be applied for tooltip 'cg-tooltip' by default
east-tooltip-delaynumber
east-tooltip-hidedelaynumberAuto hide in millisecond, 0 means false and autohide is disabled
east-tooltip-offsetxnumberOffset of tooltip from current position by x in pixels
east-tooltip-offsetynumberOffset of tooltip from current position by y in pixels
east-tooltip-orientationOrientationTooltip orientation
east-tooltip-showdelaynumberDelay between displaying tooltip, 0 means false and tooltip shows immediately
east-tooltip-sizeRangeClient size range
east-tooltip-size-highnumberUpper range boundary
east-tooltip-size-lownumberLower range boundary
east-tooltip-size-maxnumber
east-tooltip-size-minnumber
east-visiblebooleanVisibility of the text
east-z-indexnumberDefine node z-index
enabledbooleanEnabled state
fillstylestringFillstyle of the cross-hair (used only with radius)
fillstyleFillStyleFillstyle of the cross-hair (used only with radius)
horizontalstringLinestyle for horizontal line
horizontalLineStyleLinestyle for horizontal line
keeporientationbooleanPreserve annotation's orientation of labels for different
labelsbooleanIf 'none' of false - do not create labels
layerCompositeNodeManipulator layer
layer-clippingbooleanEnable clipping, this does not consider the clipstyle, it is related to bounds-clipping
layer-clipstyleClipStyleClipping style
layer-clipstyle-evenoddbooleanTrue if evenodd mode is on ('nonzero' mode otherwise)
layer-clipstyle-geometryGraphicsPathClipping geometry
layer-clipstyle-geometry-boundsRectBounds
layer-clipstyle-geometry-bounds-heightnumberHeight
layer-clipstyle-geometry-bounds-readonlybooleanReadonly
layer-clipstyle-geometry-bounds-widthnumberWidth
layer-clipstyle-geometry-bounds-xnumberLeft
layer-clipstyle-geometry-bounds-ynumberTop
layer-clipstyleGraphicsPathClipping style
layer-cssclassstringThe css class name of this node
layer-csscursorstringCSS cursor associated with node
layer-cssstylestringCSS style to be applied to inserted elements
layer-idstring | numberId of the node, its a unique identifier
layer-infinitybooleanMode to render outside the model limits
layer-localtransformTransformationLocal transformation
layer-localtransform-dxnumberX axis translation
layer-localtransform-dynumberY axis translation
layer-localtransform-xxnumberX scale
layer-localtransform-xynumberXy skew
layer-localtransform-yxnumberYx skew
layer-localtransform-yynumberY scale
layer-marginsnumber | stringIt has properties for specifying the margins for each side
layer-namestringName of the node. It is often used for debugging purposes or to simplify queries
layer-opacitynumberNode opacity (from 0 to 1). If it is undefined or null it inherits property from the parent. It changes globalAlpha on the rendering context
layer-opacityblendmodeBlendModeNode opacity mode to blend it
layer-scalescrollstrategyScaleScrollStrategyScale scroll strategy
layer-scalescrollstrategy-enabledbooleanEnable flag
layer-selectablebooleanSelectable node, a boolean to determine if selection should consider this node
layer-taganyCustom information associated with node. It is a user object which can be used by client code to store information or attach an application object to the shape
layer-transformstringAdditional CSS transformation applied to node or 'none'
layer-transformTransformationAdditional CSS transformation applied to node or 'none'
layer-visiblebooleanVisibility of the node, a boolean to determine if the node should be rendered or not
layer-z-indexnumberDefine node z-index
linestylestring
  • default linestyle shared for all orientations
linestyleLineStyle
  • default linestyle shared for all orientations
mouseradiusnumberDevice radius for mouse events
namestringName of the tool used like cross-hair etc
northLabelSettingsJSON for north label. See setLabelSettings for more details
outlinestylestringOutLinestyle for both lines
outlinestyleLineStyleOutLinestyle for both lines
radiusnumberRadius of the cross-hair center target
southLabelSettingsJSON for south label. See setLabelSettings for more details
symbolSymbolShapeSymbol of the cross-hair
symbol-alignmentAnchorTypeAlignment according to the anchor point
symbol-alignmentAnchorTypeAnchor type of symbol
symbol-axnumberAnchor x position
symbol-aynumberAnchor y position
symbol-cachebooleanSet it to true if you want to cache complex geometry to raster
symbol-clipstyleClipStyleClipping style
symbol-clipstyleGraphicsPathClipping style
symbol-cssclassstringThe css class name of this node
symbol-csscursorstringCSS cursor associated with node
symbol-cssstylestringCSS style to be applied to inserted elements
symbol-fillstylestringStyle applied on fill
symbol-fillstyleFillStyleStyle applied on fill
symbol-heightnumberShape height
symbol-idstring | numberId of the node, its a unique identifier
symbol-ispointingupbooleanDefines whether the shape is always pointing up
symbol-layoutstyleLayoutStyleLayout style to specify how to lay out shape
symbol-layoutstyle-constraintSizeConstraintLayout constrains
symbol-layoutstyle-flexgrownumberNumber specifying how much the item will grow relative to the rest of the items inside the same container
symbol-layoutstyle-flexshrinknumberNumber specifying how much the item will shrink relative to the rest of the items inside the same container
symbol-layoutstyle-floatstringFloat position
symbol-layoutstyle-positionstringLayout position
symbol-layoutstyle-sizenumber | stringLayout size
symbol-linestylestringStyle applied on outline
symbol-linestyleLineStyleStyle applied on outline
symbol-localtransformTransformationLocal transformation
symbol-marginsnumber | stringIt has properties for specifying the margins for each side
symbol-maxdimensionDimensionMaximum size for rendering
symbol-maxdimension-heightnumberHeight of dimension
symbol-maxdimension-widthnumberWidth of dimension or properties
symbol-mindimensionDimensionMinimum size for rendering
symbol-namestringName of the node. It is often used for debugging purposes or to simplify queries
symbol-opacitynumberNode opacity (from 0 to 1). If it is undefined or null it inherits property from the parent. It changes globalAlpha on the rendering context
symbol-opacityblendmodeBlendModeNode opacity mode to blend it
symbol-painterstringA function with has parameters: symbol, box, context
symbol-painterpropertiesanySymbol's painter's properties
symbol-preserveaspectratiobooleanPreserve aspect ratio of the anchored shape
symbol-preservereadingorientationbooleanPreserve reading orientation for local transform
symbol-preserverightanglebooleanPreserve right angle for local transformation
symbol-rotationanglenumberRotation angle at anchor
symbol-scalescrollstrategyScaleScrollStrategyScale scroll strategy
symbol-selectablebooleanSelectable node, a boolean to determine if selection should consider this node
symbol-sizeisindevicespacebooleanIs coordinate in device space
symbol-taganyCustom information associated with node. It is a user object which can be used by client code to store information or attach an application object to the shape
symbol-transformstringAdditional CSS transformation applied to node or 'none'
symbol-transformTransformationAdditional CSS transformation applied to node or 'none'
symbol-useminmaxdimensionsbooleanUse the min max dimensions to limit visual size
symbol-visiblebooleanVisibility of the node, a boolean to determine if the node should be rendered or not
symbol-widthnumberShape width
symbol-z-indexnumberDefine node z-index
textstylestring
  • default textstyle shared for all orientations
textstyleTextStyle
  • default textstyle shared for all orientations
touchradiusnumberDevice radius for touch events
verticalstringLinestyle for vertical line
verticalLineStyleLinestyle for vertical line
westLabelSettingsJSON for west label. See setLabelSettings for more details

Contents

Constructors

new CrossHair(layer, name)

new CrossHair(layer?, name?)

Creates CrossHair

Parameters

Name Type Description
Optional layerCompositeNode<Node>manipulator layer
Optional namestringname of the tool used like cross-hair etc

Overrides

AbstractTool.constructor


new CrossHair(options)

new CrossHair(options?)

Creates CrossHair

Parameters

Name Type Description
Optional optionsOptionsproperties object

Overrides

AbstractTool.constructor

Methods

addListener

addListener(eventName, listener): CrossHair

add event listener. The listener receives the message when the system event happens.

Deprecated

since 4.0 use .on() instead. Note that 3 args callback should be used in subscription via .on(): (eventType, source, args)

Parameters

Name Type Description
eventNamestringevent name or unique event identifier
listenerFunctionthe event listener

Returns

CrossHair

Inherited from

AbstractTool.addListener


captureMouseUp

captureMouseUp(): void

listen to window mouse events in order to catch a mouse up action outside of the tool container DOM element. useful for example when you pan and release click outside of DOM element.

Returns

void

Inherited from

AbstractTool.captureMouseUp


dispose

dispose(): void

Dispose tool.

Returns

void

Inherited from

AbstractTool.dispose


fireEvent

fireEvent(eventName, eventArgs?): void

This method is Protected. Fire an Event.

Deprecated

since 4.0 use .notify() instead. Note that 3 args callback should be used in subscription via .on()

Parameters

Name Type Description
eventNamestringevent name
Optional eventArgsanycontains info of the event

Returns

void

Inherited from

AbstractTool.fireEvent


getClassName

getClassName(): string

Returns

string

Inherited from

AbstractTool.getClassName


getEventRadius

Protected getEventRadius(eventArgs): number

Returns device radius for the provided event

Parameters

Name Type Description
eventArgsEventArgscontains info of the event

Returns

number

Inherited from

AbstractTool.getEventRadius


getFillStyle

getFillStyle(): FillStyle

Return fill style

Returns

FillStyle


getHorizontalLineStyle

getHorizontalLineStyle(): LineStyle

return horizontal line style

Returns

LineStyle


getLabelSettings

getLabelSettings(orientation): LabelSettingsOut

Gets settings for one label

Parameters

Name Type Description
orientationAnnotationLocationlabel orientation

Returns

LabelSettingsOut

JSON to configure label


getLineStyle

getLineStyle(): LineStyle

Return line style

Returns

LineStyle


getManipulatorLayer

getManipulatorLayer(): CompositeNode<Node>

return manipulator layer

Returns

CompositeNode<Node>

layer

Inherited from

AbstractTool.getManipulatorLayer


getMouseRadius

getMouseRadius(): number

Returns current device radius for mouse events

Returns

number

Inherited from

AbstractTool.getMouseRadius


getName

getName(): string

return tool name if any

Returns

string

name of the tool

Inherited from

AbstractTool.getName


getOutLineStyle

getOutLineStyle(): LineStyle

Return outline style

Returns

LineStyle


getParentTool

getParentTool(): AbstractCompositeTool

Gets parent tool

Returns

AbstractCompositeTool

parent tool

Inherited from

AbstractTool.getParentTool


getPosition

getPosition(): Point

The current cross hair position

Returns

Point


getProperties

getProperties(context?): OptionsOut

Gets all the properties pertaining to this object

Parameters

Name Type Description
Optional contextISerializationContextserialization context

Returns

OptionsOut

properties object

Overrides

AbstractTool.getProperties


getProperty

getProperty(name): any

Gets dynamic property by name. These properties can be used as a property bags

Parameters

Name Type Description
namestringproperty name

Returns

any

Inherited from

AbstractTool.getProperty


getPropertyKeys

getPropertyKeys(): string[]

Returns known properties keys

Returns

string[]

Inherited from

AbstractTool.getPropertyKeys


getRadius

getRadius(): number

Returns radius of the cursor center target

Returns

number


getRoot

getRoot(): AbstractCompositeTool

Gets root tool

Returns

AbstractCompositeTool

parent tool

Inherited from

AbstractTool.getRoot


getSymbol

getSymbol(): SymbolShape

Return cross-hair symbol

Returns

SymbolShape


getTarget

getTarget(): Node

Returns current target

Returns

Node

target


getTouchRadius

getTouchRadius(): number

Returns current device radius for touch events

Returns

number

Inherited from

AbstractTool.getTouchRadius


getVerticalLineStyle

getVerticalLineStyle(): LineStyle

return vertical line style

Returns

LineStyle


hasEventListener

hasEventListener(type, callback?): boolean

Check if a list of event listeners for this type contains this listener

Parameters

Name Type Description
typestringtype of event or property
Optional callbackFunctionto be called, if null, check if any callback is registered

Returns

boolean

Inherited from

AbstractTool.hasEventListener


isActive

isActive(): boolean

return active state

Returns

boolean

Inherited from

AbstractTool.isActive


isDisposed

isDisposed(): boolean

Returns whether this object has been disposed

Returns

boolean

Inherited from

AbstractTool.isDisposed


isDoubleClick

Protected isDoubleClick(point, eventArgs?): boolean

returns true if double clicked

Parameters

Name Type Description
pointPointClick point
Optional eventArgsEventArgsoptional event args to verify double click

Returns

boolean

Inherited from

AbstractTool.isDoubleClick


isEnabled

isEnabled(): boolean

returns enable state

Returns

boolean

state

Inherited from

AbstractTool.isEnabled


isSilent

isSilent(): boolean

Return true if the event dispatcher doesn't notify any events

Returns

boolean

Inherited from

AbstractTool.isSilent


isTouchEvent

isTouchEvent(eventArgs): boolean

return true if the event is a touch event and false otherwise.

Parameters

Name Type Description
eventArgsEvent | EventArgscontains info of the event

Returns

boolean

Inherited from

AbstractTool.isTouchEvent


isVisible

isVisible(): boolean

return visible state

Returns

boolean


notify

notify<E>(type, source, args?): CrossHair

Notify listeners

Type parameters

NameType
Eextends string

Parameters

Name Type Description
typeEevent types
sourceCrossHairof the event
Optional argsEventMap[E]arguments of the event

Returns

CrossHair

this

Overrides

AbstractTool.notify


off

off<E>(type?, callback?): CrossHair

Detach listener on event. Calling .off() with no arguments removes all attached listeners. Calling .off(type) with no callback removes all attached listeners for specific type.

Type parameters

NameType
Eextends string

Parameters

Name Type Description
Optional typeEtype of the event
Optional callback(eventType: E, sender: CrossHair, args: EventMap[E]) => voidfunction to be called

Returns

CrossHair

this

Overrides

AbstractTool.off


on

on<E>(type, callback): CrossHair

Attach listener on event that will be called whenever the specified event is delivered to the target

If the callback function is already in the list of event listeners for this target, the function is not added a second time.

If a particular anonymous function is in the list of event listeners registered for a certain target, and then later in the code, an identical anonymous function is given in an "on" call, the second function will also be added to the list of event listeners for that target.

TypeScript hint: in case of creating derived tool with own events, EventMap should be extended and .on() and .notify() methods redeclared, see sample.

Example

// Using in derived tool
import type {EventMap as EventMapBase} from '@int/geotoolkit/controls/tools/AbstractTool';
export type EventMap = EventMapBase &amp; {
[MyToolEvents.onValueChanged]: MyToolEventArgs
}
export enum MyToolEvents {
onValueChanged = 'onValueChanged'
}
export class MyTool extends AbstractTool {
public declare on: <E extends keyof EventMap>(type: E, callback: (eventType: E, sender: this, args: EventMap[E]) => void) => this;
protected declare notify: <E extends keyof EventMap>(type: E, source: AbstractTool, args?: EventMap[E]) => this;
public declare off: <E extends keyof EventMap>(type: E, callback?: (eventType: E, sender: this, args: EventMap[E]) => void) => this;
// ...
}

Type parameters

NameType
Eextends string

Parameters

Name Type Description
typeEtype of event or property
callback(eventType: E, sender: CrossHair, args: EventMap[E]) => voidto be called

Returns

CrossHair

Overrides

AbstractTool.on


onActiveStateChanged

Protected onActiveStateChanged(): void

Fires

Events.onStateChanged

Returns

void

Inherited from

AbstractTool.onActiveStateChanged


onEnabledStateChanged

Protected onEnabledStateChanged(): void

Fires

Events.onEnabledStateChanged

Returns

void

Inherited from

AbstractTool.onEnabledStateChanged


pageToCanvas

pageToCanvas(eventArgs, externalPlot?): Object

return position relative to the canvas

Parameters

Name Type Description
eventArgsEvent | EventArgsparentElement the parent HTML element
Optional externalPlotPlotplot

Returns

Object

NameType
xnumber
ynumber

Inherited from

AbstractTool.pageToCanvas


pointToModel

pointToModel(model, eventArgs): Point

converts device coordinates to inner coordinates of node

Parameters

Name Type Description
modelCompositeNode<Node>the model
eventArgsPoint | EventArgsarguments of the event OR point in device (plot) coordinates.

Returns

Point

Overrides

AbstractTool.pointToModel


removeListener

removeListener(eventName, listener?): CrossHair

remove event listener. The listener reveives the message when the system event happens.

Deprecated

since 4.0 use .off() instead.

Parameters

Name Type Description
eventNamestringevent name
Optional listenerFunction | Function[]the event listener, if null, remove all listeners for the event

Returns

CrossHair

Inherited from

AbstractTool.removeListener


setActive

setActive(active): CrossHair

set active state

Fires

Events.onStateChanged

Parameters

Name Type Description
activebooleanset active state

Returns

CrossHair

Inherited from

AbstractTool.setActive


setEnabled

setEnabled(enabled): CrossHair

set enable state

Fires

Events.onEnabledStateChanged

Fires

Events.onStateChanged

Parameters

Name Type Description
enabledbooleansets the enabled state

Returns

CrossHair

this

Inherited from

AbstractTool.setEnabled


setFillStyle

setFillStyle(fillStyle, merge?): CrossHair

Sets fill style, used if radius is not null

Parameters

Name Type Description
fillStyleTypeline style or options
Optional mergebooleantrue if you want to merge lineStyle with existing attribute, false by default

Returns

CrossHair

this


setHorizontalLineStyle

setHorizontalLineStyle(lineStyle, merge?): CrossHair

Sets vertical line style

Parameters

Name Type Description
lineStyleTypeline style or options
Optional mergebooleantrue if you want to merge lineStyle with existing attribute, false by default

Returns

CrossHair

this


setLabelSettings

setLabelSettings(orientation, settings?): CrossHair

Set Settings for one label

Parameters

Name Type Description
orientationAnnotationLocationlabel orientation
Optional settingsLabelSettingsJSON to configure label

Returns

CrossHair

this


setLabelsTextConverter

setLabelsTextConverter(position, textConverter): CrossHair

sets LabelsTextConverter

Parameters

Name Type Description
positionAnnotationLocationposition of the label to be changed
textConverterTextConverterfunction that takes x and y to convert to text for the label

Returns

CrossHair

this


setLineStyle

setLineStyle(lineStyle, merge?): CrossHair

Sets line style

Parameters

Name Type Description
lineStyleTypeline style or options
Optional mergebooleantrue if you want to merge lineStyle with existing attribute, false by default

Returns

CrossHair

this


setMouseRadius

setMouseRadius(radius): CrossHair

Sets device radius for mouse events

Parameters

Name Type Description
radiusnumberradius for mouse events

Returns

CrossHair

this

Inherited from

AbstractTool.setMouseRadius


setName

setName(name): CrossHair

set tool name

Parameters

Name Type Description
namestringthe tool name

Returns

CrossHair

Inherited from

AbstractTool.setName


setOutLineStyle

setOutLineStyle(lineStyle, merge?): CrossHair

Sets line style

Parameters

Name Type Description
lineStyleTypeline style or options
Optional mergebooleantrue if you want to merge lineStyle with existing attribute, false by default

Returns

CrossHair

this


setPosition

setPosition(position, silent?, eventArgs?): CrossHair

Sets the current position in model coordinates of the manipulator layer

Parameters

Name Type Description
positionPointcurrent mouse position
Optional silentbooleannotification enabled or not
Optional eventArgsEventArgsevent args which will be passed to event onPositionChanged

Returns

CrossHair

this


setProperties

setProperties(properties?): CrossHair

Sets all the properties pertaining to this object

Parameters

Name Type Description
Optional propertiesOptionsAn object containing the properties to set

Returns

CrossHair

this

Overrides

AbstractTool.setProperties


setProperty

setProperty(name, value): CrossHair

Sets dynamic property by name

Parameters

Name Type Description
namestringproperty name
valueanyproperty value

Returns

CrossHair

this

Inherited from

AbstractTool.setProperty


setRadius

setRadius(radius): CrossHair

set radius of the cursor center target

Parameters

Name Type Description
radiusnumbercenter radius

Returns

CrossHair


setSelectTargetCallback

setSelectTargetCallback(callback): CrossHair

Sets callback for selecting target Node from scene

Parameters

Name Type Description
callbackSelectTargetCallbackfunction that takes current mouse position and returns target for crosshair

Returns

CrossHair

this


setSilent

setSilent(bool): CrossHair

Set silent mode

Parameters

Name Type Description
boolbooleanflag to enable silent mode

Returns

CrossHair

this

Inherited from

AbstractTool.setSilent


setSlotEnabled

setSlotEnabled(eventName, value, target?): CrossHair

Sets slot enabled

Parameters

Name Type Description
eventNamestringeventName
valuebooleanvalue
Optional targetEventTargettarget

Returns

CrossHair

Inherited from

AbstractTool.setSlotEnabled


setSlots

setSlots(slots?, merge?): CrossHair

Sets new slots.

Example

const slots = {
'pointerdown': (event: EventArgs) => {
// event is an instance of @int/geotoolkit/controls/tools/EventArgs
...
}
};
tool.setSlots(slots);

Parameters

Name Type Description
Optional slotsRecord<string, Slot | Slot[] | (eventArgs: EventArgs) => void>type of system events
Optional mergebooleanset to true if you want to merge with existing slots

Returns

CrossHair

this

Inherited from

AbstractTool.setSlots


setSymbol

setSymbol(symbol): CrossHair

set cross-hair symbol

Parameters

Name Type Description
symbolSymbolShapecross-hair symbol

Returns

CrossHair

this


setTextStyle

setTextStyle(textStyle, merge?): CrossHair

Sets the text style of labels

Parameters

Name Type Description
textStyleTypefor the crosshair labels on screen
Optional mergebooleantrue if you want to merge textStyle with existing attribute, false by default

Returns

CrossHair

this


setTouchRadius

setTouchRadius(radius): CrossHair

Sets device radius for touch events

Parameters

Name Type Description
radiusnumberradius for touch events

Returns

CrossHair

this

Inherited from

AbstractTool.setTouchRadius


setVerticalLineStyle

setVerticalLineStyle(lineStyle, merge?): CrossHair

Sets vertical line style

Parameters

Name Type Description
lineStyleTypeline style or options
Optional mergebooleantrue if you want to merge lineStyle with existing attribute, false by default

Returns

CrossHair

this


setVisible

setVisible(visible): CrossHair

Sets visible

Parameters

Name Type Description
visiblebooleanvisible attribute set or not

Returns

CrossHair

this


start

Protected start(eventArgs?): CrossHair

start

Parameters

Name Type Description
Optional eventArgsEventArgsevent args

Returns

CrossHair

Inherited from

AbstractTool.start


stop

Protected stop(): CrossHair

stop

Returns

CrossHair

Inherited from

AbstractTool.stop


toggle

toggle(): CrossHair

switch enable state to opposite state

Returns

CrossHair

Inherited from

AbstractTool.toggle


updateCursorPosition

updateCursorPosition(silent?): CrossHair

Update position of cursor for the last mouse position. This code can be used if content is scrolled to display the position of the cursor in the last mouse position

Parameters

Name Type Description
Optional silentbooleannotification enabled or not

Returns

CrossHair

this


canvasToClient

Static canvasToClient(plotPoint, plot): Point

Convert plot coordinates to global coordinates

Parameters

Name Type Description
plotPointPointpoint in plot coordinates
plotPlotplot with canvas

Returns

Point

Inherited from

AbstractTool.canvasToClient


clientToCanvas

Static clientToCanvas(nativeEvent, plot): Point

Convert global coordinates to plot coordinates

Parameters

Name Type Description
nativeEventEventnative browser event
plotPlotplot with canvas

Returns

Point

Inherited from

AbstractTool.clientToCanvas


getClassName

Static getClassName(): string

Returns

string

Inherited from

AbstractTool.getClassName


getExclusiveTool

Static getExclusiveTool(plot): AbstractTool

return exclusive tool associated with plot

Parameters

Name Type Description
plotPlotplot

Returns

AbstractTool

tool

Inherited from

AbstractTool.getExclusiveTool


getNativeEventName

Static getNativeEventName(eventName): string[]

Returns native event name

Parameters

Name Type Description
eventNamestringW3C Pointer Events Recommendation name

Returns

string[]

Inherited from

AbstractTool.getNativeEventName


isTouchEvent

Static isTouchEvent(eventArgs): eventArgs is TouchEvent

return true if the event is a touch event and false otherwise.

Parameters

Name Type Description
eventArgsEvent | EventArgscontains info of the event

Returns

eventArgs is TouchEvent

Inherited from

AbstractTool.isTouchEvent


lock

Static lock(plot, tool): void

Set exclusive tool for plot

Parameters

Name Type Description
plotPlotplot
toolAbstractTooltool

Returns

void

Inherited from

AbstractTool.lock


setDefaultMouseRadius

Static setDefaultMouseRadius(radius): void

Sets default device radius for mouse events

Parameters

Name Type Description
radiusnumberradius for mouse events

Returns

void

Inherited from

AbstractTool.setDefaultMouseRadius


setDefaultTouchRadius

Static setDefaultTouchRadius(radius): void

Sets default device radius for touch events

Parameters

Name Type Description
radiusnumberradius for touch events

Returns

void

Inherited from

AbstractTool.setDefaultTouchRadius


unlock

Static unlock(value): void

Remove exclusive tool from plot

Parameters

Name Type Description
valueAbstractTool | Plotvalue

Returns

void

Inherited from

AbstractTool.unlock