@eox/drawtools 0.13.4 → 0.13.5
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/eox-drawtools.js +701 -678
- package/dist/eox-drawtools.umd.cjs +30 -30
- package/package.json +1 -1
- package/src/main.js +20 -2
- package/src/methods/draw/on-draw-end.js +14 -0
- package/types/drawtools/src/main.d.ts +11 -2
- package/types/drawtools/src/main.d.ts.map +1 -1
- package/types/drawtools/src/methods/draw/on-draw-end.d.ts.map +1 -1
- package/types/map/src/helpers/generate.d.ts.map +1 -1
package/package.json
CHANGED
package/src/main.js
CHANGED
|
@@ -29,6 +29,7 @@ export class EOxDrawTools extends LitElement {
|
|
|
29
29
|
allowModify: { attribute: "allow-modify", type: Boolean },
|
|
30
30
|
for: { type: String },
|
|
31
31
|
currentlyDrawing: { attribute: false, state: true, type: Boolean },
|
|
32
|
+
continuous: { type: Boolean },
|
|
32
33
|
draw: { attribute: false, state: true },
|
|
33
34
|
drawLayer: { attribute: false, state: true },
|
|
34
35
|
drawnFeatures: { attribute: false, state: true, type: Array },
|
|
@@ -66,6 +67,10 @@ export class EOxDrawTools extends LitElement {
|
|
|
66
67
|
* @type string
|
|
67
68
|
*/
|
|
68
69
|
#layerId;
|
|
70
|
+
/**
|
|
71
|
+
* @type boolean
|
|
72
|
+
*/
|
|
73
|
+
#continuous;
|
|
69
74
|
|
|
70
75
|
constructor() {
|
|
71
76
|
super();
|
|
@@ -185,8 +190,21 @@ export class EOxDrawTools extends LitElement {
|
|
|
185
190
|
}
|
|
186
191
|
|
|
187
192
|
/**
|
|
188
|
-
*
|
|
189
|
-
*
|
|
193
|
+
* Enables the user to draw continuously one feature after another
|
|
194
|
+
* without having to discard previous ones manually
|
|
195
|
+
* @type {boolean}
|
|
196
|
+
*/
|
|
197
|
+
set continuous(value) {
|
|
198
|
+
this.#continuous = value;
|
|
199
|
+
if (value) this.multipleFeatures = true;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
get continuous() {
|
|
203
|
+
return this.#continuous;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
/**
|
|
207
|
+
* Enables selection mode for the passed layer
|
|
190
208
|
* @type {string}
|
|
191
209
|
*/
|
|
192
210
|
set layerId(value) {
|
|
@@ -12,6 +12,20 @@ const onDrawEndMethod = (EoxDrawTool) => {
|
|
|
12
12
|
EoxDrawTool.draw.setActive(false); // Deactivate drawing
|
|
13
13
|
EoxDrawTool.selectionEvents.removeSelectionEvent();
|
|
14
14
|
EoxDrawTool.currentlyDrawing = false; // Update drawing status flag
|
|
15
|
+
} else {
|
|
16
|
+
if (EoxDrawTool.continuous) {
|
|
17
|
+
// the selection event selects the feature after draw ends
|
|
18
|
+
if (!EoxDrawTool.layerId) {
|
|
19
|
+
EoxDrawTool.drawLayer.getSource().clear(true);
|
|
20
|
+
EoxDrawTool.drawnFeatures = [];
|
|
21
|
+
} else {
|
|
22
|
+
const features = EoxDrawTool.drawLayer.getSource().getFeatures();
|
|
23
|
+
const latest = features.at(-1);
|
|
24
|
+
EoxDrawTool.drawLayer.getSource().clear(true);
|
|
25
|
+
EoxDrawTool.drawLayer.getSource().addFeature(latest);
|
|
26
|
+
EoxDrawTool.drawnFeatures = [latest];
|
|
27
|
+
}
|
|
28
|
+
}
|
|
15
29
|
}
|
|
16
30
|
};
|
|
17
31
|
|
|
@@ -17,6 +17,9 @@ export class EOxDrawTools extends LitElement {
|
|
|
17
17
|
state: boolean;
|
|
18
18
|
type: BooleanConstructor;
|
|
19
19
|
};
|
|
20
|
+
continuous: {
|
|
21
|
+
type: BooleanConstructor;
|
|
22
|
+
};
|
|
20
23
|
draw: {
|
|
21
24
|
attribute: boolean;
|
|
22
25
|
state: boolean;
|
|
@@ -99,8 +102,7 @@ export class EOxDrawTools extends LitElement {
|
|
|
99
102
|
*/
|
|
100
103
|
drawLayer: import("ol/layer/Vector").default;
|
|
101
104
|
/**
|
|
102
|
-
*
|
|
103
|
-
*
|
|
105
|
+
* Enables selection mode for the passed layer
|
|
104
106
|
* @type {string}
|
|
105
107
|
*/
|
|
106
108
|
set layerId(value: string);
|
|
@@ -174,6 +176,13 @@ export class EOxDrawTools extends LitElement {
|
|
|
174
176
|
* @type {Boolean}
|
|
175
177
|
*/
|
|
176
178
|
noShadow: boolean;
|
|
179
|
+
/**
|
|
180
|
+
* Enables the user to draw continuously one feature after another
|
|
181
|
+
* without having to discard previous ones manually
|
|
182
|
+
* @type {boolean}
|
|
183
|
+
*/
|
|
184
|
+
set continuous(value: boolean);
|
|
185
|
+
get continuous(): boolean;
|
|
177
186
|
/**
|
|
178
187
|
* @onClick Event handler triggered to start drawing on the map.
|
|
179
188
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../../../src/main.js"],"names":[],"mappings":"AAmBA;;;;GAIG;AACH;IAEE
|
|
1
|
+
{"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../../../src/main.js"],"names":[],"mappings":"AAmBA;;;;GAIG;AACH;IAEE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MAsBC;IA6BC;;OAEG;IACH,qBAAwB;IAExB;;;;;OAKG;IACH,KAFU,SAAO,WAAW,CAER;IAEpB;;OAEG;IACH,0BAA6B;IAE7B;;;OAGG;IACH,MAFS,OAAO,gBAAgB,EAAE,IAAI,GAAG,OAAO,UAAU,EAAE,MAAM,CAAC,oBAAoB,CAAC,CAAC,MAAM,CAAC,CAEhF;IAEhB;;;OAGG;IAEH,WAHS,OAAO,iBAAiB,EAAE,OAAO,CAGrB;IAmGvB;;;OAGG;IACH,2BAGC;IAED,sBAEC;IAvGC;;;OAGG;IACH,eAFS,KAAK,CAAC,OAAO,IAAI,EAAE,OAAO,CAAC,CAEb;IAEvB;;;;;;;OAOG;IACH,eANU;QACP,KAAK,CAAC,EAAE,OAAO,eAAe,EAAE,aAAa,CAAA;QAC7C,KAAK,CAAC,EAAE,OAAO,eAAe,EAAE,aAAa,CAAA;QAC7C,KAAK,CAAC,EAAE,OAAO,eAAe,EAAE,aAAa,CAAA;KAC5C,GAAG,IAAI,CAEc;IAEzB;;;OAGG;IACH,QAFS,OAAO,gBAAgB,EAAE,MAAM,CAEtB;IAElB;;OAEG;IACH,0BAA6B;IAE7B;;OAEG;IACH,wBAA2B;IAE3B;;OAEG;IACH,oBAAuB;IAEvB;;OAEG;IACH,kBAAqB;IACrB;;OAEG;IACH,mBAA6B;IAE7B;;;OAGG;IACH,MAFU,SAAS,GAAG,OAAO,GAAG,YAAY,GAAG,QAAQ,GAAG,KAAK,CAE1C;IAErB;;OAEG;IACH,iBAFU,UAAU,CAAC,cAAc,sCAAsC,EAAE,OAAO,CAAC,CAExD;IAE3B;;;;;OAKG;IACH,QAFU,SAAS,GAAE,SAAS,GAAG,KAAK,CAEf;IAEvB;;OAEG;IACH,kBAAqB;IAErB;;;;OAIG;IACH,kBAAqB;IAGvB;;;;OAIG;IACH,+BAGC;IAED,0BAEC;IAeD;;OAEG;IACH,qBAEC;IAED;;;OAGG;IACH,uBAEC;IAED;;;OAGG;IACH,0BAHW,MAAM,oBACN,OAAO,QASjB;IAED;;OAEG;IACH,uBAFW,SAAS,QAInB;IAED;;OAEG;IACH,oBAEC;IAED;;OAEG;IACH,sBAMC;IAED;;OAEG;IACH,0BAaC;IASD;;;;OAIG;IACH,qBAUC;IAcD,6CAIC;IARD,wCAEC;IAVD,sCAMC;IAiBD,+CA4CC;;CACF;2BA7XyC,KAAK"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"on-draw-end.d.ts","sourceRoot":"","sources":["../../../../../src/methods/draw/on-draw-end.js"],"names":[],"mappings":";AAAA;;;;;GAKG;AACH,8CAFW,OAAO,YAAY,EAAE,YAAY,
|
|
1
|
+
{"version":3,"file":"on-draw-end.d.ts","sourceRoot":"","sources":["../../../../../src/methods/draw/on-draw-end.js"],"names":[],"mappings":";AAAA;;;;;GAKG;AACH,8CAFW,OAAO,YAAY,EAAE,YAAY,QA8B3C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generate.d.ts","sourceRoot":"","sources":["../../../../../map/src/helpers/generate.js"],"names":[],"mappings":"AAmEA;;;;;;;GAOG;AACH,oCALW,OAAO,SAAS,EAAE,MAAM,SACxB,QAAQ,uBACR,OAAO,YAAC,OAkGlB;AAyBD;;;;;;;;;GASG;AACH,oCAPW,OAAO,SAAS,EAAE,MAAM,sBACxB,QAAQ,iBACR,OAAO,eAAe,EAAE,OAAO,GAC7B,OAAO,eAAe,EAAE,OAAO,
|
|
1
|
+
{"version":3,"file":"generate.d.ts","sourceRoot":"","sources":["../../../../../map/src/helpers/generate.js"],"names":[],"mappings":"AAmEA;;;;;;;GAOG;AACH,oCALW,OAAO,SAAS,EAAE,MAAM,SACxB,QAAQ,uBACR,OAAO,YAAC,OAkGlB;AAyBD;;;;;;;;;GASG;AACH,oCAPW,OAAO,SAAS,EAAE,MAAM,sBACxB,QAAQ,iBACR,OAAO,eAAe,EAAE,OAAO,GAC7B,OAAO,eAAe,EAAE,OAAO,CAkM3C;AASM,uCAJI,OAAO,SAAS,EAAE,MAAM,cACxB,KAAK,CAAC,QAAQ,CAAC,GACb,KAAK,CAAC,QAAQ,CAAC,CAO3B;qBAlYY,OAAO,SAAS,EAAE,MAAM;uBACxB,OAAO,UAAU,EAAE,QAAQ;uBAC3B,OAAO,UAAU,EAAE,QAAQ;0BAC3B,OAAO,UAAU,EAAE,WAAW;6BAC9B,OAAO,UAAU,EAAE,cAAc;0BACjC,OAAO,UAAU,EAAE,WAAW;4BAC9B,OAAO,UAAU,EAAE,aAAa;iCAChC,OAAO,UAAU,EAAE,kBAAkB;sCACrC,OAAO,UAAU,EAAE,uBAAuB"}
|