Skip to content

Commit a234c9b

Browse files
authored
Add roll angle to stylesheet (#858)
* Add roll angle to stylesheet * add test for setting roll to undefined * add SDK support to roll * retry roll -> undefined * restore roll undefined test to the way it was * fix js version string and add wontfix for android and iOS * update roll angle android/ios version to reference newly created issue.
1 parent 63b660a commit a234c9b

File tree

7 files changed

+56
-0
lines changed

7 files changed

+56
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
### ✨ Features and improvements
44

5+
* Added `roll` property to stylesheet ([#850](https://github.com/maplibre/maplibre-style-spec/issues/850))
56
- _...Add new stuff here..._
67

78
### 🐞 Bug fixes

src/diff.test.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -302,6 +302,25 @@ describe('diff', () => {
302302
]);
303303
});
304304

305+
test('set roll to undefined', () => {
306+
expect(diffStyles({
307+
roll: 1
308+
} as StyleSpecification, {
309+
} as StyleSpecification)).toEqual([
310+
{command: 'setRoll', args: [undefined]}
311+
]);
312+
});
313+
314+
test('set roll', () => {
315+
expect(diffStyles({
316+
roll: 0
317+
} as StyleSpecification, {
318+
roll: 1
319+
} as StyleSpecification)).toEqual([
320+
{command: 'setRoll', args: [1]}
321+
]);
322+
});
323+
305324
test('no changes in light', () => {
306325
expect(diffStyles({
307326
light: {

src/diff.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ export type DiffOperationsMap = {
2222
'setZoom': [number];
2323
'setBearing': [number];
2424
'setPitch': [number];
25+
'setRoll': [number];
2526
'setSprite': [SpriteSpecification];
2627
'setGlyphs': [string];
2728
'setTransition': [TransitionSpecification];
@@ -287,6 +288,9 @@ function diffStyles(before: StyleSpecification, after: StyleSpecification): Diff
287288
if (!isEqual(before.pitch, after.pitch)) {
288289
commands.push({command: 'setPitch', args: [after.pitch]});
289290
}
291+
if (!isEqual(before.roll, after.roll)) {
292+
commands.push({command: 'setRoll', args: [after.roll]});
293+
}
290294
if (!isEqual(before.sprite, after.sprite)) {
291295
commands.push({command: 'setSprite', args: [after.sprite]});
292296
}

src/reference/v8.json

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,20 @@
5454
"doc": "Default pitch, in degrees. Zero is perpendicular to the surface, for a look straight down at the map, while a greater value like 60 looks ahead towards the horizon. The style pitch will be used only if the map has not been positioned by other means (e.g. map options or user interaction).",
5555
"example": 50
5656
},
57+
"roll": {
58+
"type": "number",
59+
"default": 0,
60+
"units": "degrees",
61+
"doc": "Default roll, in degrees. The roll angle is measured counterclockwise about the camera boresight. The style roll will be used only if the map has not been positioned by other means (e.g. map options or user interaction).",
62+
"example": 45,
63+
"sdk-support": {
64+
"basic functionality": {
65+
"js": "5.0.0",
66+
"android": "https://github.com/maplibre/maplibre-native/issues/2941",
67+
"ios": "https://github.com/maplibre/maplibre-native/issues/2941"
68+
}
69+
}
70+
},
5771
"light": {
5872
"type": "light",
5973
"doc": "The global light source.",
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"version": 8,
3+
"roll": "45",
4+
"sources": {},
5+
"layers": []
6+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
[
2+
{
3+
"message": "roll: number expected, string found",
4+
"line": 3
5+
}
6+
]
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
[
2+
{
3+
"message": "roll: number expected, string found",
4+
"line": 3
5+
}
6+
]

0 commit comments

Comments
 (0)