my-openlayer 0.1.17 → 0.1.18

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.
@@ -58,6 +58,7 @@ export default class Polygon {
58
58
  features?.forEach(feature => {
59
59
  feature.set('type', options?.type);
60
60
  feature.set('layerName', options?.type);
61
+ const fillColor = options?.fillColorCallBack ? options.fillColorCallBack(feature) : options?.fillColor;
61
62
  const featureStyle = new Style({
62
63
  stroke: new Stroke({
63
64
  color: options?.strokeColor ?? '#EBEEF5',
@@ -65,7 +66,7 @@ export default class Polygon {
65
66
  lineDash: options?.lineDash,
66
67
  lineDashOffset: options?.lineDashOffset
67
68
  }),
68
- fill: new Fill({ color: options?.fillColor || 'rgba(255, 255, 255, 0.3)' }),
69
+ fill: new Fill({ color: fillColor ?? 'rgba(255, 255, 255, 0.3)' }),
69
70
  });
70
71
  if (options?.textVisible) {
71
72
  const text = (options?.textCallBack ? options?.textCallBack(feature) : '') || (options.nameKey ? feature.get(options.nameKey) : "");
package/dist/types.d.ts CHANGED
@@ -71,6 +71,7 @@ export interface OptionsType {
71
71
  lineDash?: number[];
72
72
  lineDashOffset?: number;
73
73
  fillColor?: string;
74
+ fillColorCallBack?: (feature: any) => string;
74
75
  textVisible?: boolean;
75
76
  textCallBack?: (feature: any) => string;
76
77
  textFont?: string;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "my-openlayer",
3
3
  "private": false,
4
- "version": "0.1.17",
4
+ "version": "0.1.18",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",