Skip to content

Commit 8fb550b

Browse files
committed
Add roll angle to stylesheet
1 parent 63b660a commit 8fb550b

File tree

7 files changed

+40
-0
lines changed

7 files changed

+40
-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: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -302,6 +302,16 @@ describe('diff', () => {
302302
]);
303303
});
304304

305+
test('set roll', () => {
306+
expect(diffStyles({
307+
roll: 0
308+
} as StyleSpecification, {
309+
roll: 1
310+
} as StyleSpecification)).toEqual([
311+
{command: 'setRoll', args: [1]}
312+
]);
313+
});
314+
305315
test('no changes in light', () => {
306316
expect(diffStyles({
307317
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: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,13 @@
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+
},
5764
"light": {
5865
"type": "light",
5966
"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)