[mapbox-gl] line-dasharray, text-font, text-justify can be Expression's (#38534)

* line-dasharray, text-font, test-justify can be Expression's

* Extend tests
This commit is contained in:
mpschaeuble 2019-09-24 18:50:53 +02:00 committed by Michael Crane
parent c3a8129cbd
commit 0fdbc12154
2 changed files with 94 additions and 5 deletions

View File

@ -1548,7 +1548,7 @@ declare namespace mapboxgl {
'line-offset-transition'?: Transition;
'line-blur'?: number | StyleFunction | Expression;
'line-blur-transition'?: Transition;
'line-dasharray'?: number[];
'line-dasharray'?: number[] | Expression;
'line-dasharray-transition'?: Transition;
'line-pattern'?: string | Expression;
'line-pattern-transition'?: Transition;
@ -1579,12 +1579,12 @@ declare namespace mapboxgl {
'text-pitch-alignment'?: 'map' | 'viewport' | 'auto';
'text-rotation-alignment'?: 'map' | 'viewport' | 'auto';
'text-field'?: string | StyleFunction | Expression;
'text-font'?: string | string[];
'text-font'?: string | string[] | Expression;
'text-size'?: number | StyleFunction | Expression;
'text-max-width'?: number | Expression;
'text-line-height'?: number | Expression;
'text-letter-spacing'?: number | Expression;
'text-justify'?: 'left' | 'center' | 'right';
'text-justify'?: 'left' | 'center' | 'right' | Expression;
'text-anchor'?: Anchor | StyleFunction | Expression;
'text-max-angle'?: number | Expression;
'text-rotate'?: number | StyleFunction | Expression;

View File

@ -170,7 +170,28 @@ map.on('load', function() {
},
"paint": {
"line-color": "#888",
"line-width": 8
"line-width": 8,
"line-dasharray": [
"step",
[
"zoom"
],
[
"literal",
[
1,
0
]
],
15,
[
"literal",
[
1.75,
1
]
]
]
}
});
@ -399,7 +420,75 @@ var mapStyle = {
"layout": {
"text-transform": "uppercase",
"text-field": "{name_en}",
"text-font": ["DIN Offc Pro Bold", "Arial Unicode MS Bold"],
"text-font": [
"step",
[
"zoom"
],
[
"literal",
[
"DIN Offc Pro Regular",
"Arial Unicode MS Regular"
]
],
8,
[
"step",
[
"get",
"symbolrank"
],
[
"literal",
[
"DIN Offc Pro Medium",
"Arial Unicode MS Regular"
]
],
11,
[
"literal",
[
"DIN Offc Pro Regular",
"Arial Unicode MS Regular"
]
]
]
],
"text-justify": [
"step",
[
"zoom"
],
[
"match",
[
"get",
"text_anchor"
],
[
"bottom",
"top"
],
"center",
[
"left",
"bottom-left",
"top-left"
],
"left",
[
"right",
"bottom-right",
"top-right"
],
"right",
"center"
],
8,
"center"
],
"text-letter-spacing": 0.15,
"text-max-width": 7,
"text-size": {"stops": [[4, 10], [6, 14]]}