Repository navigation
RectangleIndicator JSON
This page describes the persisted format of the rectangle indicator in a project, in Mixel, and in templates. For the user guide to manual .vttp editing, see the page Rectangle JSON.
The indicator is saved in two modes:
-
toJSON(false)is the real Mixel state: property values, layer size, and position. -
toJSON(true)is the template state:maketinstead ofsizeandpositionInParent. The indicator's properties are not tied to sources, sopropertieshas the same shape in both modes.
The layer identifier is built from the plugin uid and the indicator name:
{
"name": "com.velitask.plagin.official.rectangle",
"data": {
"properties": {}
}
}Stable parts:
| Part | Value |
|---|---|
| plugin uid | com.velitask.plagin.official |
| indicator name | rectangle |
In a real Mixel, the layer size and position are stored next to properties. The exact shape of the State fields depends on the current runtime, so an abbreviated structure is shown for them.
{
"name": "com.velitask.plagin.official.rectangle",
"data": {
"size": { "...": "layer size state" },
"positionInParent": { "...": "layer position state" },
"properties": {
"fillColor": {"r":0,"g":0,"b":0,"a":128},
"fillTransparency": {"value":128},
"border": {
"lineColor": {"r":255,"g":255,"b":255,"a":255},
"thickness": {"value":1},
"style": {"value":0},
"dashPattern": {"value":""},
"cornerRadius": {"value":0}
}
}
}
}{
"name": "com.velitask.plagin.official.rectangle",
"data": {
"maket": { "preset": "auto" },
"properties": {
"fillColor": {"r":0,"g":0,"b":0,"a":128},
"fillTransparency": {},
"border": {
"lineColor": {"r":255,"g":255,"b":255,"a":255},
"thickness": {},
"style": {"value":0},
"dashPattern": {"value":""},
"cornerRadius": {}
}
}
}
}A numeric field that the user has not changed is written as an empty object {} (for example, "thickness": {}); when read, it means the default value. This is exactly how the runtime writes numeric fields into a template. An empty object {} means the default value (fillTransparency 128, thickness 1, cornerRadius 0); to set your own, use {"value": N}.
| JSON key | Java property | SDK type | Meaning for the user | Default |
|---|---|---|---|---|
fillColor |
mFillColor |
ColorProperty |
Fill color. Only the r, g, b channels are used. |
(0, 0, 0, 128). |
fillTransparency |
mFillTransparency |
IntegerProperty |
Alpha channel of the fill: 0 is transparent, 255 is opaque. Not part of the skins. |
128. Range 0..255. |
border |
mBorder |
BorderProperty |
Border. | See the nested fields. |
Nested border fields (a composite property, the child properties are written by name):
| Field | SDK type | Meaning | Default |
|---|---|---|---|
lineColor |
ColorProperty |
Border color (flat r, g, b, a). |
White. |
thickness |
ThicknessProperty |
Border thickness in base pixels. |
1. Range 0..50. |
style |
EnumArrayProperty<LineStyle> |
Line style: 0 solid, 1 dash, 2 dot, 3 dash-dot, 4 dash-dot-dot, 5 long dash, 6 short dash, 7 custom. |
0. |
dashPattern |
StringProperty |
Dash pattern: numbers separated by commas. | Empty string. |
cornerRadius |
CornerRadiusProperty |
Corner radius. |
0. Range 0..500. |
The ranges limit input in the panel; the value is not validated when read from JSON. The style and dashPattern fields are saved, but the indicator's border is always drawn as a solid line.
Indicator skins: outline (border.lineColor white, thickness 3, cornerRadius 0, fillColor (0,0,0,0)) and rounded (white border, thickness 0, cornerRadius 20, fillColor (0,0,0,160)). Since the fill alpha comes from fillTransparency and not from fillColor, a skin changing the alpha channel of fillColor does not affect the picture.
A rounded dark plate without a border:
{
"name": "com.velitask.plagin.official.rectangle",
"data": {
"maket": { "preset": "auto" },
"properties": {
"fillColor": {"r":0,"g":0,"b":0,"a":255},
"fillTransparency": {"value":160},
"border": {
"lineColor": {"r":255,"g":255,"b":255,"a":255},
"thickness": {"value":0},
"style": {"value":0},
"dashPattern": {"value":""},
"cornerRadius": {"value":20}
}
}
}
}-
VelitaskPlagin.getUID()(com.velitask.plagin.official) must not be changed without migrating saved projects. -
Indicator.getName()(rectangle) must not be changed without migration. - Property names (
fillColor,fillTransparency,border) and nestedborderfield names (lineColor,thickness,style,dashPattern,cornerRadius) must not be renamed without migration. - The order of the
LineStyleconstants determines the savedstyleindex. - The order of properties mostly affects the UI, while loading the persisted state goes by names; renaming is more dangerous than reordering.