my-openlayer 0.1.16 → 0.1.17

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.
@@ -68,7 +68,7 @@ export default class Polygon {
68
68
  fill: new Fill({ color: options?.fillColor || 'rgba(255, 255, 255, 0.3)' }),
69
69
  });
70
70
  if (options?.textVisible) {
71
- const text = options?.textValue || (options.nameKey ? feature.get(options.nameKey) : "");
71
+ const text = (options?.textCallBack ? options?.textCallBack(feature) : '') || (options.nameKey ? feature.get(options.nameKey) : "");
72
72
  featureStyle.setText(new Text({
73
73
  text: text,
74
74
  font: options?.textFont ?? '14px Calibri,sans-serif',
@@ -118,7 +118,7 @@ export default class Polygon {
118
118
  fill: new Fill({ color: newColor || options?.fillColor || 'rgba(255, 255, 255, 0.3)' }),
119
119
  });
120
120
  if (options?.textVisible) {
121
- const text = options?.textValue || (options.nameKey ? feature.get(options.nameKey) : "");
121
+ const text = (options?.textCallBack ? options?.textCallBack(feature) : '') || (options.nameKey ? feature.get(options.nameKey) : "");
122
122
  featureStyle.setText(new Text({
123
123
  text,
124
124
  font: options?.textFont ?? '14px Calibri,sans-serif',
package/dist/types.d.ts CHANGED
@@ -72,7 +72,7 @@ export interface OptionsType {
72
72
  lineDashOffset?: number;
73
73
  fillColor?: string;
74
74
  textVisible?: boolean;
75
- textValue?: string;
75
+ textCallBack?: (feature: any) => string;
76
76
  textFont?: string;
77
77
  textFillColor?: string;
78
78
  textStrokeColor?: string;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "my-openlayer",
3
3
  "private": false,
4
- "version": "0.1.16",
4
+ "version": "0.1.17",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",