AnnotationFreeHand
- Last UpdatedFeb 19, 2025
- 3 minute read
The AnnotationFreeHand node defines a line-based shape that inherits from AnnotationBase and can be moved and stretched. You can draw the shape using mouse drag or touch.

Platform support
This element is fully supported on XR-Windows, XR-Portable Windows, XR-Portable iOS, XR-Portable Android, and XR-P WASM platforms.
|
XR-WIN |
XR-P-WIN |
XR-P-IOS |
XR-P-AND |
XR-P-WASM |
|---|---|---|---|---|
|
Full support |
Full support |
Full support |
Full support |
Full support |
|
|
|
|
|
|
Drawing lines
AnnotationFreeHand uses a list of line segments to define the shape. This is performed through mouse drag or touch drag. Collected points will be converted to UVs and added to lines field, which is an mdstring.
For each line, the required data is as follows:
-
A name that should be unique to help identify the line.
-
A set of 2D points in the UV space (0 0) to (1 1). The curve will pass through all these points. Please observe UV space has (0 0) at left top corner.
Example
This is an example of AnnotationFreeHand with two lines. 1st one is horizontal line and 2nd one is vertical line.
{line0={points=0.1 0.1,0.1 0.9}}{line1={points=0.1 0.1,0.9 0.1}}

Handles position and behavior
The AnnotationFreeHand has four handles, positioned at the four corners. Each handle can grow or shrink the shape in the corner direction.

Default behavior
User creates this node/canvas at thedesired position and size. User draws shape with mouse or touch drag. When the drawing is complete, the system will fit bounds by calculating the new position and size, based on the drawing and selects the shape. Then user can resize, move with handles.
This behavior can be customized by using the below described fields (automaticEditDisable, automaticBoundsFit, editEnabled).
Fields
AnnotationFreeHand has only a few type-specific fields.
Field inheritance: NodeBase > RectBase2D > AnnotationBase > AnnotationFreeHand
|
Fields |
Type |
Use |
Default value |
Description |
|---|---|---|---|---|
|
automaticBoundsFit |
sbool |
Optional |
true |
If set to true and when editEnabled is switched off, size and position are recalculated according to drawn shape by considering margins. |
|
automaticEditDisable |
sbool |
Optional |
True |
If set to true, editEnabled will be immediately set to false and selected set to true when doing mouse/touch up. If it is set to false, edit will not be disabled and user can draw multiple lines. |
|
editEnabled |
sbool |
Optional |
true |
Enables or disables ability to draw shape. |
|
expandTo |
sfunction |
Optional |
True |
SSTRING expandTo.execute(POSITION,SIZE) Sets position and size to value passed and recalculates uv to keep lines aspect and position. For example, expandTo.execute(100 100,200 200) returns OK. |
|
fitBounds |
sfunction |
Optional |
true |
SSTRING fitBounds.execute() Calculates and fits bounds to the drawn shape. No inputs required. For example, fitBounds.execute() returns OK. |
|
lines |
mdstring |
Optional |
UVs of lines representing drawing. For example: {line0={points=0.1 0.1,0.1 0.9}}{line1={points=0.1 0.1,0.9 0.1}} |