diff options
author | Gali Nelle <galinelle.mapbox@gmail.com> | 2020-04-06 10:12:56 +0300 |
---|---|---|
committer | galinelle <paolo.angelelli@mapbox.com> | 2020-04-08 14:00:26 +0300 |
commit | 8e581c88ea855998a2746e57f1a5fc46ee62faee (patch) | |
tree | 9a158b1a4281a6c894025cc6758a0c9c59dfd5b0 /scripts | |
parent | 9a55c282fecfdd76b1acdf64cef0ce2ed99472ef (diff) | |
download | qtlocation-mapboxgl-8e581c88ea855998a2746e57f1a5fc46ee62faee.tar.gz |
Make location indicator bearing a paint property
This change introduces a new property type, Rotation, that uses
a custom interpolator, and that is currently applied to
all style properties named "bearing", with a period attribute.
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/generate-style-code.js | 7 | ||||
-rw-r--r-- | scripts/style-spec.js | 42 |
2 files changed, 35 insertions, 14 deletions
diff --git a/scripts/generate-style-code.js b/scripts/generate-style-code.js index 08fd1fba19..c9191d59e1 100755 --- a/scripts/generate-style-code.js +++ b/scripts/generate-style-code.js @@ -64,6 +64,13 @@ global.evaluatedType = function (property) { case 'boolean': return 'bool'; case 'number': + // TODO: Check if 'Rotation' should be used for other properties, + // such as icon-rotate + if (/bearing$/.test(property.name) && + property.period == 360 && + property.units =='degrees') { + return 'Rotation'; + } return /location$/.test(property.name) ? 'double' : 'float'; case 'resolvedImage': return 'expression::Image'; diff --git a/scripts/style-spec.js b/scripts/style-spec.js index c0acbebd91..15a4c7e0dc 100644 --- a/scripts/style-spec.js +++ b/scripts/style-spec.js @@ -47,20 +47,6 @@ referenceSpec["layout_location-indicator"] = { }, "doc": "The amount of the perspective compensation, between 0 and 1. A value of 1 produces a location indicator of constant width across the screen. A value of 0 makes it scale naturally according to the viewing projection." }, - "bearing": { - "type": "number", - "default": "0", - "default": 0, - "period": 360, - "units": "degrees", - "property-type": "data-constant", - "expression": { - "interpolated": false, - "parameters": [ ] - }, - "transition": false, - "doc": "The bearing of the location indicator." - }, "image-tilt-displacement": { "type": "number", "property-type": "data-constant", @@ -77,6 +63,20 @@ referenceSpec["layout_location-indicator"] = { }; referenceSpec["paint_location-indicator"] = { + "bearing": { + "type": "number", + "default": "0", + "default": 0, + "period": 360, + "units": "degrees", + "property-type": "data-constant", + "expression": { + "interpolated": false, + "parameters": [ ] + }, + "transition": false, + "doc": "The bearing of the location indicator." + }, "location": { "type": "array", "default": [ @@ -176,6 +176,20 @@ referenceSpec["paint_location-indicator"] = { }, "transition": true, "doc": "The color for drawing the accuracy radius border. To adjust transparency, set the alpha component of the color accordingly." + }, + "bearing": { + "type": "number", + "default": "0", + "default": 0, + "period": 360, + "units": "degrees", + "property-type": "data-constant", + "expression": { + "interpolated": false, + "parameters": [ ] + }, + "transition": false, + "doc": "The bearing of the location indicator." } }; |