Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

### ✨ Features and improvements

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

### 🐞 Bug fixes
Expand Down
10 changes: 10 additions & 0 deletions src/diff.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,16 @@ describe('diff', () => {
]);
});

test('set roll', () => {
expect(diffStyles({
roll: 0
} as StyleSpecification, {
roll: 1
} as StyleSpecification)).toEqual([
{command: 'setRoll', args: [1]}
]);
});

test('no changes in light', () => {
expect(diffStyles({
light: {
Expand Down
4 changes: 4 additions & 0 deletions src/diff.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ export type DiffOperationsMap = {
'setZoom': [number];
'setBearing': [number];
'setPitch': [number];
'setRoll': [number];
'setSprite': [SpriteSpecification];
'setGlyphs': [string];
'setTransition': [TransitionSpecification];
Expand Down Expand Up @@ -287,6 +288,9 @@ function diffStyles(before: StyleSpecification, after: StyleSpecification): Diff
if (!isEqual(before.pitch, after.pitch)) {
commands.push({command: 'setPitch', args: [after.pitch]});
}
if (!isEqual(before.roll, after.roll)) {
commands.push({command: 'setRoll', args: [after.roll]});
}
if (!isEqual(before.sprite, after.sprite)) {
commands.push({command: 'setSprite', args: [after.sprite]});
}
Expand Down
7 changes: 7 additions & 0 deletions src/reference/v8.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,13 @@
"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).",
"example": 50
},
"roll": {
"type": "number",
"default": 0,
"units": "degrees",
"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).",
"example": 45
},
"light": {
"type": "light",
"doc": "The global light source.",
Expand Down
6 changes: 6 additions & 0 deletions test/integration/style-spec/tests/roll.input.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"version": 8,
"roll": "45",
"sources": {},
"layers": []
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[
{
"message": "roll: number expected, string found",
"line": 3
}
]
6 changes: 6 additions & 0 deletions test/integration/style-spec/tests/roll.output.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[
{
"message": "roll: number expected, string found",
"line": 3
}
]