-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement DDS for
text-max-width
property (#5067)
Implement DDS for `text-max-width` property
- Loading branch information
Nicki Dlugash
authored
Aug 1, 2017
1 parent
3e7c509
commit 3123d96
Showing
6 changed files
with
145 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file added
BIN
+12.3 KB
test/integration/render-tests/text-max-width/property-function/expected.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
63 changes: 63 additions & 0 deletions
63
test/integration/render-tests/text-max-width/property-function/style.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
{ | ||
"version": 8, | ||
"metadata": { | ||
"test": { | ||
"height": 128, | ||
"width": 512 | ||
} | ||
}, | ||
"center": [ 0, 0 ], | ||
"zoom": 0, | ||
"sources": { | ||
"point": { | ||
"type": "geojson", | ||
"data": { | ||
"type": "FeatureCollection", | ||
"features": [ | ||
{ | ||
"type": "Feature", | ||
"properties": { "width": 12, "text": "Longer lines = fewer line wraps" }, | ||
"geometry": { | ||
"type": "Point", | ||
"coordinates": [ -50, 0 ] | ||
} | ||
}, | ||
{ | ||
"type": "Feature", | ||
"properties": { "width": 2, "text": "Shorter lines = more line wraps" }, | ||
"geometry": { | ||
"type": "Point", | ||
"coordinates": [ 75, 0 ] | ||
} | ||
} | ||
] | ||
} | ||
} | ||
}, | ||
"glyphs": "local://glyphs/{fontstack}/{range}.pbf", | ||
"layers": [ | ||
{ | ||
"id": "background", | ||
"type": "background", | ||
"paint": { | ||
"background-color": "white" | ||
} | ||
}, | ||
{ | ||
"id": "text", | ||
"type": "symbol", | ||
"source": "point", | ||
"layout": { | ||
"text-field": "{text}", | ||
"text-max-width": { | ||
"type": "identity", | ||
"property": "width" | ||
}, | ||
"text-font": [ | ||
"Open Sans Semibold", | ||
"Arial Unicode MS Bold" | ||
] | ||
} | ||
} | ||
] | ||
} |
Binary file added
BIN
+24.7 KB
...integration/render-tests/text-max-width/zoom-and-property-function/expected.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
75 changes: 75 additions & 0 deletions
75
test/integration/render-tests/text-max-width/zoom-and-property-function/style.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
{ | ||
"version": 8, | ||
"metadata": { | ||
"test": { | ||
"height": 128, | ||
"width": 512 | ||
} | ||
}, | ||
"center": [ 0, 0 ], | ||
"zoom": 1.5, | ||
"sources": { | ||
"point": { | ||
"type": "geojson", | ||
"data": { | ||
"type": "FeatureCollection", | ||
"features": [ | ||
{ | ||
"type": "Feature", | ||
"properties": { | ||
"width": "varying", | ||
"text": "These lines look the same a a a a a a a a a a a a a a a a a a a a a a a a a a a a" | ||
}, | ||
"geometry": { | ||
"type": "Point", | ||
"coordinates": [ -25, 0 ] | ||
} | ||
}, | ||
{ | ||
"type": "Feature", | ||
"properties": { | ||
"width": "fixed", | ||
"text": "These lines look the same a a a a a a a a a a a a a a a a a a a a a a a a a a a a" | ||
}, | ||
"geometry": { | ||
"type": "Point", | ||
"coordinates": [ 25, 0 ] | ||
} | ||
} | ||
] | ||
} | ||
} | ||
}, | ||
"glyphs": "local://glyphs/{fontstack}/{range}.pbf", | ||
"layers": [ | ||
{ | ||
"id": "background", | ||
"type": "background", | ||
"paint": { | ||
"background-color": "white" | ||
} | ||
}, | ||
{ | ||
"id": "text", | ||
"type": "symbol", | ||
"source": "point", | ||
"layout": { | ||
"text-field": "{text}", | ||
"text-max-width": { | ||
"type": "categorical", | ||
"property": "width", | ||
"stops": [ | ||
[{"zoom": 0, "value": "varying"}, 1], | ||
[{"zoom": 0, "value": "fixed"}, 7], | ||
[{"zoom": 2, "value": "varying"}, 13], | ||
[{"zoom": 2, "value": "fixed"}, 7] | ||
] | ||
}, | ||
"text-font": [ | ||
"Open Sans Semibold", | ||
"Arial Unicode MS Bold" | ||
] | ||
} | ||
} | ||
] | ||
} |