AccuDraw Class

Accudraw is an aide for entering coordinate data. This class is public to allow applications to provide a user interface for AccuDraw, either by implementing their own, or using the one supplied by the itwin appui package.

@note When writing an InteractiveTool it is not correct to call methods on AccuDraw directly, tools should instead provide hints to AccuDraw using AccuDrawHintBuilder.

Extended by

Methods

Name Description
constructor(): AccuDraw    
defaultFocusItem(): ItemField Get default focus item for the current compass mode  
disableForSession(): void Disable AccuDraw so that it can not be used by interactive tools.  
enableForSession(): void Enable AccuDraw so that it can be used by interactive tools.  
getAngleFormatter(): undefined | FormatterSpec Allow the AccuDraw user interface to supply the angle/direction formatter  
getAngleParser(): undefined | ParserSpec Allow the AccuDraw user interface to supply the angle/direction parser  
getFieldLock(index: ItemField): boolean Get the current lock state for the supplied input field  
getFormattedValueByIndex(index: ItemField): string Can be called by sub-classes to get a formatted value to display for an AccuDraw input field  
getLengthFormatter(): undefined | FormatterSpec Allow the AccuDraw user interface to supply the distance parser  
getLengthParser(): undefined | ParserSpec Allow the AccuDraw user interface to supply the distance parser  
getValueByIndex(index: ItemField): number Get the current value for the supplied input field  
grabInputFocus(): void Called to request input focus be set to AccuDraw.  
is3dCompass(viewport: Viewport): boolean Whether to show Z input field in 3d.  
isDynamicKeyinStatus(index: ItemField): boolean Get the current keyin status for the supplied input field  
itemFieldInputIsValid(key: string, item: ItemField): boolean Protected Call from an AccuDraw UI event to check if key is valid for updating the input field value.  
onCompassDisplayChange(_state: "show" | "hide"): void Called after compass state is changed between the active state and one of the disabled states  
onCompassModeChange(): void Called after compass mode is changed between polar and rectangular  
onFieldKeyinStatusChange(_index: ItemField): void Called after input field keyin status changes  
onFieldLockChange(_index: ItemField): void Called after input field locked state is changed  
onFieldValueChange(_index: ItemField): void Called after input field value changes  
onMotion(_ev: BeButtonEvent): void Implemented by sub-classes to update ui fields to show current deltas or coordinates when inactive.  
onRotationModeChange(): void Called after compass rotation is changed  
processFieldInput(index: ItemField, input: string, synchText: boolean): Promise<void> Call from an AccuDraw UI event to sync the supplied input field value  
processMotion(): void Can be called by sub-classes as the default implementation of onMotion.  
sendDataPoint(pt: Point3d, viewport: ScreenViewport): Promise<void> Emulate a mouse click at the specified location in the supplied view by sending button down/up events.  
setCompassMode(mode: CompassMode): void Change current compass input mode to either polar or rectangular  
setFieldLock(index: ItemField, locked: boolean): void Change the lock status for the supplied input field  
setFocusItem(_index: ItemField): void Called to request focus change to the specified input field  
setRotationMode(mode: RotationMode): void Change current compass orientation  
setValueByIndex(index: ItemField, value: number): void Set the current value for the supplied input field  

Properties

Name Type Description
alwaysShowCompass boolean When true the compass is always active and on screen instead of following the current tools request to activate  
angleRoundOff Accessor ReadOnly RoundOff Get angle round off settings  
autoFocusFields boolean When true locking the angle also moves focus to the angle input field  
autoPointPlacement boolean When true fully specifying a point by entering both distance and angle in polar mode or XY[Z] in rectangular mode, the point is automatically accepted  
axisIndexing boolean When true the current point is adjusted to the x and y axes when within a close tolerance  
bearingFixedToPlane2d Accessor boolean Allow the AccuDraw user interface to specify bearing directions are always in xy plane  
bearingFixedToPlane2d Setter bearingFixedToPlane2d(enable: boolean): void    
compassMode CompassMode The current compass mode  
contextSensitive boolean When true all tool hints are applied as opposed to only selected hints  
currentState Accessor CurrentState Current AccuDraw state  
currentState Setter currentState(state: CurrentState): void    
distanceIndexing boolean When true the current point is adjusted to the last locked distance value when within a close tolerance  
distanceRoundOff Accessor ReadOnly RoundOff Get distance round off settings  
dontMoveFocus boolean Disable automatic focus change when user is entering input.  
floatingOrigin boolean When true the compass follows the origin hint as opposed to remaining at a fixed location  
hasInputFocus Accessor ReadOnly boolean Get whether AccuDraw currently has input focus  
isActive Accessor ReadOnly boolean When true the compass is displayed and adjusting input points for the current interactive tool  
isBearingMode Accessor ReadOnly boolean Allow the AccuDraw user interface to specify bearing  
isDeactivated Accessor ReadOnly boolean When true the compass is not displayed or adjusting points, the current interactive tool has disabled automatic activation, but can still be enabled via shortcuts  
isEnabled Accessor ReadOnly boolean When true AccuDraw is enabled by the application and can be used by interactive tools  
isInactive Accessor ReadOnly boolean When true the compass is not displayed or adjusting points, but it can be automatically activated by the current interactive tool or via shortcuts  
newFocus ItemField Set input field to move focus to (X_Item or Y_Item) for automatic focus change.  
rotationMode RotationMode The current compass rotation  
smartKeyin boolean When true improve behavior for +/- input when cursor switches side and try to automatically manage focus  
stickyZLock boolean When true the z input field will remain locked with it's current value after a data button  

Defined in

Last Updated: 10 June, 2025