ol 10.7.1-dev.1765552266626 → 10.7.1-dev.1766068548052
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/dist/ol.js +1 -1
- package/dist/ol.js.map +1 -1
- package/package.json +1 -1
- package/render/canvas/style.js +29 -17
- package/style/Icon.d.ts +10 -0
- package/style/Icon.d.ts.map +1 -1
- package/style/Icon.js +36 -0
- package/style/RegularShape.d.ts.map +1 -1
- package/style/RegularShape.js +1 -4
- package/util.js +1 -1
package/package.json
CHANGED
package/render/canvas/style.js
CHANGED
|
@@ -756,7 +756,20 @@ function buildIcon(flatStyle, context) {
|
|
|
756
756
|
flatStyle,
|
|
757
757
|
prefix + 'anchor-y-units',
|
|
758
758
|
);
|
|
759
|
-
const
|
|
759
|
+
const colorValue = getExpressionValue(flatStyle, prefix + 'color');
|
|
760
|
+
let color;
|
|
761
|
+
let evaluateColor = null;
|
|
762
|
+
if (colorValue !== undefined) {
|
|
763
|
+
const isColorExpression =
|
|
764
|
+
Array.isArray(colorValue) &&
|
|
765
|
+
colorValue.length > 0 &&
|
|
766
|
+
typeof colorValue[0] === 'string';
|
|
767
|
+
if (isColorExpression) {
|
|
768
|
+
evaluateColor = colorLikeEvaluator(flatStyle, prefix + 'color', context);
|
|
769
|
+
} else {
|
|
770
|
+
color = requireColorLike(colorValue, prefix + 'color');
|
|
771
|
+
}
|
|
772
|
+
}
|
|
760
773
|
const crossOrigin = optionalString(flatStyle, prefix + 'cross-origin');
|
|
761
774
|
const offset = optionalNumberArray(flatStyle, prefix + 'offset');
|
|
762
775
|
const offsetOrigin = optionalIconOrigin(flatStyle, prefix + 'offset-origin');
|
|
@@ -768,12 +781,11 @@ function buildIcon(flatStyle, context) {
|
|
|
768
781
|
prefix + 'declutter-mode',
|
|
769
782
|
);
|
|
770
783
|
|
|
771
|
-
const
|
|
784
|
+
const iconOptions = {
|
|
772
785
|
src,
|
|
773
786
|
anchorOrigin,
|
|
774
787
|
anchorXUnits,
|
|
775
788
|
anchorYUnits,
|
|
776
|
-
color,
|
|
777
789
|
crossOrigin,
|
|
778
790
|
offset,
|
|
779
791
|
offsetOrigin,
|
|
@@ -781,9 +793,22 @@ function buildIcon(flatStyle, context) {
|
|
|
781
793
|
width,
|
|
782
794
|
size,
|
|
783
795
|
declutterMode,
|
|
784
|
-
}
|
|
796
|
+
};
|
|
797
|
+
|
|
798
|
+
let icon = null;
|
|
785
799
|
|
|
786
800
|
return function (context) {
|
|
801
|
+
if (!icon) {
|
|
802
|
+
// lazily create the icon to allow for expression evaluation
|
|
803
|
+
const initialColor = evaluateColor ? evaluateColor(context) : color;
|
|
804
|
+
icon = new Icon(
|
|
805
|
+
initialColor !== undefined
|
|
806
|
+
? Object.assign({}, iconOptions, {color: initialColor})
|
|
807
|
+
: Object.assign({}, iconOptions),
|
|
808
|
+
);
|
|
809
|
+
} else if (evaluateColor) {
|
|
810
|
+
icon.setColor(evaluateColor(context));
|
|
811
|
+
}
|
|
787
812
|
if (evaluateOpacity) {
|
|
788
813
|
icon.setOpacity(evaluateOpacity(context));
|
|
789
814
|
}
|
|
@@ -1311,19 +1336,6 @@ function optionalDeclutterMode(flatStyle, property) {
|
|
|
1311
1336
|
return encoded;
|
|
1312
1337
|
}
|
|
1313
1338
|
|
|
1314
|
-
/**
|
|
1315
|
-
* @param {FlatStyle} flatStyle The flat style.
|
|
1316
|
-
* @param {string} property The symbolizer property.
|
|
1317
|
-
* @return {string|Array<number>|undefined} A string or an array of color values or undefined.
|
|
1318
|
-
*/
|
|
1319
|
-
function optionalColorLike(flatStyle, property) {
|
|
1320
|
-
const encoded = flatStyle[property];
|
|
1321
|
-
if (encoded === undefined) {
|
|
1322
|
-
return undefined;
|
|
1323
|
-
}
|
|
1324
|
-
return requireColorLike(encoded, property);
|
|
1325
|
-
}
|
|
1326
|
-
|
|
1327
1339
|
/**
|
|
1328
1340
|
* @param {any} value The value.
|
|
1329
1341
|
* @param {string} property The property.
|
package/style/Icon.d.ts
CHANGED
|
@@ -189,6 +189,16 @@ declare class Icon extends ImageStyle {
|
|
|
189
189
|
* @api
|
|
190
190
|
*/
|
|
191
191
|
getColor(): import("../color.js").Color;
|
|
192
|
+
/**
|
|
193
|
+
* Set the icon color.
|
|
194
|
+
*
|
|
195
|
+
* Warning: Repeatedly setting the color on an icon style
|
|
196
|
+
* causes the icon image to be re-created each time. This can have a
|
|
197
|
+
* severe performance impact.
|
|
198
|
+
*
|
|
199
|
+
* @param {import("../color.js").Color|string|null|undefined} color Color.
|
|
200
|
+
*/
|
|
201
|
+
setColor(color: import("../color.js").Color | string | null | undefined): void;
|
|
192
202
|
/**
|
|
193
203
|
* Get the image icon.
|
|
194
204
|
* @param {number} pixelRatio Pixel ratio.
|
package/style/Icon.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Icon.d.ts","sourceRoot":"","sources":["Icon.js"],"names":[],"mappings":";;;;8BAYa,UAAU,GAAG,QAAQ;;;;yBAKrB,aAAa,GAAG,cAAc,GAAG,UAAU,GAAG,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2DtE;;;;GAIG;AACH;IACE;;OAEG;IACH,sBAFW,OAAO,EA0MjB;IAtKC;;;OAGG;IACH,gBAAyE;IAEzE;;;OAGG;IACH,0BAA6B;IAE7B;;;OAGG;IACH,sBACwE;IAExE;;;OAGG;IACH,sBACwE;IAExE;;;OAGG;IACH,sBACwE;IAExE;;;OAGG;IACH,qBACgE;IA0ChE;;;OAGG;IACH,eAAyE;IAEzE;;;OAGG;IACH,mBAMC;IAED;;;OAGG;IACH,gBAAqE;IACrE;;;OAGG;IACH,sBACwE;IAExE;;;OAGG;IACH,gBAAmB;IAEnB;;;OAGG;IACH,cAA6D;IAoBvD,qCAA8B;IA4BtC;;;;;OAKG;IACH,kBAJY,IAAI,CAoCf;IA8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AM,CAAC,QAMvB;IAED;;;;OAIG;IACH,YAHY,OAAO,aAAa,EAAE,KAAK,CAKtC;IAED;;;;;;;;OAQG;IACH,gBAFW,OAAO,aAAa,EAAE,KAAK,GAAC,MAAM,GAAC,IAAI,GAAC,SAAS,QA2B3D;IAED;;;;;;;OAOG;IACH,8BANW,MAAM,GACL,gBAAgB,GAAC,iBAAiB,GAAC,eAAe,GAAC,WAAW,CAOzE;IA6BD;;;OAGG;IACH,iCAHY,gBAAgB,GAAC,iBAAiB,GAAC,eAAe,GAAC,WAAW,CAKzE;IAsCD;;;;OAIG;IACH,UAHY,MAAM,GAAC,SAAS,CAK3B;IAED;;;;OAIG;IACH,YAHW,MAAM,QAWhB;IAYD;;;;OAIG;IACH,YAHY,MAAM,CAYjB;IAED;;;;OAIG;IACH,aAHY,MAAM,CAYjB;CAgDF;uBAtnBsB,YAAY"}
|
package/style/Icon.js
CHANGED
|
@@ -406,6 +406,42 @@ class Icon extends ImageStyle {
|
|
|
406
406
|
return this.color_;
|
|
407
407
|
}
|
|
408
408
|
|
|
409
|
+
/**
|
|
410
|
+
* Set the icon color.
|
|
411
|
+
*
|
|
412
|
+
* Warning: Repeatedly setting the color on an icon style
|
|
413
|
+
* causes the icon image to be re-created each time. This can have a
|
|
414
|
+
* severe performance impact.
|
|
415
|
+
*
|
|
416
|
+
* @param {import("../color.js").Color|string|null|undefined} color Color.
|
|
417
|
+
*/
|
|
418
|
+
setColor(color) {
|
|
419
|
+
const nextColor = color ? asArray(color) : null;
|
|
420
|
+
if (
|
|
421
|
+
this.color_ === nextColor ||
|
|
422
|
+
(this.color_ &&
|
|
423
|
+
nextColor &&
|
|
424
|
+
this.color_.length === nextColor.length &&
|
|
425
|
+
this.color_.every((value, index) => value === nextColor[index]))
|
|
426
|
+
) {
|
|
427
|
+
// Discard if the color hasn't changed.
|
|
428
|
+
return;
|
|
429
|
+
}
|
|
430
|
+
|
|
431
|
+
this.color_ = nextColor;
|
|
432
|
+
const src = this.getSrc();
|
|
433
|
+
const image = src !== undefined ? null : this.getHitDetectionImage();
|
|
434
|
+
const imageState =
|
|
435
|
+
src !== undefined ? ImageState.IDLE : this.iconImage_.getImageState();
|
|
436
|
+
this.iconImage_ = getIconImage(
|
|
437
|
+
image,
|
|
438
|
+
src,
|
|
439
|
+
this.crossOrigin_,
|
|
440
|
+
imageState,
|
|
441
|
+
this.color_,
|
|
442
|
+
);
|
|
443
|
+
}
|
|
444
|
+
|
|
409
445
|
/**
|
|
410
446
|
* Get the image icon.
|
|
411
447
|
* @param {number} pixelRatio Pixel ratio.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RegularShape.d.ts","sourceRoot":"","sources":["RegularShape.js"],"names":[],"mappings":";;;;;;;;;;;;;YAwBc,MAAM;;;;YAEN,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAeN,OAAO,iBAAiB,EAAE,SAAS,GAAC,SAAS;;;;iBAC7C,MAAM;;;;UACN,MAAM;;;;aACN,aAAa;;;;cACb,KAAK,CAAC,MAAM,CAAC,GAAC,IAAI;;;;oBAClB,MAAM;;;;cACN,cAAc;;;;gBACd,MAAM;;AA5BpB;;;;;;;;;;;;;;;;;GAiBG;AAEH;;;;;;;;;;GAUG;AAEH;;;;;;GAMG;AACH;IACE;;OAEG;IACH,qBAFW,OAAO,EAqFjB;IAvEC;;;OAGG;IACH,4BAA+B;IAE/B;;;OAGG;IACH,cAA6D;IAE7D;;;OAGG;IACH,gBAAqB;IAErB;;;OAGG;IACH,gBAA6B;IAE7B;;;OAGG;IACH,kBAFU,MAAM,CAEY;IAE5B;;;OAGG;IACH,iBAA+B;IAE/B;;;OAGG;IACH,eAA6D;IAE7D;;;OAGG;IACH,gBAAmE;IAEnE;;;OAGG;IACH,cAAU;IAEV;;;OAGG;IACH,uBAAmB;IAEnB;;OAEG;IACH,oBAGuB;IAOzB;;;;;OAKG;IACH,kBAJY,YAAY,CAqBvB;IAqBD;;;;OAIG;IAC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IACH,cAHW,OAAO,WAAW,EAAE,OAAO,GAAC,IAAI,QAM1C;IAED;;;OAGG;IACH,iCAHY,iBAAiB,GAAC,eAAe,CAU5C;IAED;;;;;;OAMG;IACH,8BALW,MAAM,GACL,iBAAiB,GAAC,eAAe,CAiC5C;IAsCD;;;;OAIG;IACH,aAHY,MAAM,CAKjB;IAED;;;;OAIG;IACH,aAHY,MAAM,CAKjB;IAED;;;;OAIG;IACH,kBAHW,MAAM,QAShB;IAED;;;;OAIG;IACH,cAHY,MAAM,GAAC,SAAS,CAK3B;IAED;;;;OAIG;IACH,oBAHW,MAAM,GAAC,SAAS,QAS1B;IAYD;;;;OAIG;IACH,aAHY,OAAO,aAAa,EAAE,OAAO,GAAC,IAAI,CAK7C;IAED;;;;OAIG;IACH,kBAHW,OAAO,aAAa,EAAE,OAAO,GAAC,IAAI,QAM5C;IAoBD;;;;;;;OAOG;IACH,+BAgFC;IAED;;;OAGG;IACH,iCAHY,aAAa,CAoCxB;IAED;;OAEG;IACH,yBAKC;IAED;;;;;OAKG;IACH,cA2BC;IAED;;;;OAIG;IACH,kCAuBC;IAED;;;OAGG;IACH,oBAmBC;IAED;;;;OAIG;IACH,gCAmBC;CAQF;uBAzoBsB,YAAY"}
|
package/style/RegularShape.js
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
import ImageState from '../ImageState.js';
|
|
6
6
|
import {asArray} from '../color.js';
|
|
7
7
|
import {asColorLike} from '../colorlike.js';
|
|
8
|
-
import {createCanvasContext2D
|
|
8
|
+
import {createCanvasContext2D} from '../dom.js';
|
|
9
9
|
import {
|
|
10
10
|
defaultFillStyle,
|
|
11
11
|
defaultLineCap,
|
|
@@ -263,9 +263,6 @@ class RegularShape extends ImageStyle {
|
|
|
263
263
|
// Update the image in place to an ImageBitmap for better performance and lower memory usage
|
|
264
264
|
createImageBitmap(image).then((imageBitmap) => {
|
|
265
265
|
iconImage.setImage(imageBitmap);
|
|
266
|
-
if (this.hitDetectionCanvas_ !== image) {
|
|
267
|
-
releaseCanvas(context);
|
|
268
|
-
}
|
|
269
266
|
});
|
|
270
267
|
}
|
|
271
268
|
return image;
|
package/util.js
CHANGED