ol 9.2.5-dev.1718182619798 → 9.2.5-dev.1718470218102
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Tile.d.ts +4 -4
- package/Tile.js +2 -2
- package/VectorTile.d.ts +1 -1
- package/VectorTile.js +1 -1
- package/color.js +2 -2
- package/dist/ol.js +2 -2
- package/dist/ol.js.map +1 -1
- package/events/condition.d.ts +2 -2
- package/events/condition.js +1 -1
- package/expr/cpu.d.ts.map +1 -1
- package/expr/cpu.js +2 -16
- package/expr/expression.d.ts +7 -14
- package/expr/expression.d.ts.map +1 -1
- package/expr/expression.js +388 -508
- package/expr/gpu.d.ts.map +1 -1
- package/expr/gpu.js +1 -14
- package/featureloader.d.ts +2 -2
- package/featureloader.js +1 -1
- package/interaction/DragBox.d.ts +2 -2
- package/interaction/DragBox.js +2 -2
- package/interaction/DragPan.d.ts +2 -2
- package/interaction/DragPan.js +1 -1
- package/interaction/DragRotate.d.ts +3 -3
- package/interaction/DragRotate.js +2 -2
- package/interaction/DragRotateAndZoom.d.ts +2 -2
- package/interaction/DragRotateAndZoom.js +1 -1
- package/interaction/DragZoom.d.ts +3 -3
- package/interaction/DragZoom.js +2 -2
- package/interaction/Draw.d.ts +3 -3
- package/interaction/Draw.js +3 -3
- package/interaction/Extent.d.ts +1 -1
- package/interaction/Extent.js +1 -1
- package/interaction/KeyboardPan.d.ts +2 -2
- package/interaction/KeyboardPan.js +1 -1
- package/interaction/KeyboardZoom.d.ts +2 -2
- package/interaction/KeyboardZoom.js +1 -1
- package/interaction/Modify.d.ts +6 -6
- package/interaction/Modify.js +3 -3
- package/interaction/MouseWheelZoom.d.ts +2 -2
- package/interaction/MouseWheelZoom.js +1 -1
- package/interaction/Select.d.ts +12 -12
- package/interaction/Select.js +6 -6
- package/interaction/Translate.d.ts +8 -8
- package/interaction/Translate.js +4 -4
- package/package.json +1 -1
- package/render/canvas/style.d.ts.map +1 -1
- package/render/canvas/style.js +6 -5
- package/source/Cluster.d.ts +2 -2
- package/source/Cluster.js +1 -1
- package/source/Vector.d.ts +2 -2
- package/source/Vector.js +2 -2
- package/style/Fill.d.ts +1 -1
- package/style/Fill.js +1 -1
- package/style/Style.d.ts +4 -4
- package/style/Style.js +2 -2
- package/util.js +1 -1
- package/webgl/styleparser.d.ts.map +1 -1
- package/webgl/styleparser.js +54 -66
package/interaction/Select.js
CHANGED
|
@@ -27,7 +27,7 @@ const SelectEventType = {
|
|
|
27
27
|
};
|
|
28
28
|
|
|
29
29
|
/**
|
|
30
|
-
* A function that takes
|
|
30
|
+
* A function that takes a {@link module:ol/Feature~Feature} and returns `true` if the feature may be
|
|
31
31
|
* selected or `false` otherwise.
|
|
32
32
|
* @typedef {function(import("../Feature.js").default, import("../layer/Layer.js").default<import("../source/Source").default>):boolean} FilterFunction
|
|
33
33
|
*/
|
|
@@ -35,12 +35,12 @@ const SelectEventType = {
|
|
|
35
35
|
/**
|
|
36
36
|
* @typedef {Object} Options
|
|
37
37
|
* @property {import("../events/condition.js").Condition} [addCondition] A function
|
|
38
|
-
* that takes
|
|
38
|
+
* that takes a {@link module:ol/MapBrowserEvent~MapBrowserEvent} and returns a
|
|
39
39
|
* boolean to indicate whether that event should be handled.
|
|
40
40
|
* By default, this is {@link module:ol/events/condition.never}. Use this if you
|
|
41
41
|
* want to use different events for add and remove instead of `toggle`.
|
|
42
42
|
* @property {import("../events/condition.js").Condition} [condition] A function that
|
|
43
|
-
* takes
|
|
43
|
+
* takes a {@link module:ol/MapBrowserEvent~MapBrowserEvent} and returns a
|
|
44
44
|
* boolean to indicate whether that event should be handled. This is the event
|
|
45
45
|
* for the selected features as a whole. By default, this is
|
|
46
46
|
* {@link module:ol/events/condition.singleClick}. Clicking on a feature selects that
|
|
@@ -60,12 +60,12 @@ const SelectEventType = {
|
|
|
60
60
|
* any style changes for selected features.
|
|
61
61
|
* If set to a falsey value, the selected feature's style will not change.
|
|
62
62
|
* @property {import("../events/condition.js").Condition} [removeCondition] A function
|
|
63
|
-
* that takes
|
|
63
|
+
* that takes a {@link module:ol/MapBrowserEvent~MapBrowserEvent} and returns a
|
|
64
64
|
* boolean to indicate whether that event should be handled.
|
|
65
65
|
* By default, this is {@link module:ol/events/condition.never}. Use this if you
|
|
66
66
|
* want to use different events for add and remove instead of `toggle`.
|
|
67
67
|
* @property {import("../events/condition.js").Condition} [toggleCondition] A function
|
|
68
|
-
* that takes
|
|
68
|
+
* that takes a {@link module:ol/MapBrowserEvent~MapBrowserEvent} and returns a
|
|
69
69
|
* boolean to indicate whether that event should be handled. This is in addition
|
|
70
70
|
* to the `condition` event. By default,
|
|
71
71
|
* {@link module:ol/events/condition.shiftKeyOnly}, i.e. pressing `shift` as
|
|
@@ -81,7 +81,7 @@ const SelectEventType = {
|
|
|
81
81
|
* used by the interaction is returned by
|
|
82
82
|
* {@link module:ol/interaction/Select~Select#getFeatures}.
|
|
83
83
|
* @property {FilterFunction} [filter] A function
|
|
84
|
-
* that takes
|
|
84
|
+
* that takes a {@link module:ol/Feature~Feature} and a
|
|
85
85
|
* {@link module:ol/layer/Layer~Layer} and returns `true` if the feature may be
|
|
86
86
|
* selected or `false` otherwise.
|
|
87
87
|
* @property {number} [hitTolerance=0] Hit-detection tolerance. Pixels inside
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* A function that takes
|
|
3
|
-
* {@link module:ol/render/Feature~RenderFeature} and
|
|
2
|
+
* A function that takes a {@link module:ol/Feature~Feature} or
|
|
3
|
+
* {@link module:ol/render/Feature~RenderFeature} and a
|
|
4
4
|
* {@link module:ol/layer/Layer~Layer} and returns `true` if the feature may be
|
|
5
5
|
* translated or `false` otherwise.
|
|
6
6
|
* @typedef {function(Feature, import("../layer/Layer.js").default<import("../source/Source").default>):boolean} FilterFunction
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
/**
|
|
9
9
|
* @typedef {Object} Options
|
|
10
10
|
* @property {import("../events/condition.js").Condition} [condition] A function that
|
|
11
|
-
* takes
|
|
11
|
+
* takes a {@link module:ol/MapBrowserEvent~MapBrowserEvent} and returns a
|
|
12
12
|
* boolean to indicate whether that event should be handled.
|
|
13
13
|
* Default is {@link module:ol/events/condition.always}.
|
|
14
14
|
* @property {Collection<Feature>} [features] Features contained in this collection will be able to be translated together.
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
* absent, all visible layers will be considered translatable.
|
|
20
20
|
* Not used if `features` is provided.
|
|
21
21
|
* @property {FilterFunction} [filter] A function
|
|
22
|
-
* that takes
|
|
22
|
+
* that takes a {@link module:ol/Feature~Feature} and an
|
|
23
23
|
* {@link module:ol/layer/Layer~Layer} and returns `true` if the feature may be
|
|
24
24
|
* translated or `false` otherwise. Not used if `features` is provided.
|
|
25
25
|
* @property {number} [hitTolerance=0] Hit-detection tolerance. Pixels inside the radius around the given position
|
|
@@ -68,8 +68,8 @@ export class TranslateEvent extends Event {
|
|
|
68
68
|
}
|
|
69
69
|
export default Translate;
|
|
70
70
|
/**
|
|
71
|
-
* A function that takes
|
|
72
|
-
* {@link module :ol/render/Feature~RenderFeature} and
|
|
71
|
+
* A function that takes a {@link module :ol/Feature~Feature} or
|
|
72
|
+
* {@link module :ol/render/Feature~RenderFeature} and a
|
|
73
73
|
* {@link module :ol/layer/Layer~Layer} and returns `true` if the feature may be
|
|
74
74
|
* translated or `false` otherwise.
|
|
75
75
|
*/
|
|
@@ -77,7 +77,7 @@ export type FilterFunction = (arg0: Feature, arg1: import("../layer/Layer.js").d
|
|
|
77
77
|
export type Options = {
|
|
78
78
|
/**
|
|
79
79
|
* A function that
|
|
80
|
-
* takes
|
|
80
|
+
* takes a {@link module :ol/MapBrowserEvent~MapBrowserEvent} and returns a
|
|
81
81
|
* boolean to indicate whether that event should be handled.
|
|
82
82
|
* Default is {@link module :ol/events/condition.always}.
|
|
83
83
|
*/
|
|
@@ -97,7 +97,7 @@ export type Options = {
|
|
|
97
97
|
layers?: import("../layer/Layer.js").default<import("../source/Source").default, import("../renderer/Layer.js").default<any>>[] | ((arg0: import("../layer/Layer.js").default<import("../source/Source").default>) => boolean) | undefined;
|
|
98
98
|
/**
|
|
99
99
|
* A function
|
|
100
|
-
* that takes
|
|
100
|
+
* that takes a {@link module :ol/Feature~Feature} and an
|
|
101
101
|
* {@link module :ol/layer/Layer~Layer} and returns `true` if the feature may be
|
|
102
102
|
* translated or `false` otherwise. Not used if `features` is provided.
|
|
103
103
|
*/
|
package/interaction/Translate.js
CHANGED
|
@@ -35,8 +35,8 @@ const TranslateEventType = {
|
|
|
35
35
|
};
|
|
36
36
|
|
|
37
37
|
/**
|
|
38
|
-
* A function that takes
|
|
39
|
-
* {@link module:ol/render/Feature~RenderFeature} and
|
|
38
|
+
* A function that takes a {@link module:ol/Feature~Feature} or
|
|
39
|
+
* {@link module:ol/render/Feature~RenderFeature} and a
|
|
40
40
|
* {@link module:ol/layer/Layer~Layer} and returns `true` if the feature may be
|
|
41
41
|
* translated or `false` otherwise.
|
|
42
42
|
* @typedef {function(Feature, import("../layer/Layer.js").default<import("../source/Source").default>):boolean} FilterFunction
|
|
@@ -45,7 +45,7 @@ const TranslateEventType = {
|
|
|
45
45
|
/**
|
|
46
46
|
* @typedef {Object} Options
|
|
47
47
|
* @property {import("../events/condition.js").Condition} [condition] A function that
|
|
48
|
-
* takes
|
|
48
|
+
* takes a {@link module:ol/MapBrowserEvent~MapBrowserEvent} and returns a
|
|
49
49
|
* boolean to indicate whether that event should be handled.
|
|
50
50
|
* Default is {@link module:ol/events/condition.always}.
|
|
51
51
|
* @property {Collection<Feature>} [features] Features contained in this collection will be able to be translated together.
|
|
@@ -56,7 +56,7 @@ const TranslateEventType = {
|
|
|
56
56
|
* absent, all visible layers will be considered translatable.
|
|
57
57
|
* Not used if `features` is provided.
|
|
58
58
|
* @property {FilterFunction} [filter] A function
|
|
59
|
-
* that takes
|
|
59
|
+
* that takes a {@link module:ol/Feature~Feature} and an
|
|
60
60
|
* {@link module:ol/layer/Layer~Layer} and returns `true` if the feature may be
|
|
61
61
|
* translated or `false` otherwise. Not used if `features` is provided.
|
|
62
62
|
* @property {number} [hitTolerance=0] Hit-detection tolerance. Pixels inside the radius around the given position
|
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"style.d.ts","sourceRoot":"","sources":["style.js"],"names":[],"mappings":"AAgEA;;;;;;;GAOG;AACH,4CAHW,MAAM,OAAO,qBAAqB,EAAE,IAAI,CAAC,GACxC,OAAO,sBAAsB,EAAE,aAAa,CAwBvD;AAED;;;;;;;GAOG;AACH,sDAHW,MAAM,OAAO,qBAAqB,EAAE,SAAS,CAAC,GAC7C,OAAO,sBAAsB,EAAE,aAAa,CA0CvD;AAED;;GAEG;AAEH;;;;GAIG;AAEH;;;;GAIG;AACH,oCAJW,MAAM,OAAO,qBAAqB,EAAE,IAAI,CAAC,WACzC,cAAc,GACb,gBAAgB,CA6D3B;AAED;;GAEG;AAEH;;;;;GAKG;AACH,sCALW,SAAS,WACT,cAAc,GACb,cAAc,CAgEzB;wBApQY,OAAO,qBAAqB,EAAE,SAAS;gCAIvC,OAAO,0BAA0B,EAAE,iBAAiB;6BAIpD,OAAO,0BAA0B,EAAE,cAAc;6BAIjD,OAAO,0BAA0B,EAAE,cAAc;gCAIjD,OAAO,mBAAmB,EAAE,iBAAiB;kCAI7C,OAAO,mBAAmB,EAAE,mBAAmB;sCA8FtC,iBAAiB,KAAE,MAAM,KAAK,CAAC;;;;;YAKvC,mBAAmB;;;;YACnB,MAAM,cAAc,CAAC;;oCAsEb,iBAAiB,KAAE,KAAK,GAAC,IAAI;mCAyE7B,iBAAiB,KAAE,IAAI,GAAC,IAAI;
|
|
1
|
+
{"version":3,"file":"style.d.ts","sourceRoot":"","sources":["style.js"],"names":[],"mappings":"AAgEA;;;;;;;GAOG;AACH,4CAHW,MAAM,OAAO,qBAAqB,EAAE,IAAI,CAAC,GACxC,OAAO,sBAAsB,EAAE,aAAa,CAwBvD;AAED;;;;;;;GAOG;AACH,sDAHW,MAAM,OAAO,qBAAqB,EAAE,SAAS,CAAC,GAC7C,OAAO,sBAAsB,EAAE,aAAa,CA0CvD;AAED;;GAEG;AAEH;;;;GAIG;AAEH;;;;GAIG;AACH,oCAJW,MAAM,OAAO,qBAAqB,EAAE,IAAI,CAAC,WACzC,cAAc,GACb,gBAAgB,CA6D3B;AAED;;GAEG;AAEH;;;;;GAKG;AACH,sCALW,SAAS,WACT,cAAc,GACb,cAAc,CAgEzB;wBApQY,OAAO,qBAAqB,EAAE,SAAS;gCAIvC,OAAO,0BAA0B,EAAE,iBAAiB;6BAIpD,OAAO,0BAA0B,EAAE,cAAc;6BAIjD,OAAO,0BAA0B,EAAE,cAAc;gCAIjD,OAAO,mBAAmB,EAAE,iBAAiB;kCAI7C,OAAO,mBAAmB,EAAE,mBAAmB;sCA8FtC,iBAAiB,KAAE,MAAM,KAAK,CAAC;;;;;YAKvC,mBAAmB;;;;YACnB,MAAM,cAAc,CAAC;;oCAsEb,iBAAiB,KAAE,KAAK,GAAC,IAAI;mCAyE7B,iBAAiB,KAAE,IAAI,GAAC,IAAI;qCAyC5B,iBAAiB,KAAE,MAAM,GAAC,IAAI;mCA2G9B,iBAAiB,KAAE,IAAI;oCAgOvB,iBAAiB,KAAE,OAAO,sBAAsB,EAAE,OAAO;kBAnpB7D,sBAAsB;iBAJvB,qBAAqB;mBAGnB,uBAAuB;iBAEzB,qBAAqB"}
|
package/render/canvas/style.js
CHANGED
|
@@ -308,6 +308,11 @@ function buildFill(flatStyle, prefix, context) {
|
|
|
308
308
|
if (prefix + 'fill-pattern-src' in flatStyle) {
|
|
309
309
|
evaluateColor = patternEvaluator(flatStyle, prefix + 'fill-', context);
|
|
310
310
|
} else {
|
|
311
|
+
if (flatStyle[prefix + 'fill-color'] === 'none') {
|
|
312
|
+
// avoids hit detection
|
|
313
|
+
return (context) => null;
|
|
314
|
+
}
|
|
315
|
+
|
|
311
316
|
evaluateColor = colorLikeEvaluator(
|
|
312
317
|
flatStyle,
|
|
313
318
|
prefix + 'fill-color',
|
|
@@ -1029,11 +1034,7 @@ function colorLikeEvaluator(flatStyle, name, context) {
|
|
|
1029
1034
|
if (!(name in flatStyle)) {
|
|
1030
1035
|
return null;
|
|
1031
1036
|
}
|
|
1032
|
-
const evaluator = buildExpression(
|
|
1033
|
-
flatStyle[name],
|
|
1034
|
-
ColorType | StringType,
|
|
1035
|
-
context,
|
|
1036
|
-
);
|
|
1037
|
+
const evaluator = buildExpression(flatStyle[name], ColorType, context);
|
|
1037
1038
|
return function (context) {
|
|
1038
1039
|
return requireColorLike(evaluator(context), name);
|
|
1039
1040
|
};
|
package/source/Cluster.d.ts
CHANGED
|
@@ -18,7 +18,7 @@ export type Options<FeatureType extends import("../Feature.js").FeatureLike> = {
|
|
|
18
18
|
*/
|
|
19
19
|
minDistance?: number | undefined;
|
|
20
20
|
/**
|
|
21
|
-
* Function that takes
|
|
21
|
+
* Function that takes a {@link module :ol/Feature~Feature} as argument and returns a
|
|
22
22
|
* {@link module :ol/geom/Point~Point} as cluster calculation point for the feature. When a
|
|
23
23
|
* feature should not be considered for clustering, the function should return
|
|
24
24
|
* `null`. The default, which works when the underlying source contains point
|
|
@@ -67,7 +67,7 @@ export type Options<FeatureType extends import("../Feature.js").FeatureLike> = {
|
|
|
67
67
|
* overlapping icons. As a tradoff, the cluster feature's position will no longer be
|
|
68
68
|
* the center of all its features.
|
|
69
69
|
* @property {function(FeatureType):(Point)} [geometryFunction]
|
|
70
|
-
* Function that takes
|
|
70
|
+
* Function that takes a {@link module:ol/Feature~Feature} as argument and returns a
|
|
71
71
|
* {@link module:ol/geom/Point~Point} as cluster calculation point for the feature. When a
|
|
72
72
|
* feature should not be considered for clustering, the function should return
|
|
73
73
|
* `null`. The default, which works when the underlying source contains point
|
package/source/Cluster.js
CHANGED
|
@@ -28,7 +28,7 @@ import {getUid} from '../util.js';
|
|
|
28
28
|
* overlapping icons. As a tradoff, the cluster feature's position will no longer be
|
|
29
29
|
* the center of all its features.
|
|
30
30
|
* @property {function(FeatureType):(Point)} [geometryFunction]
|
|
31
|
-
* Function that takes
|
|
31
|
+
* Function that takes a {@link module:ol/Feature~Feature} as argument and returns a
|
|
32
32
|
* {@link module:ol/geom/Point~Point} as cluster calculation point for the feature. When a
|
|
33
33
|
* feature should not be considered for clustering, the function should return
|
|
34
34
|
* `null`. The default, which works when the underlying source contains point
|
package/source/Vector.d.ts
CHANGED
|
@@ -365,7 +365,7 @@ declare class VectorSource<FeatureType extends import("../Feature.js").FeatureLi
|
|
|
365
365
|
* instead. A feature will not be added to the source if feature with
|
|
366
366
|
* the same id is already there. The reason for this behavior is to avoid
|
|
367
367
|
* feature duplication when using bbox or tile loading strategies.
|
|
368
|
-
* Note: this also applies if
|
|
368
|
+
* Note: this also applies if a {@link module:ol/Collection~Collection} is used for features,
|
|
369
369
|
* meaning that if a feature with a duplicate id is added in the collection, it will
|
|
370
370
|
* be removed from it right away.
|
|
371
371
|
* @param {FeatureType} feature Feature to add.
|
|
@@ -483,7 +483,7 @@ declare class VectorSource<FeatureType extends import("../Feature.js").FeatureLi
|
|
|
483
483
|
/**
|
|
484
484
|
* Get the features collection associated with this source. Will be `null`
|
|
485
485
|
* unless the source was configured with `useSpatialIndex` set to `false`, or
|
|
486
|
-
* with
|
|
486
|
+
* with a {@link module:ol/Collection~Collection} as `features`.
|
|
487
487
|
* @return {Collection<FeatureType>|null} The collection of features.
|
|
488
488
|
* @api
|
|
489
489
|
*/
|
package/source/Vector.js
CHANGED
|
@@ -328,7 +328,7 @@ class VectorSource extends Source {
|
|
|
328
328
|
* instead. A feature will not be added to the source if feature with
|
|
329
329
|
* the same id is already there. The reason for this behavior is to avoid
|
|
330
330
|
* feature duplication when using bbox or tile loading strategies.
|
|
331
|
-
* Note: this also applies if
|
|
331
|
+
* Note: this also applies if a {@link module:ol/Collection~Collection} is used for features,
|
|
332
332
|
* meaning that if a feature with a duplicate id is added in the collection, it will
|
|
333
333
|
* be removed from it right away.
|
|
334
334
|
* @param {FeatureType} feature Feature to add.
|
|
@@ -706,7 +706,7 @@ class VectorSource extends Source {
|
|
|
706
706
|
/**
|
|
707
707
|
* Get the features collection associated with this source. Will be `null`
|
|
708
708
|
* unless the source was configured with `useSpatialIndex` set to `false`, or
|
|
709
|
-
* with
|
|
709
|
+
* with a {@link module:ol/Collection~Collection} as `features`.
|
|
710
710
|
* @return {Collection<FeatureType>|null} The collection of features.
|
|
711
711
|
* @api
|
|
712
712
|
*/
|
package/style/Fill.d.ts
CHANGED
|
@@ -38,7 +38,7 @@ declare class Fill {
|
|
|
38
38
|
*/
|
|
39
39
|
private color_;
|
|
40
40
|
/**
|
|
41
|
-
* Clones the style. The color is not cloned if it is
|
|
41
|
+
* Clones the style. The color is not cloned if it is a {@link module:ol/colorlike~ColorLike}.
|
|
42
42
|
* @return {Fill} The cloned style.
|
|
43
43
|
* @api
|
|
44
44
|
*/
|
package/style/Fill.js
CHANGED
|
@@ -43,7 +43,7 @@ class Fill {
|
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
/**
|
|
46
|
-
* Clones the style. The color is not cloned if it is
|
|
46
|
+
* Clones the style. The color is not cloned if it is a {@link module:ol/colorlike~ColorLike}.
|
|
47
47
|
* @return {Fill} The cloned style.
|
|
48
48
|
* @api
|
|
49
49
|
*/
|
package/style/Style.d.ts
CHANGED
|
@@ -28,7 +28,7 @@ export default Style;
|
|
|
28
28
|
*/
|
|
29
29
|
export type DeclutterMode = "declutter" | "obstacle" | "none";
|
|
30
30
|
/**
|
|
31
|
-
* A function that takes
|
|
31
|
+
* A function that takes a {@link module :ol/Feature~Feature} and a `{number}`
|
|
32
32
|
* representing the view's resolution. The function should return a
|
|
33
33
|
* {@link module :ol/style/Style~Style} or an array of them. This way e.g. a
|
|
34
34
|
* vector layer can be styled. If the function returns `undefined`, the
|
|
@@ -40,7 +40,7 @@ export type StyleFunction = (arg0: import("../Feature.js").FeatureLike, arg1: nu
|
|
|
40
40
|
*/
|
|
41
41
|
export type StyleLike = Style | Array<Style> | StyleFunction;
|
|
42
42
|
/**
|
|
43
|
-
* A function that takes
|
|
43
|
+
* A function that takes a {@link module :ol/Feature~Feature} as argument and returns an
|
|
44
44
|
* {@link module :ol/geom/Geometry~Geometry} that will be rendered and styled for the feature.
|
|
45
45
|
*/
|
|
46
46
|
export type GeometryFunction = (arg0: import("../Feature.js").FeatureLike) => (import("../geom/Geometry.js").default | import("../render/Feature.js").default | undefined);
|
|
@@ -98,7 +98,7 @@ export type Options = {
|
|
|
98
98
|
* @typedef {"declutter"|"obstacle"|"none"} DeclutterMode
|
|
99
99
|
*/
|
|
100
100
|
/**
|
|
101
|
-
* A function that takes
|
|
101
|
+
* A function that takes a {@link module:ol/Feature~Feature} and a `{number}`
|
|
102
102
|
* representing the view's resolution. The function should return a
|
|
103
103
|
* {@link module:ol/style/Style~Style} or an array of them. This way e.g. a
|
|
104
104
|
* vector layer can be styled. If the function returns `undefined`, the
|
|
@@ -111,7 +111,7 @@ export type Options = {
|
|
|
111
111
|
* @typedef {Style|Array<Style>|StyleFunction} StyleLike
|
|
112
112
|
*/
|
|
113
113
|
/**
|
|
114
|
-
* A function that takes
|
|
114
|
+
* A function that takes a {@link module:ol/Feature~Feature} as argument and returns an
|
|
115
115
|
* {@link module:ol/geom/Geometry~Geometry} that will be rendered and styled for the feature.
|
|
116
116
|
*
|
|
117
117
|
* @typedef {function(import("../Feature.js").FeatureLike):
|
package/style/Style.js
CHANGED
|
@@ -18,7 +18,7 @@ import {assert} from '../asserts.js';
|
|
|
18
18
|
*/
|
|
19
19
|
|
|
20
20
|
/**
|
|
21
|
-
* A function that takes
|
|
21
|
+
* A function that takes a {@link module:ol/Feature~Feature} and a `{number}`
|
|
22
22
|
* representing the view's resolution. The function should return a
|
|
23
23
|
* {@link module:ol/style/Style~Style} or an array of them. This way e.g. a
|
|
24
24
|
* vector layer can be styled. If the function returns `undefined`, the
|
|
@@ -33,7 +33,7 @@ import {assert} from '../asserts.js';
|
|
|
33
33
|
*/
|
|
34
34
|
|
|
35
35
|
/**
|
|
36
|
-
* A function that takes
|
|
36
|
+
* A function that takes a {@link module:ol/Feature~Feature} as argument and returns an
|
|
37
37
|
* {@link module:ol/geom/Geometry~Geometry} that will be rendered and styled for the feature.
|
|
38
38
|
*
|
|
39
39
|
* @typedef {function(import("../Feature.js").FeatureLike):
|
package/util.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"styleparser.d.ts","sourceRoot":"","sources":["styleparser.js"],"names":[],"mappings":"AAuBA;;;;;;;GAOG;AACH,qDALW,OAAO,gBAAgB,EAAE,kBAAkB,SAC3C,OAAO,uBAAuB,EAAE,iBAAiB,sCAEhD,MAAM,
|
|
1
|
+
{"version":3,"file":"styleparser.d.ts","sourceRoot":"","sources":["styleparser.js"],"names":[],"mappings":"AAuBA;;;;;;;GAOG;AACH,qDALW,OAAO,gBAAgB,EAAE,kBAAkB,SAC3C,OAAO,uBAAuB,EAAE,iBAAiB,sCAEhD,MAAM,CAUjB;AAED;;;;GAIG;AACH,iCAHW,OAAO,aAAa,EAAE,KAAK,GAAC,MAAM,GACjC,MAAM,MAAM,CAAC,CASxB;AAqCD;;;;GAIG;AACH,mCAHW,MAAO,MAAM,GACZ,MAAM,CAOjB;AAgvBD;;;;;GAKG;AAEH;;;;;;;;;;GAUG;AACH,yCAHW,OAAO,mBAAmB,EAAE,UAAU,GACrC,gBAAgB,CA0I3B;;;;;aAxJa,aAAa;;;;cACb,OAAO,wCAAwC,EAAE,kBAAkB;;;;gBACnE,OAAO,wCAAwC,EAAE,oBAAoB;;8BA30BvD,oBAAoB"}
|
package/webgl/styleparser.js
CHANGED
|
@@ -31,7 +31,6 @@ import {asArray} from '../color.js';
|
|
|
31
31
|
*/
|
|
32
32
|
export function expressionToGlsl(compilationContext, value, expectedType) {
|
|
33
33
|
const parsingContext = newParsingContext();
|
|
34
|
-
parsingContext.style = compilationContext.style;
|
|
35
34
|
return buildExpression(
|
|
36
35
|
value,
|
|
37
36
|
expectedType,
|
|
@@ -917,38 +916,32 @@ export function parseLiteralStyle(style) {
|
|
|
917
916
|
}
|
|
918
917
|
|
|
919
918
|
// define one uniform per variable
|
|
920
|
-
|
|
919
|
+
for (const varName in fragContext.variables) {
|
|
921
920
|
const variable = fragContext.variables[varName];
|
|
922
921
|
const uniformName = uniformNameForVariable(variable.name);
|
|
923
922
|
builder.addUniform(`${getGlslTypeFromType(variable.type)} ${uniformName}`);
|
|
924
923
|
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
}
|
|
941
|
-
|
|
942
|
-
/** @type {boolean} */ (style.variables[variable.name]) ? 1.0 : 0.0;
|
|
943
|
-
} else {
|
|
944
|
-
callback = () => /** @type {number} */ (style.variables[variable.name]);
|
|
945
|
-
}
|
|
946
|
-
uniforms[uniformName] = callback;
|
|
947
|
-
});
|
|
924
|
+
uniforms[uniformName] = () => {
|
|
925
|
+
const value = style.variables[variable.name];
|
|
926
|
+
if (typeof value === 'number') {
|
|
927
|
+
return value;
|
|
928
|
+
}
|
|
929
|
+
if (typeof value === 'boolean') {
|
|
930
|
+
return value ? 1 : 0;
|
|
931
|
+
}
|
|
932
|
+
if (variable.type === ColorType) {
|
|
933
|
+
return packColor([...asArray(value || '#eee')]);
|
|
934
|
+
}
|
|
935
|
+
if (typeof value === 'string') {
|
|
936
|
+
return getStringNumberEquivalent(value);
|
|
937
|
+
}
|
|
938
|
+
return value;
|
|
939
|
+
};
|
|
940
|
+
}
|
|
948
941
|
|
|
949
942
|
// for each feature attribute used in the fragment shader, define a varying that will be used to pass data
|
|
950
943
|
// from the vertex to the fragment shader, as well as an attribute in the vertex shader (if not already present)
|
|
951
|
-
|
|
944
|
+
for (const propName in fragContext.properties) {
|
|
952
945
|
const property = fragContext.properties[propName];
|
|
953
946
|
if (!vertContext.properties[propName]) {
|
|
954
947
|
vertContext.properties[propName] = property;
|
|
@@ -961,41 +954,15 @@ export function parseLiteralStyle(style) {
|
|
|
961
954
|
builder.addVertexShaderFunction(UNPACK_COLOR_FN);
|
|
962
955
|
}
|
|
963
956
|
builder.addVarying(`v_prop_${property.name}`, type, expression);
|
|
964
|
-
}
|
|
957
|
+
}
|
|
965
958
|
|
|
966
959
|
// for each feature attribute used in the vertex shader, define an attribute in the vertex shader.
|
|
967
|
-
|
|
960
|
+
for (const propName in vertContext.properties) {
|
|
968
961
|
const property = vertContext.properties[propName];
|
|
969
962
|
builder.addAttribute(
|
|
970
963
|
`${getGlslTypeFromType(property.type)} a_prop_${property.name}`,
|
|
971
964
|
);
|
|
972
|
-
}
|
|
973
|
-
|
|
974
|
-
const attributes = Object.keys(vertContext.properties).map(
|
|
975
|
-
function (propName) {
|
|
976
|
-
const property = vertContext.properties[propName];
|
|
977
|
-
let callback;
|
|
978
|
-
if (property.evaluator) {
|
|
979
|
-
callback = property.evaluator;
|
|
980
|
-
} else if (property.type === StringType) {
|
|
981
|
-
callback = (feature) =>
|
|
982
|
-
getStringNumberEquivalent(feature.get(property.name));
|
|
983
|
-
} else if (property.type === ColorType) {
|
|
984
|
-
callback = (feature) =>
|
|
985
|
-
packColor([...asArray(feature.get(property.name) || '#eee')]);
|
|
986
|
-
} else if (property.type === BooleanType) {
|
|
987
|
-
callback = (feature) => (feature.get(property.name) ? 1.0 : 0.0);
|
|
988
|
-
} else {
|
|
989
|
-
callback = (feature) => feature.get(property.name);
|
|
990
|
-
}
|
|
991
|
-
|
|
992
|
-
return {
|
|
993
|
-
name: property.name,
|
|
994
|
-
size: getGlslSizeFromType(property.type),
|
|
995
|
-
callback,
|
|
996
|
-
};
|
|
997
|
-
},
|
|
998
|
-
);
|
|
965
|
+
}
|
|
999
966
|
|
|
1000
967
|
// add functions that were collected in the compilation contexts
|
|
1001
968
|
for (const functionName in vertContext.functions) {
|
|
@@ -1005,15 +972,36 @@ export function parseLiteralStyle(style) {
|
|
|
1005
972
|
builder.addFragmentShaderFunction(fragContext.functions[functionName]);
|
|
1006
973
|
}
|
|
1007
974
|
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
975
|
+
/**
|
|
976
|
+
* @type {import('../render/webgl/VectorStyleRenderer.js').AttributeDefinitions}
|
|
977
|
+
*/
|
|
978
|
+
const attributes = {};
|
|
979
|
+
for (const propName in vertContext.properties) {
|
|
980
|
+
const property = vertContext.properties[propName];
|
|
981
|
+
let callback;
|
|
982
|
+
if (property.evaluator) {
|
|
983
|
+
callback = property.evaluator;
|
|
984
|
+
} else {
|
|
985
|
+
callback = (feature) => {
|
|
986
|
+
const value = feature.get(property.name);
|
|
987
|
+
if (property.type === ColorType) {
|
|
988
|
+
return packColor([...asArray(value || '#eee')]);
|
|
989
|
+
}
|
|
990
|
+
if (typeof value === 'string') {
|
|
991
|
+
return getStringNumberEquivalent(value);
|
|
992
|
+
}
|
|
993
|
+
if (typeof value === 'boolean') {
|
|
994
|
+
return value ? 1 : 0;
|
|
995
|
+
}
|
|
996
|
+
return value;
|
|
997
|
+
};
|
|
998
|
+
}
|
|
999
|
+
|
|
1000
|
+
attributes[property.name] = {
|
|
1001
|
+
size: getGlslSizeFromType(property.type),
|
|
1002
|
+
callback,
|
|
1003
|
+
};
|
|
1004
|
+
}
|
|
1005
|
+
|
|
1006
|
+
return {builder, attributes, uniforms};
|
|
1019
1007
|
}
|