Skip to content

CompassIndicator JSON

roosit edited this page Oct 16, 2026 · 1 revision

CompassIndicator JSON

Up | Code | Русский

Purpose

This page describes the persisted format of the compass indicator in a project, in Mixel, and in templates. For the user guide on writing .vttp files by hand, see Compass JSON.

Two save modes

The indicator is saved in two modes:

  • toJSON(false) - the real Mixel state: contains the selected source/sensor, the colors, and the size and position of the layer.
  • toJSON(true) - the template state: contains maket instead of size and positionInParent; for the sensor property Geo, the source/sensor are not fixed (an empty object).

Common indicator wrapper

The layer identifier is built from the plugin uid and the indicator name:

{
  "name": "com.velitask.plagin.official.compass",
  "data": {
    "properties": {}
  }
}

Stable parts:

Part Value
plugin uid com.velitask.plagin.official
indicator name compass

Real mixel state

In a real Mixel, the size and position of the layer 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.compass",
  "data": {
    "size": { "...": "layer size state" },
    "positionInParent": { "...": "layer position state" },
    "properties": {
      "Geo": {
        "sourceId": { "value": 2 },
        "sensorId": { "value": 4 }
      },
      "bodyColor": {"r":34,"g":51,"b":68,"a":255},
      "ringColor": {"r":255,"g":255,"b":255,"a":255},
      "needleNorthColor": {"r":204,"g":51,"b":51,"a":255},
      "needleSouthColor": {"r":221,"g":221,"b":221,"a":255}
    }
  }
}

Template state

A template uses maket, and the sensor property stays empty so that the runtime picks a GPS sensor when the indicator is added to a project.

{
  "name": "com.velitask.plagin.official.compass",
  "data": {
    "maket": { "preset": "auto" },
    "properties": {
      "Geo": {},
      "bodyColor": {"r":34,"g":51,"b":68,"a":255},
      "ringColor": {"r":255,"g":255,"b":255,"a":255},
      "needleNorthColor": {"r":204,"g":51,"b":51,"a":255},
      "needleSouthColor": {"r":221,"g":221,"b":221,"a":255}
    }
  }
}

Properties

JSON key Java property SDK type User meaning Default
Geo mGeoSensor GeoSensorProperty The GPS sensor ("Geo") the bearing is calculated from. Empty selection in a template.
bodyColor mBodyColor ColorProperty Body color. 223344 (34,51,68).
ringColor mRingColor ColorProperty Color of the ring and tick marks. White.
needleNorthColor mNeedleNorthColor ColorProperty North part of the needle. CC3333 (204,51,51).
needleSouthColor mNeedleSouthColor ColorProperty South part of the needle. DDDDDD (221,221,221).

A color is saved as a flat object with r, g, b, a (each 0..255). The SVG property CompassSvg is not part of defineProperties() and is not written to JSON.

The indicator skins set all four colors at once: dark (1A1A1A, CCCCCC, FF4444, AAAAAA) and brass (8B6F3A, D4A75F, 6B2B1C, E8D9B0).

Examples

The "Brass" skin as a template state:

{
  "name": "com.velitask.plagin.official.compass",
  "data": {
    "maket": { "preset": "auto" },
    "properties": {
      "Geo": {},
      "bodyColor": {"r":139,"g":111,"b":58,"a":255},
      "ringColor": {"r":212,"g":167,"b":95,"a":255},
      "needleNorthColor": {"r":107,"g":43,"b":28,"a":255},
      "needleSouthColor": {"r":232,"g":217,"b":176,"a":255}
    }
  }
}

Compatibility

  • VelitaskPlagin.getUID() (com.velitask.plagin.official) must not be changed without migrating saved projects.
  • Indicator.getName() (compass) must not be changed without a migration.
  • Property names (Geo, bodyColor, ringColor, needleNorthColor, needleSouthColor) must not be renamed without a migration.
  • The property order mostly affects the UI, while persisted state is loaded by name; renaming is more dangerous than reordering.

Clone this wiki locally