Repository navigation
LineIndicator JSON
This page describes the persisted format of the line indicator in a project, in a Mixel and in templates. For the user instructions on a hand-written .vttp, see the page Line JSON.
The indicator is saved in two modes:
-
toJSON(false)— the real Mixel state: property values, and the layer size and position. -
toJSON(true)— the template state:maketinstead ofsizeandpositionInParent. The indicator 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.line",
"data": {
"properties": {}
}
}Stable parts:
| Part | Value |
|---|---|
| plugin uid | com.velitask.plagin.official |
| indicator name | line |
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.line",
"data": {
"size": { "...": "layer size state" },
"positionInParent": { "...": "layer position state" },
"properties": {
"line": {
"lineColor": {"r":255,"g":255,"b":255,"a":255},
"thickness": {"value":1},
"style": {"value":0},
"dashPattern": {"value":""}
},
"direction": {"value":0}
}
}
}{
"name": "com.velitask.plagin.official.line",
"data": {
"maket": { "preset": "auto" },
"properties": {
"line": {
"lineColor": {"r":255,"g":255,"b":255,"a":255},
"thickness": {},
"style": {"value":0},
"dashPattern": {"value":""}
},
"direction": {"value":0}
}
}
}This is exactly how the runtime writes a numeric field into a template. An empty object {} means the default value 1; to set your own, use {"value": N}.
| JSON key | Java property | SDK type | User meaning | Default |
|---|---|---|---|---|
line |
mLine |
LineProperty |
The line: color, thickness, style, dash pattern. | See the nested fields. |
direction |
mDirection |
EnumArrayProperty<LineDirection> |
The line direction. |
0 (HORIZONTAL). |
Nested line fields (a composite property; the child properties are written by name):
| Field | SDK type | Meaning | Default |
|---|---|---|---|
lineColor |
ColorProperty |
The line color (flat r, g, b, a). |
White. |
thickness |
ThicknessProperty |
The thickness in base pixels. |
1. Range 0..50; at least 1 pixel when drawing. |
style |
EnumArrayProperty<LineStyle> |
The 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 |
The dash pattern: comma-separated numbers, each greater than zero. | An empty string (solid). |
Line style patterns: 1 — 12,6; 2 — 2,4; 3 — 12,6,2,6; 4 — 12,6,2,6,2,6; 5 — 20,8; 6 — 6,4. When a style is chosen in the panel, the pattern is filled in automatically; when the pattern is edited by hand, the style switches to 7 (custom). The indicator draws the dashes by dashPattern, not by style: when editing the JSON by hand, you have to keep these two fields consistent yourself. If the pattern is empty or contains a non-numeric or non-positive value, the line is solid.
direction: {"value":N}, indices in the order of LineDirection: 0 HORIZONTAL, 1 VERTICAL, 2 DIAGONAL_DOWN (from the top-left corner to the bottom-right), 3 DIAGONAL_UP (from the bottom-left to the top-right). An out-of-range index is read as 0.
Indicator skins: dashed (white, thickness 2, the "Dash" style) and bold (white, thickness 8, solid).
A dashed diagonal ↗:
{
"name": "com.velitask.plagin.official.line",
"data": {
"maket": { "preset": "auto" },
"properties": {
"line": {
"lineColor": {"r":255,"g":255,"b":255,"a":255},
"thickness": {"value":2},
"style": {"value":1},
"dashPattern": {"value":"12,6"}
},
"direction": {"value":3}
}
}
}-
VelitaskPlagin.getUID()(com.velitask.plagin.official) must not be changed without a migration of saved projects. -
Indicator.getName()(line) must not be changed without a migration. - The property names (
line,direction) and the nestedlinefields (lineColor,thickness,style,dashPattern) must not be renamed without a migration. - The order of the
LineDirectionandLineStyleconstants determines the saved indices: the constants must not be reordered. - The property order mostly affects the UI, while persisted state is loaded by name; renaming is more dangerous than reordering.