Skip to main content
Version: 4.55

goniometer

The GoniometerLayer displays a Goniometer (Protractor) to measure angles in degrees with.

note

iOS only at the moment.

Field Configurations

KeyTypeDescriptionDefault Value
"centerDotColor"ColorThe color of the dot in the center"#5f3cb6"
"dotSize"NumberThe size of the dot5
"font"Stringundefinednull
"fontColor"Colorundefined"#5dbcd2"
"fontSize"UnitSizeFont size to use.14
"lineSize"Numberundefined1
"referenceLineColor"Colorundefined"#5f3cb6"
"rotation"GoniometerRotationThe type of the rotationnull
"staticLineColor"Colorundefined"#5dbcd2"
"textAlign"Stringundefinednull

Inherited

From Base Layer

Base Layer

Field Configurations

KeyTypeDescriptionDefault Value
"_value"Value[PREVIEW] Dynamic value of the layer.null
"actions"ActionListList of actions, which will be executed when the layer is tapped.null
"borderColor"ColorThe color of the border in hex color value.null
"borderRadius"UnitSizeThe radius applies to all corners; with a borderWidth of 0 the border is not drawn and radius is set anyway.0
"borderWidth"UnitSizeThe width of the border.0
"bottomLeftRadius"UnitSizeRadius for the bottom left corner.0
"bottomRightRadius"UnitSizeRadius for the bottom right corner.0
"classes"ArrayList of classes for layer styles.null
"conditions"ConditionsList of conditions to alter the layer state.null
"constraints"ConstraintsA list of constraints defining the position of the layer in a layout.null
"consumesKeyboard"BooleanThis layer will be used to shrink, if a keyboard is shown.null
"dataKey"StringName for assigning data to this layer.null
"hidden"BooleanIndicates whether the layer is hidden. Default: false.false
"layerRotation"NumberThe layer is rotated by the specified degree.0
"name"StringUnique name in the layout. Used for alignment or actions.null
"opacity"NumberThe opacity of the layer.1
"overInsetBottom"BooleanDetermines if this layer ignores the save space at the bottom of the device.false
"overInsetTop"BooleanDetermines if this layer ignores the save space at the top of the device.false
"safeArea"SafeAreaTypeObjectDetermines the safe area behaviour.null
"shadowElevation"NumberThe elevation of this layer for casting shadows.0
"state"StringThe state the layer will use as default."default"
"states"LayerStatesA list of named states that affect the appearance of the layer.null
"topLeftRadius"UnitSizeRadius for the top left corner.0
"topRightRadius"UnitSizeRadius for the top right corner.0
"touchFeedback"TouchFeedbackDetermines if the layer should show a touch feedback if touched."visible"
"trackingKey"StringDefines a key for a scroll event.null
"type"LayerTypeThe type of the layernull
"value"Value(Initial) value of the layer.null

Examples

Example 1: Add a simple goniometer

Goal: Add a goniometer in the center of the screen and toggled on and off.

To start, add a container layer to the layout and insert the goniometer.

{
"name": "container",
"type": "container",
"classes": [
"fullSize"
],
"children": [
{
"name": "goniometer",
"dataKey": "goniometer",
"type": "goniometer",
"rotation": "portrait",
"lineSize": 4,
"dotSize": 10,
"staticLineColor": "#77b400",
"referenceLineColor": "#F07D00",
"centerDotColor": "#3CA937",
"fontSize": "30dp",
"textAlign": "alignCenter",
"classes": [
"textWhite"
],
"constraints": [
{
"type": "pos",
"x": "0",
"y": "0"
},
{
"type": "size",
"width": "100%"
},
{
"type": "aspectRatio",
"ratio": "1.0"
}
]
}
]
}

A goniometer was added to the layout with a portrait rotation. The client_template will be created in the next step.

Result:

Screenshot of the app showing the results of the sample code from Example 1.
A goniometer has been created.

Add the buttons and corresponding actions under the goniometer layer.

{
"name": "buttonContainer",
"dataKey": "buttonContainer",
"type": "container",
"constraints": [
{
"type": "pos",
"anchor": "sw",
"relativeAnchor": "sw",
"x": "0dp",
"y": "0dp"
},
{
"type": "size",
"width": "100%",
"height": "150dp"
}
],
"children": [
{
"name": "reset",
"dataKey": "reset",
"type": "image",
"value": "internal://remove",
"tint": "34a7c9",
"scaleType": "scaleAspectFit",
"constraints": [
{
"type": "pos",
"anchor": "sw",
"relativeAnchor": "sw",
"x": "5%",
"y": "-5%"
},
{
"type": "size",
"width": "25%",
"height": "150dp"
}
],
"actions": [
{
"type": "layerAction",
"params": {
"layerName": "goniometer",
"actions": [
{
"type": "reset"
}
]
}
}
]
},
{
"name": "calibrate",
"dataKey": "calibrate",
"type": "image",
"value": "internal://check",
"tint": "34a7c9",
"scaleType": "scaleAspectFit",
"constraints": [
{
"type": "pos",
"anchor": "se",
"relativeAnchor": "se",
"x": "-5%",
"y": "-5%"
},
{
"type": "size",
"width": "25%",
"height": "150dp"
}
],
"actions": [
{
"type": "layerAction",
"params": {
"layerName": "goniometer",
"actions": [
{
"type": "toggleGoniometer"
}
]
}
}
]
}
]
}

The buttons with toggleGoniometer and reset actions are created.

Result:

Screencapture of the app showing the results of the sample code from Example 1.
A goniometer layer with actions has been created.