@eox/drawtools 1.5.0 → 1.7.0
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 +1047 -975
- package/dist/eox-drawtools.umd.cjs +65 -65
- package/package.json +6 -6
- package/src/components/list.js +1 -1
- package/src/helpers/generate-upload-events.js +1 -1
- package/src/main.js +36 -12
- package/src/methods/draw/create-select-handler.js +7 -3
- package/src/methods/draw/discard-drawing.js +2 -2
- package/src/methods/draw/index.js +1 -0
- package/src/methods/draw/init-layer.js +5 -2
- package/src/methods/draw/on-draw-end.js +2 -2
- package/src/methods/draw/on-key-down.js +4 -4
- package/src/methods/draw/stop-drawing.js +15 -0
- package/src/methods/list/delete-feature.js +1 -1
- package/src/methods/list/hover-feature.js +1 -1
- package/types/components/list.d.ts +1 -1
- package/types/components/list.d.ts.map +1 -1
- package/types/main.d.ts +16 -7
- package/types/main.d.ts.map +1 -1
- package/types/methods/draw/create-select-handler.d.ts.map +1 -1
- package/types/methods/draw/discard-drawing.d.ts +1 -1
- package/types/methods/draw/discard-drawing.d.ts.map +1 -1
- package/types/methods/draw/index.d.ts +1 -0
- package/types/methods/draw/init-layer.d.ts +1 -1
- package/types/methods/draw/init-layer.d.ts.map +1 -1
- package/types/methods/draw/on-draw-end.d.ts +1 -1
- package/types/methods/draw/on-draw-end.d.ts.map +1 -1
- package/types/methods/draw/on-key-down.d.ts.map +1 -1
- package/types/methods/draw/stop-drawing.d.ts +9 -0
- package/types/methods/draw/stop-drawing.d.ts.map +1 -0
- package/types/methods/list/hover-feature.d.ts +1 -1
- package/types/methods/list/hover-feature.d.ts.map +1 -1
package/package.json
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eox/drawtools",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.7.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "git@github.com:EOX-A/EOxElements.git"
|
|
8
8
|
},
|
|
9
9
|
"devDependencies": {
|
|
10
|
-
"@eox/map": "
|
|
11
|
-
"vite": "^8.
|
|
10
|
+
"@eox/map": "2.11.0",
|
|
11
|
+
"vite": "^8.3.5"
|
|
12
12
|
},
|
|
13
13
|
"engines": {
|
|
14
14
|
"npm": ">=8.0.0",
|
|
@@ -38,9 +38,9 @@
|
|
|
38
38
|
"watch": "vite build --watch"
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@eox/elements-utils": "^1.
|
|
41
|
+
"@eox/elements-utils": "^1.3.0",
|
|
42
42
|
"@eox/ui": "^1.1.0",
|
|
43
|
-
"lit": "^3.
|
|
44
|
-
"ol": "^10.
|
|
43
|
+
"lit": "^3.3.3",
|
|
44
|
+
"ol": "^10.10.0"
|
|
45
45
|
}
|
|
46
46
|
}
|
package/src/components/list.js
CHANGED
|
@@ -131,7 +131,7 @@ export class EOxDrawToolsList extends LitElement {
|
|
|
131
131
|
/**
|
|
132
132
|
*
|
|
133
133
|
* @param {number | string | undefined} featureId - The ID of the feature to hover.
|
|
134
|
-
* @param {
|
|
134
|
+
* @param {boolean} mouseOut - Flag indicating mouse out event.
|
|
135
135
|
*/
|
|
136
136
|
_handleHoverFeature(featureId, mouseOut = false) {
|
|
137
137
|
hoverFeatureMethod(this, featureId, mouseOut);
|
|
@@ -85,6 +85,6 @@ function importFile(file, EOxDrawTool) {
|
|
|
85
85
|
// Define the onloadend event handler
|
|
86
86
|
reader.onloadend = function () {
|
|
87
87
|
if (typeof reader.result === "string")
|
|
88
|
-
EOxDrawTool.handleFeatureChange(reader.result);
|
|
88
|
+
EOxDrawTool.handleFeatureChange(reader.result, false, true, true);
|
|
89
89
|
};
|
|
90
90
|
}
|
package/src/main.js
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { LitElement, html, nothing } from "lit";
|
|
2
|
+
import { dispatchElementEvent } from "@eox/elements-utils";
|
|
2
3
|
import "./components/list";
|
|
3
4
|
import "./components/controller";
|
|
4
5
|
import { styleEOX } from "./style.eox";
|
|
5
6
|
import {
|
|
6
7
|
startDrawingMethod,
|
|
8
|
+
stopDrawingMethod,
|
|
7
9
|
initLayerMethod,
|
|
8
10
|
discardDrawingMethod,
|
|
9
11
|
emitDrawnFeaturesMethod,
|
|
@@ -41,6 +43,7 @@ import {
|
|
|
41
43
|
* ## Methods
|
|
42
44
|
*
|
|
43
45
|
* - `startDrawing`: Triggers starting the drawing interaction on the map.
|
|
46
|
+
* - `stopDrawing`: Triggers stopping the drawing interaction on the map (same as pressing the Escape key).
|
|
44
47
|
* - `discardDrawing`: Triggers discarding/stopping the drawing interaction and deleting the drawn shapes.
|
|
45
48
|
* - `removeFeature`: Removes a feature from the drawn features.
|
|
46
49
|
* - `removeFeatureByIndex`: Removes a feature from the drawn features by its index.
|
|
@@ -49,6 +52,7 @@ import {
|
|
|
49
52
|
*
|
|
50
53
|
* @element eox-drawtools
|
|
51
54
|
* @fires {CustomEvent} drawupdate - Fires whenever features are added, modified or discarded
|
|
55
|
+
* @fires {CustomEvent<import("@eox/elements-utils").EOxActivityDetail>} eox:activity - Fires on genuine user interactions, wrapping the original event for analytics tracking.
|
|
52
56
|
*/
|
|
53
57
|
export class EOxDrawTools extends LitElement {
|
|
54
58
|
// Define properties with defaults and types
|
|
@@ -130,7 +134,7 @@ export class EOxDrawTools extends LitElement {
|
|
|
130
134
|
* Query selector of an `eox-map` (`String`, passed as an attribute or property)
|
|
131
135
|
* or an `eox-map` DOM element (`HTMLElement`, passed as property)
|
|
132
136
|
*
|
|
133
|
-
* @type {
|
|
137
|
+
* @type {string | HTMLElement}
|
|
134
138
|
*/
|
|
135
139
|
this.for = "eox-map";
|
|
136
140
|
|
|
@@ -242,7 +246,7 @@ export class EOxDrawTools extends LitElement {
|
|
|
242
246
|
/**
|
|
243
247
|
* Renders the element without a shadow root
|
|
244
248
|
*
|
|
245
|
-
* @type {
|
|
249
|
+
* @type {boolean}
|
|
246
250
|
*/
|
|
247
251
|
this.noShadow = false;
|
|
248
252
|
}
|
|
@@ -328,11 +332,19 @@ export class EOxDrawTools extends LitElement {
|
|
|
328
332
|
startDrawingMethod(this);
|
|
329
333
|
}
|
|
330
334
|
|
|
335
|
+
/**
|
|
336
|
+
* Triggers stopping the drawing interaction on the map (same as pressing the Escape key).
|
|
337
|
+
*/
|
|
338
|
+
stopDrawing() {
|
|
339
|
+
stopDrawingMethod(this);
|
|
340
|
+
}
|
|
341
|
+
|
|
331
342
|
/**
|
|
332
343
|
* Triggers discarding/stopping the drawing interaction and deleting the drawn shapes.
|
|
344
|
+
* @param {boolean} [isUser=false]
|
|
333
345
|
*/
|
|
334
|
-
discardDrawing() {
|
|
335
|
-
discardDrawingMethod(this);
|
|
346
|
+
discardDrawing(isUser = false) {
|
|
347
|
+
discardDrawingMethod(this, isUser);
|
|
336
348
|
}
|
|
337
349
|
|
|
338
350
|
/**
|
|
@@ -353,17 +365,24 @@ export class EOxDrawTools extends LitElement {
|
|
|
353
365
|
|
|
354
366
|
/**
|
|
355
367
|
* @param {string} text - The string representation of the features to be parsed.
|
|
356
|
-
* @param {boolean} replaceFeatures - A boolean flag indicating whether to replace the existing features.
|
|
357
|
-
* @param {boolean} animate - A boolean flag indicating whether to animate the map on feature change.
|
|
368
|
+
* @param {boolean} [replaceFeatures=false] - A boolean flag indicating whether to replace the existing features.
|
|
369
|
+
* @param {boolean} [animate=true] - A boolean flag indicating whether to animate the map on feature change.
|
|
370
|
+
* @param {boolean} [isUser=false] - Whether the change was user-initiated.
|
|
358
371
|
* @ignore
|
|
359
372
|
*/
|
|
360
|
-
handleFeatureChange(
|
|
373
|
+
handleFeatureChange(
|
|
374
|
+
text,
|
|
375
|
+
replaceFeatures = false,
|
|
376
|
+
animate = true,
|
|
377
|
+
isUser = false,
|
|
378
|
+
) {
|
|
361
379
|
this.eoxMap.parseTextToFeature(
|
|
362
380
|
text || JSON.stringify(DUMMY_GEO_JSON),
|
|
363
381
|
this.drawLayer,
|
|
364
382
|
this.eoxMap,
|
|
365
383
|
replaceFeatures,
|
|
366
384
|
animate,
|
|
385
|
+
isUser,
|
|
367
386
|
);
|
|
368
387
|
}
|
|
369
388
|
|
|
@@ -380,7 +399,7 @@ export class EOxDrawTools extends LitElement {
|
|
|
380
399
|
* @ignore
|
|
381
400
|
*/
|
|
382
401
|
onModifyEnd() {
|
|
383
|
-
this.emitDrawnFeatures();
|
|
402
|
+
this.emitDrawnFeatures(true);
|
|
384
403
|
}
|
|
385
404
|
|
|
386
405
|
/**
|
|
@@ -397,9 +416,10 @@ export class EOxDrawTools extends LitElement {
|
|
|
397
416
|
|
|
398
417
|
/**
|
|
399
418
|
* Triggers different events when the drawing of a shape is completed.
|
|
419
|
+
* @param {boolean} [isUser=false]
|
|
400
420
|
* @ignore
|
|
401
421
|
*/
|
|
402
|
-
emitDrawnFeatures() {
|
|
422
|
+
emitDrawnFeatures(isUser = false) {
|
|
403
423
|
/**
|
|
404
424
|
* @param {import("./methods/draw/emit-drawn-features").EmitFormat} value
|
|
405
425
|
*/
|
|
@@ -409,7 +429,11 @@ export class EOxDrawTools extends LitElement {
|
|
|
409
429
|
* is the `drawnFeatures` array
|
|
410
430
|
* @type Array<import("ol").Feature>
|
|
411
431
|
*/
|
|
412
|
-
this
|
|
432
|
+
dispatchElementEvent(this, "drawupdate", {
|
|
433
|
+
detail: value,
|
|
434
|
+
activity: isUser,
|
|
435
|
+
action: "drawupdate",
|
|
436
|
+
});
|
|
413
437
|
};
|
|
414
438
|
emitDrawnFeaturesMethod(this, drawUpdateEvent);
|
|
415
439
|
}
|
|
@@ -525,9 +549,9 @@ export class EOxDrawTools extends LitElement {
|
|
|
525
549
|
<eox-drawtools-controller
|
|
526
550
|
.drawFunc=${{
|
|
527
551
|
start: () => this.startDrawing(),
|
|
528
|
-
discard: () => this.discardDrawing(),
|
|
552
|
+
discard: () => this.discardDrawing(true),
|
|
529
553
|
editor: (/** @type {{ target: { value: string; }; }} */ evt) =>
|
|
530
|
-
this.handleFeatureChange(evt.target.value, true),
|
|
554
|
+
this.handleFeatureChange(evt.target.value, true, true, true),
|
|
531
555
|
import: (/** @type {DragEvent} */ evt) => this.handleFilesChange(evt),
|
|
532
556
|
}}
|
|
533
557
|
?select=${!!this.layerId}
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
* @param {import("../../main").EOxDrawTools} EoxDrawTool - The drawing tool instance.
|
|
4
4
|
*/
|
|
5
5
|
import { toFeature } from "ol/render/Feature";
|
|
6
|
+
import { dispatchElementEvent } from "@eox/elements-utils";
|
|
6
7
|
|
|
7
8
|
const createSelectHandler = (EoxDrawTool) => {
|
|
8
9
|
/**
|
|
@@ -21,9 +22,12 @@ const createSelectHandler = (EoxDrawTool) => {
|
|
|
21
22
|
e.detail.feature = toFeature(e.detail.feature);
|
|
22
23
|
}
|
|
23
24
|
EoxDrawTool.drawLayer.getSource().addFeature(e.detail.feature);
|
|
24
|
-
EoxDrawTool.eoxMap
|
|
25
|
-
|
|
26
|
-
|
|
25
|
+
const event = dispatchElementEvent(EoxDrawTool.eoxMap, "addfeatures", {
|
|
26
|
+
detail: e.detail,
|
|
27
|
+
activity: false,
|
|
28
|
+
action: "addfeatures",
|
|
29
|
+
});
|
|
30
|
+
event.isUser = true;
|
|
27
31
|
};
|
|
28
32
|
|
|
29
33
|
/**
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*
|
|
5
5
|
* @param {import("../../main").EOxDrawTools} EoxDrawTool - The drawing tool instance.
|
|
6
6
|
*/
|
|
7
|
-
const discardDrawingMethod = (EoxDrawTool) => {
|
|
7
|
+
const discardDrawingMethod = (EoxDrawTool, isUser = false) => {
|
|
8
8
|
// Function to discard drawing interactions and features
|
|
9
9
|
const discardDrawingActions = () => {
|
|
10
10
|
// Reset drawnFeatures, deactivate drawing, and clear drawLayer's source
|
|
@@ -19,7 +19,7 @@ const discardDrawingMethod = (EoxDrawTool) => {
|
|
|
19
19
|
|
|
20
20
|
// Function to trigger updates after discarding drawing
|
|
21
21
|
const triggerUpdates = () => {
|
|
22
|
-
EoxDrawTool.emitDrawnFeatures();
|
|
22
|
+
EoxDrawTool.emitDrawnFeatures(isUser);
|
|
23
23
|
EoxDrawTool.currentlyDrawing = false;
|
|
24
24
|
EoxDrawTool.requestUpdate();
|
|
25
25
|
};
|
|
@@ -10,6 +10,7 @@ export { default as initSelection } from "./init-selection"; // Initializes sele
|
|
|
10
10
|
export { default as handleLayerId } from "./handle-layer-id"; // handle switching between selection and drawing
|
|
11
11
|
export { default as initMeasuring, updateMeasure } from "./init-measuring"; // Initializes measuring logic
|
|
12
12
|
export { default as onKeyDownMethod } from "./on-key-down.js"; // Handles keydown events
|
|
13
|
+
export { default as stopDrawingMethod } from "./stop-drawing.js"; // Stops the drawing process
|
|
13
14
|
export {
|
|
14
15
|
removeFeatureMethod,
|
|
15
16
|
removeFeatureByIndexMethod,
|
|
@@ -8,7 +8,7 @@ import { getElement } from "@eox/elements-utils";
|
|
|
8
8
|
* Initializes the draw layer, interacts with the map, and returns map instances.
|
|
9
9
|
*
|
|
10
10
|
* @param {import("../../main").EOxDrawTools} EoxDrawTool - The drawing tool instance.
|
|
11
|
-
* @param {
|
|
11
|
+
* @param {boolean} multipleFeatures - Allow adding more than one feature at a time
|
|
12
12
|
*/
|
|
13
13
|
const initLayerMethod = (EoxDrawTool, multipleFeatures) => {
|
|
14
14
|
const mapQuery = getElement(EoxDrawTool.for);
|
|
@@ -122,7 +122,10 @@ const initLayerMethod = (EoxDrawTool, multipleFeatures) => {
|
|
|
122
122
|
}
|
|
123
123
|
|
|
124
124
|
const onModifyEnd = () => EoxDrawTool.onModifyEnd();
|
|
125
|
-
const onAddFeatures = () =>
|
|
125
|
+
const onAddFeatures = (evt) => {
|
|
126
|
+
const isUser = Boolean(/** @type {any} */ (evt)?.isUser);
|
|
127
|
+
onDrawEndMethod(EoxDrawTool, isUser);
|
|
128
|
+
};
|
|
126
129
|
|
|
127
130
|
EoxDrawTool.modify?.on("modifyend", onModifyEnd);
|
|
128
131
|
|
|
@@ -4,10 +4,10 @@
|
|
|
4
4
|
*
|
|
5
5
|
* @param {import("../../main").EOxDrawTools} EoxDrawTool - The drawing tool instance.
|
|
6
6
|
*/
|
|
7
|
-
const onDrawEndMethod = (EoxDrawTool) => {
|
|
7
|
+
const onDrawEndMethod = (EoxDrawTool, isUser = false) => {
|
|
8
8
|
// Function to handle actions when drawing ends
|
|
9
9
|
const handleDrawEnd = () => {
|
|
10
|
-
EoxDrawTool.emitDrawnFeatures(); // Emit drawn features
|
|
10
|
+
EoxDrawTool.emitDrawnFeatures(isUser); // Emit drawn features
|
|
11
11
|
if (!EoxDrawTool.multipleFeatures) {
|
|
12
12
|
EoxDrawTool.draw?.setActive(false); // Deactivate drawing
|
|
13
13
|
EoxDrawTool.selectionEvents.removeSelectionEvent();
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import stopDrawingMethod from "./stop-drawing";
|
|
2
|
+
|
|
1
3
|
/**
|
|
2
4
|
* Handles keydown events for the drawing tool.
|
|
3
5
|
* Specifically, it aborts the drawing process when the Escape key is pressed.
|
|
@@ -6,10 +8,8 @@
|
|
|
6
8
|
* @param {import("../../main").EOxDrawTools} EoxDrawTool - The drawing tool instance.
|
|
7
9
|
*/
|
|
8
10
|
const onKeyDownMethod = (event, EoxDrawTool) => {
|
|
9
|
-
if (event.key === "Escape"
|
|
10
|
-
EoxDrawTool
|
|
11
|
-
EoxDrawTool.currentlyDrawing = false;
|
|
12
|
-
EoxDrawTool.requestUpdate();
|
|
11
|
+
if (event.key === "Escape") {
|
|
12
|
+
stopDrawingMethod(EoxDrawTool);
|
|
13
13
|
}
|
|
14
14
|
};
|
|
15
15
|
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Stops the drawing interaction on the map.
|
|
3
|
+
* This mimics the behavior of pressing the Escape key.
|
|
4
|
+
*
|
|
5
|
+
* @param {import("../../main").EOxDrawTools} EoxDrawTool - The drawing tool instance.
|
|
6
|
+
*/
|
|
7
|
+
const stopDrawingMethod = (EoxDrawTool) => {
|
|
8
|
+
if (EoxDrawTool.currentlyDrawing) {
|
|
9
|
+
EoxDrawTool.draw?.setActive(false);
|
|
10
|
+
EoxDrawTool.currentlyDrawing = false;
|
|
11
|
+
EoxDrawTool.requestUpdate();
|
|
12
|
+
}
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export default stopDrawingMethod;
|
|
@@ -16,7 +16,7 @@ const deleteFeatureMethod = (evt, EoxDrawToolList, EoxDrawTool) => {
|
|
|
16
16
|
// Remove the feature from the draw layer and update the drawnFeatures array
|
|
17
17
|
EoxDrawToolList.drawLayer.getSource().removeFeature(feature);
|
|
18
18
|
EoxDrawToolList.drawnFeatures.splice(index, 1);
|
|
19
|
-
EoxDrawTool.emitDrawnFeatures();
|
|
19
|
+
EoxDrawTool.emitDrawnFeatures(true);
|
|
20
20
|
|
|
21
21
|
// Request an update to reflect the changes
|
|
22
22
|
EoxDrawToolList.requestUpdate();
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* @param {import("../../components/list").EOxDrawToolsList} EoxDrawToolList - The list of drawn features.
|
|
5
5
|
* @param {number | string | undefined} featureId - The ID of the feature to hover.
|
|
6
|
-
* @param {
|
|
6
|
+
* @param {boolean} mouseOut - Flag indicating mouse out event.
|
|
7
7
|
*/
|
|
8
8
|
const hoverFeatureMethod = (EoxDrawToolList, featureId, mouseOut) => {
|
|
9
9
|
// Check if the feature is currently clicked; if so, don't perform hover effect
|
|
@@ -127,7 +127,7 @@ export class EOxDrawToolsList extends LitElement {
|
|
|
127
127
|
/**
|
|
128
128
|
*
|
|
129
129
|
* @param {number | string | undefined} featureId - The ID of the feature to hover.
|
|
130
|
-
* @param {
|
|
130
|
+
* @param {boolean} mouseOut - Flag indicating mouse out event.
|
|
131
131
|
*/
|
|
132
132
|
_handleHoverFeature(featureId: number | string | undefined, mouseOut?: boolean): void;
|
|
133
133
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../../src/components/list.js"],"names":[],"mappings":"AASA;;;;GAIG;AACH;IACE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MAWE;IAEF;;OAEG;IACH,kBAFU,GAAyB,CAAC,oBAAoB,CAAC,CAAC,MAAM,CAAC,CAEhD;IAEjB;;OAEG;IACH,kBAFU,GAAyB,CAAC,oBAAoB,CAAC,CAAC,MAAM,CAAC,CAEhD;IAEjB;;OAEG;IACH,SAFS,MAAM,GAAG,MAAM,CAEhB;IAER;;OAEG;IACH,SAFS,MAAM,GAAG,MAAM,CAEhB;IAKN;;OAEG;IACH,cAFS,OAAO,SAAS,EAAE,YAAY,CAEf;IAExB;;OAEG;IACH,YAAkB;IAElB;;OAEG;IACH,OAFS,OAAO,IAAI,EAAE,GAAG,CAER;IAEjB;;;OAGG;IAEH,MAHS,OAAO,gBAAgB,EAAE,IAAI,CAGtB;IAEhB;;;OAGG;IAEH,WAHS,OAAO,UAAU,EAAE,MAAM,CAAC,OAAO,WAAW,EAAE,MAAM,CAAC,CAGzC;IAErB;;;;;OAKG;IACH,eAFS,KAAK,CAAC,OAAO,IAAI,EAAE,OAAO,CAAC,CAEb;IAEvB;;OAEG;IACH,oBAA4B;IAE5B;;OAEG;IACH,oBAA0B;IAE1B;;;OAGG;IAEH,QAHS,OAAO,gBAAgB,EAAE,MAAM,CAGtB;IAElB;;OAEG;IACH,kBAAqB;IAGvB;;;;OAIG;IACH,mBAFW,KAAK,GAAG;QAAE,MAAM,EAAE,iBAAiB,CAAA;KAAE,QAK/C;IAED;;;;OAIG;IACH,yCAFW,OAAO,IAAI,EAAE,OAAO,QAI9B;IAED;;;;OAIG;IACH,+BAHW,MAAM,GAAG,MAAM,GAAG,SAAS,
|
|
1
|
+
{"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../../src/components/list.js"],"names":[],"mappings":"AASA;;;;GAIG;AACH;IACE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MAWE;IAEF;;OAEG;IACH,kBAFU,GAAyB,CAAC,oBAAoB,CAAC,CAAC,MAAM,CAAC,CAEhD;IAEjB;;OAEG;IACH,kBAFU,GAAyB,CAAC,oBAAoB,CAAC,CAAC,MAAM,CAAC,CAEhD;IAEjB;;OAEG;IACH,SAFS,MAAM,GAAG,MAAM,CAEhB;IAER;;OAEG;IACH,SAFS,MAAM,GAAG,MAAM,CAEhB;IAKN;;OAEG;IACH,cAFS,OAAO,SAAS,EAAE,YAAY,CAEf;IAExB;;OAEG;IACH,YAAkB;IAElB;;OAEG;IACH,OAFS,OAAO,IAAI,EAAE,GAAG,CAER;IAEjB;;;OAGG;IAEH,MAHS,OAAO,gBAAgB,EAAE,IAAI,CAGtB;IAEhB;;;OAGG;IAEH,WAHS,OAAO,UAAU,EAAE,MAAM,CAAC,OAAO,WAAW,EAAE,MAAM,CAAC,CAGzC;IAErB;;;;;OAKG;IACH,eAFS,KAAK,CAAC,OAAO,IAAI,EAAE,OAAO,CAAC,CAEb;IAEvB;;OAEG;IACH,oBAA4B;IAE5B;;OAEG;IACH,oBAA0B;IAE1B;;;OAGG;IAEH,QAHS,OAAO,gBAAgB,EAAE,MAAM,CAGtB;IAElB;;OAEG;IACH,kBAAqB;IAGvB;;;;OAIG;IACH,mBAFW,KAAK,GAAG;QAAE,MAAM,EAAE,iBAAiB,CAAA;KAAE,QAK/C;IAED;;;;OAIG;IACH,yCAFW,OAAO,IAAI,EAAE,OAAO,QAI9B;IAED;;;;OAIG;IACH,+BAHW,MAAM,GAAG,MAAM,GAAG,SAAS,aAC3B,OAAO,QAIjB;IAED;;OAEG;IACH,qBAEC;IAED;;OAEG;IACH,yBAEC;IAED,+CAwEC;CACF;2BAlOyC,KAAK"}
|
package/types/main.d.ts
CHANGED
|
@@ -20,6 +20,7 @@
|
|
|
20
20
|
* ## Methods
|
|
21
21
|
*
|
|
22
22
|
* - `startDrawing`: Triggers starting the drawing interaction on the map.
|
|
23
|
+
* - `stopDrawing`: Triggers stopping the drawing interaction on the map (same as pressing the Escape key).
|
|
23
24
|
* - `discardDrawing`: Triggers discarding/stopping the drawing interaction and deleting the drawn shapes.
|
|
24
25
|
* - `removeFeature`: Removes a feature from the drawn features.
|
|
25
26
|
* - `removeFeatureByIndex`: Removes a feature from the drawn features by its index.
|
|
@@ -28,6 +29,7 @@
|
|
|
28
29
|
*
|
|
29
30
|
* @element eox-drawtools
|
|
30
31
|
* @fires {CustomEvent} drawupdate - Fires whenever features are added, modified or discarded
|
|
32
|
+
* @fires {CustomEvent<import("@eox/elements-utils").EOxActivityDetail>} eox:activity - Fires on genuine user interactions, wrapping the original event for analytics tracking.
|
|
31
33
|
*/
|
|
32
34
|
export class EOxDrawTools extends LitElement {
|
|
33
35
|
static get properties(): {
|
|
@@ -122,7 +124,7 @@ export class EOxDrawTools extends LitElement {
|
|
|
122
124
|
* Query selector of an `eox-map` (`String`, passed as an attribute or property)
|
|
123
125
|
* or an `eox-map` DOM element (`HTMLElement`, passed as property)
|
|
124
126
|
*
|
|
125
|
-
* @type {
|
|
127
|
+
* @type {string | HTMLElement}
|
|
126
128
|
*/
|
|
127
129
|
for: string | HTMLElement;
|
|
128
130
|
/**
|
|
@@ -221,7 +223,7 @@ export class EOxDrawTools extends LitElement {
|
|
|
221
223
|
/**
|
|
222
224
|
* Renders the element without a shadow root
|
|
223
225
|
*
|
|
224
|
-
* @type {
|
|
226
|
+
* @type {boolean}
|
|
225
227
|
*/
|
|
226
228
|
noShadow: boolean;
|
|
227
229
|
/**
|
|
@@ -252,10 +254,15 @@ export class EOxDrawTools extends LitElement {
|
|
|
252
254
|
* Triggers starting the drawing interaction on the map.
|
|
253
255
|
*/
|
|
254
256
|
startDrawing(): void;
|
|
257
|
+
/**
|
|
258
|
+
* Triggers stopping the drawing interaction on the map (same as pressing the Escape key).
|
|
259
|
+
*/
|
|
260
|
+
stopDrawing(): void;
|
|
255
261
|
/**
|
|
256
262
|
* Triggers discarding/stopping the drawing interaction and deleting the drawn shapes.
|
|
263
|
+
* @param {boolean} [isUser=false]
|
|
257
264
|
*/
|
|
258
|
-
discardDrawing(): void;
|
|
265
|
+
discardDrawing(isUser?: boolean): void;
|
|
259
266
|
/**
|
|
260
267
|
* Removes a feature from the drawn features.
|
|
261
268
|
* @param {import("ol").Feature} feature - The feature to remove.
|
|
@@ -268,11 +275,12 @@ export class EOxDrawTools extends LitElement {
|
|
|
268
275
|
removeFeatureByIndex(index: number): void;
|
|
269
276
|
/**
|
|
270
277
|
* @param {string} text - The string representation of the features to be parsed.
|
|
271
|
-
* @param {boolean} replaceFeatures - A boolean flag indicating whether to replace the existing features.
|
|
272
|
-
* @param {boolean} animate - A boolean flag indicating whether to animate the map on feature change.
|
|
278
|
+
* @param {boolean} [replaceFeatures=false] - A boolean flag indicating whether to replace the existing features.
|
|
279
|
+
* @param {boolean} [animate=true] - A boolean flag indicating whether to animate the map on feature change.
|
|
280
|
+
* @param {boolean} [isUser=false] - Whether the change was user-initiated.
|
|
273
281
|
* @ignore
|
|
274
282
|
*/
|
|
275
|
-
handleFeatureChange(text: string, replaceFeatures?: boolean, animate?: boolean): void;
|
|
283
|
+
handleFeatureChange(text: string, replaceFeatures?: boolean, animate?: boolean, isUser?: boolean): void;
|
|
276
284
|
/**
|
|
277
285
|
* @param {DragEvent | InputEvent & { target: HTMLInputElement }} evt - The event object from the file input interaction.
|
|
278
286
|
* @ignore
|
|
@@ -292,9 +300,10 @@ export class EOxDrawTools extends LitElement {
|
|
|
292
300
|
updateGeoJSON(): void;
|
|
293
301
|
/**
|
|
294
302
|
* Triggers different events when the drawing of a shape is completed.
|
|
303
|
+
* @param {boolean} [isUser=false]
|
|
295
304
|
* @ignore
|
|
296
305
|
*/
|
|
297
|
-
emitDrawnFeatures(): void;
|
|
306
|
+
emitDrawnFeatures(isUser?: boolean): void;
|
|
298
307
|
/**
|
|
299
308
|
* initializes the EOxMap and OlMap instances
|
|
300
309
|
* And stores them in the private properties #eoxMap and #olMap, respectively.
|
package/types/main.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../src/main.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../src/main.js"],"names":[],"mappings":"AAuBA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH;IAEE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MAyBC;IA4CC;;OAEG;IACH,qBAAwB;IAExB;;;;;OAKG;IACH,KAFU,MAAM,GAAG,WAAW,CAEV;IAEpB;;OAEG;IACH,0BAA6B;IAE7B;;;OAGG;IACH,MAFS,OAAO,gBAAgB,EAAE,IAAI,GAAG,GAAyB,CAAC,oBAAoB,CAAC,CAAC,MAAM,CAAC,CAEhF;IAEhB;;;OAGG;IAEH,WAHS,OAAO,iBAAiB,EAAE,OAAO,CAGrB;IA8JvB;;;OAGG;IACH,2BAGC;IAED,sBAEC;IAlKC;;OAEG;IACH,oBAA4B;IAE5B;;OAEG;IACH,oBAA0B;IAE1B;;;;;;;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;;;;;OAKG;IACH,iBAAoB;IAEpB;;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,UAFU,OAAO,CAEI;IAGvB;;;;OAIG;IACH,+BAGC;IAED,0BAEC;IAED;;;;OAIG;IACH,mCAHW,KAAK,CAAC,OAAO,IAAI,EAAE,OAAO,CAAC,QAOrC;IAED;;;;OAIG;IACH;;UAyBC;IAED;;SAEC;IAeD;;OAEG;IACH,qBAEC;IAED;;OAEG;IACH,oBAEC;IAED;;;OAGG;IACH,wBAFW,OAAO,QAIjB;IAED;;;OAGG;IACH,uBAFW,OAAO,IAAI,EAAE,OAAO,QAI9B;IAED;;;OAGG;IACH,4BAFW,MAAM,QAIhB;IAED;;;;;;OAMG;IACH,0BANW,MAAM,oBACN,OAAO,YACP,OAAO,WACP,OAAO,QAiBjB;IAED;;;OAGG;IACH,uBAHW,SAAS,IAAG,UAAU,GAAG;QAAE,MAAM,EAAE,gBAAgB,CAAA;KAAE,CAAA,QAK/D;IAED;;;OAGG;IACH,oBAEC;IAED;;;OAGG;IACH,sBAMC;IAED;;;;OAIG;IACH,2BAHW,OAAO,QAoBjB;IAUD;;;;OAIG;IACH,oBAWC;IAHC,iEAAuB;IAkDzB,uBAIC;IAZD;;;OAGG;IACH,kBAEC;IA3CD;;;;;OAKG;IACH,qBAYC;IAED,cAAc;IACd,sCAcC;IAiCD,+CAqDC;;CACF;2BA5kByC,KAAK"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-select-handler.d.ts","sourceRoot":"","sources":["../../../src/methods/draw/create-select-handler.js"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"create-select-handler.d.ts","sourceRoot":"","sources":["../../../src/methods/draw/create-select-handler.js"],"names":[],"mappings":";AAOA;;;EAmDC"}
|
|
@@ -5,5 +5,5 @@ export default discardDrawingMethod;
|
|
|
5
5
|
*
|
|
6
6
|
* @param {import("../../main").EOxDrawTools} EoxDrawTool - The drawing tool instance.
|
|
7
7
|
*/
|
|
8
|
-
declare function discardDrawingMethod(EoxDrawTool: import("../../main").EOxDrawTools): void;
|
|
8
|
+
declare function discardDrawingMethod(EoxDrawTool: import("../../main").EOxDrawTools, isUser?: boolean): void;
|
|
9
9
|
//# sourceMappingURL=discard-drawing.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"discard-drawing.d.ts","sourceRoot":"","sources":["../../../src/methods/draw/discard-drawing.js"],"names":[],"mappings":";AAAA;;;;;GAKG;AACH,mDAFW,OAAO,YAAY,EAAE,YAAY,
|
|
1
|
+
{"version":3,"file":"discard-drawing.d.ts","sourceRoot":"","sources":["../../../src/methods/draw/discard-drawing.js"],"names":[],"mappings":";AAAA;;;;;GAKG;AACH,mDAFW,OAAO,YAAY,EAAE,YAAY,0BAyB3C"}
|
|
@@ -7,6 +7,7 @@ export { default as createSelectHandler } from "./create-select-handler";
|
|
|
7
7
|
export { default as initSelection } from "./init-selection";
|
|
8
8
|
export { default as handleLayerId } from "./handle-layer-id";
|
|
9
9
|
export { default as onKeyDownMethod } from "./on-key-down.js";
|
|
10
|
+
export { default as stopDrawingMethod } from "./stop-drawing.js";
|
|
10
11
|
export { default as initMeasuring, updateMeasure } from "./init-measuring";
|
|
11
12
|
export { removeFeatureMethod, removeFeatureByIndexMethod } from "./remove-feature";
|
|
12
13
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -3,7 +3,7 @@ export default initLayerMethod;
|
|
|
3
3
|
* Initializes the draw layer, interacts with the map, and returns map instances.
|
|
4
4
|
*
|
|
5
5
|
* @param {import("../../main").EOxDrawTools} EoxDrawTool - The drawing tool instance.
|
|
6
|
-
* @param {
|
|
6
|
+
* @param {boolean} multipleFeatures - Allow adding more than one feature at a time
|
|
7
7
|
*/
|
|
8
8
|
declare function initLayerMethod(EoxDrawTool: import("../../main").EOxDrawTools, multipleFeatures: boolean): {
|
|
9
9
|
EoxMap: any;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init-layer.d.ts","sourceRoot":"","sources":["../../../src/methods/draw/init-layer.js"],"names":[],"mappings":";AAMA;;;;;GAKG;AACH,8CAHW,OAAO,YAAY,EAAE,YAAY;;;
|
|
1
|
+
{"version":3,"file":"init-layer.d.ts","sourceRoot":"","sources":["../../../src/methods/draw/init-layer.js"],"names":[],"mappings":";AAMA;;;;;GAKG;AACH,8CAHW,OAAO,YAAY,EAAE,YAAY,oBACjC,OAAO;;;yBAwIL,OAAO,YAAY,EAAE,YAAY;EAqB7C"}
|
|
@@ -5,5 +5,5 @@ export default onDrawEndMethod;
|
|
|
5
5
|
*
|
|
6
6
|
* @param {import("../../main").EOxDrawTools} EoxDrawTool - The drawing tool instance.
|
|
7
7
|
*/
|
|
8
|
-
declare function onDrawEndMethod(EoxDrawTool: import("../../main").EOxDrawTools): void;
|
|
8
|
+
declare function onDrawEndMethod(EoxDrawTool: import("../../main").EOxDrawTools, isUser?: boolean): void;
|
|
9
9
|
//# sourceMappingURL=on-draw-end.d.ts.map
|
|
@@ -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,0BAiC3C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"on-key-down.d.ts","sourceRoot":"","sources":["../../../src/methods/draw/on-key-down.js"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"on-key-down.d.ts","sourceRoot":"","sources":["../../../src/methods/draw/on-key-down.js"],"names":[],"mappings":";AAEA;;;;;;GAMG;AACH,wCAHW,aAAa,eACb,OAAO,YAAY,EAAE,YAAY,QAM3C"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export default stopDrawingMethod;
|
|
2
|
+
/**
|
|
3
|
+
* Stops the drawing interaction on the map.
|
|
4
|
+
* This mimics the behavior of pressing the Escape key.
|
|
5
|
+
*
|
|
6
|
+
* @param {import("../../main").EOxDrawTools} EoxDrawTool - The drawing tool instance.
|
|
7
|
+
*/
|
|
8
|
+
declare function stopDrawingMethod(EoxDrawTool: import("../../main").EOxDrawTools): void;
|
|
9
|
+
//# sourceMappingURL=stop-drawing.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stop-drawing.d.ts","sourceRoot":"","sources":["../../../src/methods/draw/stop-drawing.js"],"names":[],"mappings":";AAAA;;;;;GAKG;AACH,gDAFW,OAAO,YAAY,EAAE,YAAY,QAQ3C"}
|
|
@@ -4,7 +4,7 @@ export default hoverFeatureMethod;
|
|
|
4
4
|
*
|
|
5
5
|
* @param {import("../../components/list").EOxDrawToolsList} EoxDrawToolList - The list of drawn features.
|
|
6
6
|
* @param {number | string | undefined} featureId - The ID of the feature to hover.
|
|
7
|
-
* @param {
|
|
7
|
+
* @param {boolean} mouseOut - Flag indicating mouse out event.
|
|
8
8
|
*/
|
|
9
9
|
declare function hoverFeatureMethod(EoxDrawToolList: import("../../components/list").EOxDrawToolsList, featureId: number | string | undefined, mouseOut: boolean): void;
|
|
10
10
|
//# sourceMappingURL=hover-feature.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hover-feature.d.ts","sourceRoot":"","sources":["../../../src/methods/list/hover-feature.js"],"names":[],"mappings":";AAAA;;;;;;GAMG;AACH,qDAJW,OAAO,uBAAuB,EAAE,gBAAgB,aAChD,MAAM,GAAG,MAAM,GAAG,SAAS,
|
|
1
|
+
{"version":3,"file":"hover-feature.d.ts","sourceRoot":"","sources":["../../../src/methods/list/hover-feature.js"],"names":[],"mappings":";AAAA;;;;;;GAMG;AACH,qDAJW,OAAO,uBAAuB,EAAE,gBAAgB,aAChD,MAAM,GAAG,MAAM,GAAG,SAAS,YAC3B,OAAO,QASjB"}
|