Repository navigation
LapTextIndicator JSON
This page describes the persisted format of the lapText indicator in a project, a Mixel and templates. For the user guide on editing .vttp by hand, see Lap Text JSON.
-
toJSON(false)is the real Mixel state: it contains the selected source and sensor, the current property values, and the layer size and position. The sensor property (Lap) is saved in a template as an empty object{}: the source and sensor are picked when the indicator is added to a project. -
toJSON(true)is the template state: it contains the values that can be carried between projects.
The layer identifier is built from the plugin uid and the indicator name:
{
"name": "com.velitask.plagin.official.lapText",
"data": {
"properties": {}
}
}| Part | Value |
|---|---|
| plugin uid | com.velitask.plagin.official |
| indicator name | lapText |
In a real Mixel, the layer size and position are stored next to properties. The exact shape of these State fields depends on the current runtime, so they are shown in abbreviated form. The values sourceId.value and sensorId.value are the numeric identifiers of the project's source and sensor, given below as an example.
{
"name": "com.velitask.plagin.official.lapText",
"data": {
"size": { "...": "layer size state" },
"positionInParent": { "...": "layer position state" },
"properties": {
"Lap": {
"sourceId": {"value": 1},
"sensorId": {"value": 3}
},
"font": {"name":"Dialog","style":0,"size":48,"color":{"r":255,"g":255,"b":255,"a":255}},
"textAlign": {"value":4},
"textTemplate": {"template":"{lap}","vars":{"lap":"%d","total":"%d","left":"%d"}}
}
}
}A template stores maket (here auto) instead of size and position, and the sensor property is empty. The property values match the default values in the code.
{
"name": "com.velitask.plagin.official.lapText",
"data": {
"maket": { "preset": "auto" },
"properties": {
"Lap": {},
"font": {"name":"Dialog","style":0,"size":48,"color":{"r":255,"g":255,"b":255,"a":255}},
"textAlign": {"value":4},
"textTemplate": {"template":"{lap}","vars":{"lap":"%d","total":"%d","left":"%d"}}
}
}
}| JSON key | Java property | SDK type | User meaning | Default |
|---|---|---|---|---|
Lap |
mLap |
LapAtomProperty |
The selected lap sensor. | An empty object in a template; sourceId/sensorId in a project. |
font |
mText |
FontColorProperty |
Text font and color. |
name = Dialog, style = 0, size = 48, white color 255,255,255,255. |
textAlign |
mTextAlign |
TextAlignProperty |
Text position inside the layer. |
4 (CENTER). |
textTemplate |
mTemplate |
TextTemplateProperty |
A string template with variables. |
{lap}. |
Formats of the nested values:
-
fontis a flat object:name(string),style(number:0plain,1bold,2italic),size(integer,1..999) andcolor(r,g,b,a, each0..255). -
textAlignis{"value": N},Nfrom0to8(orderTOP_LEFT,TOP_CENTER,TOP_RIGHT,CENTER_LEFT,CENTER,CENTER_RIGHT,BOTTOM_LEFT,BOTTOM_CENTER,BOTTOM_RIGHT). An out-of-range value is treated asCENTER_LEFT. -
textTemplateis{"template": string, "vars": {name: format}}; thevarskeys are variable names without braces.
Template variables (in the order of the makeText(...) arguments):
| Variable | Default format | Meaning |
|---|---|---|
{lap} |
%d |
The current lap index atom.lapIndex (as recorded in the sensor). |
{total} |
%d |
Total laps: the index of the last lap plus one. |
{left} |
%d |
How many laps are left: the index of the last lap minus the index of the current one, not less than zero. |
A "Lap N of M" template:
{
"name": "com.velitask.plagin.official.lapText",
"data": {
"maket": { "preset": "auto" },
"properties": {
"Lap": {},
"font": {"name":"Dialog","style":0,"size":48,"color":{"r":255,"g":255,"b":255,"a":255}},
"textAlign": {"value":4},
"textTemplate": {"template":"Lap {lap} of {total}","vars":{"lap":"%d","total":"%d","left":"%d"}}
}
}
}-
VelitaskPlagin.getUID()(com.velitask.plagin.official) must not be changed without a migration of saved projects. -
Indicator.getName()(lapText) must not be changed without a migration. - Property names (
Lap,font,textAlign,textTemplate) must not be renamed without a migration: loading goes by name. - Template variable names (
lap,total,left) are part of thevarsformat; renaming them breaks saved formats. - The order of properties mostly affects the UI; renaming is more dangerous than reordering.