@eox/drawtools 1.4.0 → 1.6.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 +27 -22
- package/dist/eox-drawtools.umd.cjs +2 -2
- package/package.json +2 -2
- package/src/main.js +10 -1
- package/src/methods/draw/index.js +1 -0
- package/src/methods/draw/on-key-down.js +4 -4
- package/src/methods/draw/stop-drawing.js +15 -0
- package/types/main.d.ts +6 -1
- package/types/main.d.ts.map +1 -1
- package/types/methods/draw/index.d.ts +1 -0
- 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/dist/eox-drawtools.js
CHANGED
|
@@ -4136,17 +4136,19 @@ function Sa(e, t) {
|
|
|
4136
4136
|
t && (e.discardDrawing(), e.selectionEvents.removeSelectionEvent(), e.draw = t.interactions.drawInteraction, t.selectInteractions.SelectLayerClickInteraction.remove(), t.selectInteractions.SelectLayerHoverInteraction.remove());
|
|
4137
4137
|
}
|
|
4138
4138
|
//#endregion
|
|
4139
|
-
//#region src/methods/draw/
|
|
4140
|
-
var Ca = (e
|
|
4141
|
-
e.
|
|
4139
|
+
//#region src/methods/draw/stop-drawing.js
|
|
4140
|
+
var Ca = (e) => {
|
|
4141
|
+
e.currentlyDrawing && (e.draw?.setActive(!1), e.currentlyDrawing = !1, e.requestUpdate());
|
|
4142
|
+
}, wa = (e, t) => {
|
|
4143
|
+
e.key === "Escape" && Ca(t);
|
|
4142
4144
|
};
|
|
4143
4145
|
//#endregion
|
|
4144
4146
|
//#region src/methods/draw/remove-feature.js
|
|
4145
|
-
function
|
|
4147
|
+
function Ta(e, t) {
|
|
4146
4148
|
let n = e.drawnFeatures.indexOf(t);
|
|
4147
|
-
n > -1 &&
|
|
4149
|
+
n > -1 && Ea(e, n);
|
|
4148
4150
|
}
|
|
4149
|
-
function
|
|
4151
|
+
function Ea(e, t) {
|
|
4150
4152
|
if (t > -1 && t < e.drawnFeatures.length) {
|
|
4151
4153
|
let n = [...e.drawnFeatures];
|
|
4152
4154
|
n.splice(t, 1), e.drawnFeatures = n, e.emitDrawnFeatures();
|
|
@@ -4154,7 +4156,7 @@ function Ta(e, t) {
|
|
|
4154
4156
|
}
|
|
4155
4157
|
//#endregion
|
|
4156
4158
|
//#region src/helpers/generate-upload-events.js
|
|
4157
|
-
function
|
|
4159
|
+
function Da(e, t) {
|
|
4158
4160
|
function n(e) {
|
|
4159
4161
|
e.preventDefault(), e.stopPropagation();
|
|
4160
4162
|
}
|
|
@@ -4171,17 +4173,17 @@ function Ea(e, t) {
|
|
|
4171
4173
|
"drop"
|
|
4172
4174
|
].forEach((e) => {
|
|
4173
4175
|
t.addEventListener(e, n, !1), ["dragenter", "dragover"].includes(e) ? t.addEventListener(e, r, !1) : t.addEventListener(e, i, !1);
|
|
4174
|
-
}), t.addEventListener("drop", (t) =>
|
|
4176
|
+
}), t.addEventListener("drop", (t) => ka(t, e), !1);
|
|
4175
4177
|
}
|
|
4176
|
-
function
|
|
4178
|
+
function Oa(e) {
|
|
4177
4179
|
e.preventDefault(), e.stopPropagation();
|
|
4178
4180
|
}
|
|
4179
|
-
function
|
|
4180
|
-
|
|
4181
|
+
function ka(e, t) {
|
|
4182
|
+
Oa(e);
|
|
4181
4183
|
let n;
|
|
4182
|
-
n = "dataTransfer" in e && e.dataTransfer ? e.dataTransfer.files : e.target && "files" in e.target ? e.target.files : [], Array.from(n).forEach((e) =>
|
|
4184
|
+
n = "dataTransfer" in e && e.dataTransfer ? e.dataTransfer.files : e.target && "files" in e.target ? e.target.files : [], Array.from(n).forEach((e) => Aa(e, t)), e.target && "value" in e.target && (e.target.value = "");
|
|
4183
4185
|
}
|
|
4184
|
-
function
|
|
4186
|
+
function Aa(e, t) {
|
|
4185
4187
|
let n = new FileReader();
|
|
4186
4188
|
n.readAsText(e), n.onloadend = function() {
|
|
4187
4189
|
typeof n.result == "string" && t.handleFeatureChange(n.result);
|
|
@@ -4189,7 +4191,7 @@ function ka(e, t) {
|
|
|
4189
4191
|
}
|
|
4190
4192
|
//#endregion
|
|
4191
4193
|
//#region src/main.js
|
|
4192
|
-
var
|
|
4194
|
+
var ja = class extends j {
|
|
4193
4195
|
static get properties() {
|
|
4194
4196
|
return {
|
|
4195
4197
|
allowModify: {
|
|
@@ -4228,7 +4230,7 @@ var Aa = class extends j {
|
|
|
4228
4230
|
attribute: "layer-id",
|
|
4229
4231
|
type: String
|
|
4230
4232
|
},
|
|
4231
|
-
featureStyles: {
|
|
4233
|
+
featureStyles: { type: Object },
|
|
4232
4234
|
modify: {
|
|
4233
4235
|
attribute: !1,
|
|
4234
4236
|
state: !0
|
|
@@ -4267,7 +4269,7 @@ var Aa = class extends j {
|
|
|
4267
4269
|
#i = !1;
|
|
4268
4270
|
#a;
|
|
4269
4271
|
#o = [];
|
|
4270
|
-
#s = (e) =>
|
|
4272
|
+
#s = (e) => wa(e, this);
|
|
4271
4273
|
constructor() {
|
|
4272
4274
|
super(), this.allowModify = !1, this.for = "eox-map", this.currentlyDrawing = !1, this.draw = null, this.drawLayer = null, this.layerId = "", this.featureName = "Feature", this.featureNameKey = null, this.featureStyles = null, this.modify = null, this.multipleFeatures = !1, this.measure = !1, this.importFeatures = !1, this.showEditor = !1, this.showList = !1, this.projection = "EPSG:4326", this.type = "Polygon", this.selectionEvents = null, this.format = "feature", this.unstyled = !1, this.noShadow = !1;
|
|
4273
4275
|
}
|
|
@@ -4307,20 +4309,23 @@ var Aa = class extends j {
|
|
|
4307
4309
|
startDrawing() {
|
|
4308
4310
|
pa(this);
|
|
4309
4311
|
}
|
|
4312
|
+
stopDrawing() {
|
|
4313
|
+
Ca(this);
|
|
4314
|
+
}
|
|
4310
4315
|
discardDrawing() {
|
|
4311
4316
|
va(this);
|
|
4312
4317
|
}
|
|
4313
4318
|
removeFeature(e) {
|
|
4314
|
-
|
|
4319
|
+
Ta(this, e);
|
|
4315
4320
|
}
|
|
4316
4321
|
removeFeatureByIndex(e) {
|
|
4317
|
-
|
|
4322
|
+
Ea(this, e);
|
|
4318
4323
|
}
|
|
4319
4324
|
handleFeatureChange(e, t = !1, n = !0) {
|
|
4320
4325
|
this.eoxMap.parseTextToFeature(e || JSON.stringify(Ue), this.drawLayer, this.eoxMap, t, n);
|
|
4321
4326
|
}
|
|
4322
4327
|
handleFilesChange(e) {
|
|
4323
|
-
|
|
4328
|
+
ka(e, this);
|
|
4324
4329
|
}
|
|
4325
4330
|
onModifyEnd() {
|
|
4326
4331
|
this.emitDrawnFeatures();
|
|
@@ -4342,7 +4347,7 @@ var Aa = class extends j {
|
|
|
4342
4347
|
this.resetLayer = n, this.eoxMap = e, this.#t = t;
|
|
4343
4348
|
}
|
|
4344
4349
|
firstUpdated() {
|
|
4345
|
-
this.updateLayer(), this.selectionEvents = ba(this), this.importFeatures &&
|
|
4350
|
+
this.updateLayer(), this.selectionEvents = ba(this), this.importFeatures && Da(this, this.eoxMap), this.drawnFeatures?.length > 0 ? this.drawnFeatures = [...this.drawnFeatures] : this.updateGeoJSON(), this.requestUpdate();
|
|
4346
4351
|
}
|
|
4347
4352
|
updated(e) {
|
|
4348
4353
|
(((t) => e.has(t) && e.get(t) !== void 0)("for") || e.has("type") && e.get("type") !== this.type || e.has("measure") && e.get("measure") !== this.measure) && (this.updateLayer(), this.currentlyDrawing = !1);
|
|
@@ -4414,6 +4419,6 @@ var Aa = class extends j {
|
|
|
4414
4419
|
`;
|
|
4415
4420
|
}
|
|
4416
4421
|
};
|
|
4417
|
-
customElements.define("eox-drawtools",
|
|
4422
|
+
customElements.define("eox-drawtools", ja);
|
|
4418
4423
|
//#endregion
|
|
4419
|
-
export {
|
|
4424
|
+
export { ja as EOxDrawTools };
|
|
@@ -247,7 +247,7 @@
|
|
|
247
247
|
.hidden {
|
|
248
248
|
display: none;
|
|
249
249
|
}
|
|
250
|
-
`,pa=e=>{(()=>{if(e.emitDrawnFeatures(),!e.multipleFeatures)e.draw?.setActive(!1),e.selectionEvents.removeSelectionEvent(),e.currentlyDrawing=!1;else if(e.continuous)if(!e.layerId)e.drawLayer.getSource().clear(),e.drawnFeatures=[];else{let t=e.drawLayer.getSource().getFeatures().at(-1);if(e.drawLayer.getSource().clear(),!t)return;e.drawLayer.getSource().addFeature(t),e.drawnFeatures=[t]}})(),e.requestUpdate()},ma=e=>{e.drawLayer.set(`isDrawingEnabled`,!0),e.draw?.setActive(!0),e.selectionEvents.addSelectionEvent(),e.currentlyDrawing=!0,e.requestUpdate()},ha=(e,t,n)=>{if(!n||!t)return;let r=t.getLayerById(n),i=r?JSON.parse(JSON.stringify(r.get(`_jsonDefinition`))):null;if(!i){console.error(`Layer with id ${n} not found`);return}i.interactions=[{type:`select`,active:!1,options:{id:`SelectLayerHoverInteraction`,condition:`pointermove`,active:!1,style:e.featureStyles?.hover||{"fill-color":`rgba(0, 0, 0,0.0)`,"stroke-color":`#3399CC`,"stroke-width":2.5}}},{type:`select`,options:{id:`SelectLayerClickInteraction`,condition:`click`,multi:e.multipleFeatures,modify:e.allowModify,active:!1,style:e.featureStyles?.click||{"fill-color":`rgba(0, 0, 0,0.0)`,"stroke-color":`rgba(0, 0, 0,0.0)`}}}],t.addOrUpdateLayer(i),ga(t.layers,n,[i]);let a=e.draw;e.draw=t.selectInteractions.SelectLayerClickInteraction,a?.setActive(!1),t.selectInteractions.SelectLayerClickInteraction?.setActive(!1),t.selectInteractions.SelectLayerHoverInteraction?.setActive(!1)};function ga(e,t,n){let r=e.findIndex(e=>e.properties.id===t);if(r!==-1)return e.splice(r,1,...n),e;for(let r of e)if(r.type===`Group`){let e=ga(r.layers,t,n);e?.length&&(r.layers=e)}return e}var $=e=>{let t=e.getGeometry();if(!t)return;let n=``;if(t.getType()===`Polygon`||t.getType()===`MultiPolygon`){let e=Bn(t);n=e>1e6?(e/1e6).toFixed(2)+` km²`:e.toFixed(2)+` m²`}else if(t.getType()===`LineString`||t.getType()===`MultiLineString`){let e=Rn(t);n=e>1e3?(e/1e3).toFixed(2)+` km`:e.toFixed(2)+` m`}else if(t.getType()===`Circle`){let e=t.getRadius(),r=Math.PI*e**2;n=r>1e6?(r/1e6).toFixed(2)+` km²`:r.toFixed(2)+` m²`}n&&e.get(`measure`)!==n&&e.set(`measure`,n)},_a=e=>{let t=e.drawLayer.getSource();t.on(`addfeature`,e=>{let t=e.feature;t&&($(t),t.getGeometry().on(`change`,()=>$(t)))}),t.getFeatures().forEach(e=>{$(e),e.getGeometry().on(`change`,()=>$(e))})},va=(e,t)=>{let n=da(e.for),r=n.map,i=`0, 65, 112`;e.drawLayer=n.addOrUpdateLayer({zIndex:100,type:`Vector`,properties:{id:`drawLayer`,layerControlHide:!0,isDrawingEnabled:!1,multipleFeatures:t},source:{type:`Vector`},style:e.featureStyles?.layer||{"fill-color":`rgba(${i}, 0.1)`,"stroke-color":`rgba(${i}, 1)`,"stroke-width":2,"circle-radius":5,"circle-fill-color":`rgba(${i}, 1)`,...e.measure&&{"text-value":[`coalesce`,[`get`,`measure`],``],"text-fill-color":`rgba(${i}, 1)`,"text-stroke-color":`white`,"text-stroke-width":3,"text-font":`bold 14px sans-serif`,"text-overflow":!0}},interactions:[{type:`draw`,options:{active:!1,id:`drawInteraction`,type:e.type,modify:e.allowModify,stopClick:!0,style:e.featureStyles?.layer||{"fill-color":`rgba(${i}, 0.1)`,"stroke-color":`rgba(${i}, 1)`,"stroke-width":1,"stroke-line-dash":[7,3],"circle-radius":5,"circle-fill-color":`rgba(${i}, 1)`,...e.measure&&{"text-value":[`coalesce`,[`get`,`measure`],``],"text-fill-color":`rgba(${i}, 1)`,"text-stroke-color":`white`,"text-stroke-width":3,"text-font":`bold 14px sans-serif`,"text-overflow":!0}}}},...e.layerId?[]:[{type:`select`,options:{id:`SelectLayerHoverInteraction`,condition:`pointermove`,style:e.featureStyles?.hover||{"fill-color":`rgba(${i}, 0.2)`,"stroke-color":`rgba(${i}, 1)`,"stroke-width":2},tooltip:!1}},{type:`select`,options:{id:`SelectLayerClickInteraction`,condition:`click`,panIn:!0,style:e.featureStyles?.click||{"fill-color":`rgba(${i}, 0.2)`,"stroke-color":`rgba(${i}, 1)`,"stroke-width":2}}}]]}),e.draw=n.interactions.drawInteraction,e.modify=n.interactions.drawInteraction_modify,ha(e,n,e.layerId),e.measure&&_a(e);let a=()=>e.onModifyEnd(),o=()=>pa(e);return e.modify?.on(`modifyend`,a),e.measure&&e.draw&&typeof e.draw.on==`function`&&e.draw.on(`drawstart`,e=>{let t=e.feature;$(t),t.getGeometry().on(`change`,()=>$(t))}),n.addEventListener(`addfeatures`,o),{EoxMap:n,OlMap:r,reset:e=>{!e.eoxMap||!e.drawLayer||(e.drawLayer.getSource().clear(),e.eoxMap.map.removeLayer(e.drawLayer),e.modify?.un(`modifyend`,a),e.eoxMap.removeEventListener(`addfeatures`,o),e.layerId||(e.draw=null),e.modify=null)}}},ya=e=>{e.drawnFeatures=[],e.draw?.setActive(!1),e.layerId&&e.selectionEvents.removeSelectionEvent(),e.drawLayer.getSource().clear(),e.geoJSON=null,e.emitDrawnFeatures(),e.currentlyDrawing=!1,e.requestUpdate()},ba=(e,t)=>{setTimeout(()=>{let n=e.drawLayer.getSource().getFeatures(),r=e.eoxMap.projection||`EPSG:3857`,i=e.projection,a=i?n.map(e=>{e=e.clone();let t=e.getGeometry().transform(r,i);return e.setGeometry(t),e}):n;e.setDrawnFeaturesInternal?e.setDrawnFeaturesInternal(a):e.drawnFeatures=a;let o;switch(e.format){case`geojson`:o=Ri(e.drawnFeatures);break;case`wkt`:o=oa(e.drawnFeatures);break;case`feature`:o=e.drawnFeatures;break;default:o=e.drawnFeatures;break}e.updateGeoJSON(),e.requestUpdate(),t(o)},0)},xa=e=>{let t=t=>{t?.detail.id!==`SelectLayerClickInteraction`||!t.detail.feature||(typeof t.detail.feature.getGeometry().getCoordinates!=`function`&&(t.detail.feature=li(t.detail.feature)),e.drawLayer.getSource().addFeature(t.detail.feature),e.eoxMap.dispatchEvent(new CustomEvent(`addfeatures`,{detail:t.detail})))};return{addSelectionEvent:()=>{e.layerId&&(e.eoxMap.selectInteractions.SelectLayerHoverInteraction?.setActive(!0),e.eoxMap.addEventListener(`select`,t))},removeSelectionEvent:()=>{let n=e.eoxMap.selectInteractions?.SelectLayerHoverInteraction;n&&(n.selectedFids=[],n?.setActive(!1)),e.eoxMap.removeEventListener(`select`,t)}}},Sa=(e,t,n,r)=>{if(t){if(n){r&&n!==r&&Ca(e,t),ha(e,t,n);return}if(!n&&r){Ca(e,t);return}}};function Ca(e,t){t&&(e.discardDrawing(),e.selectionEvents.removeSelectionEvent(),e.draw=t.interactions.drawInteraction,t.selectInteractions.SelectLayerClickInteraction.remove(),t.selectInteractions.SelectLayerHoverInteraction.remove())}var wa=(e,t)=>{e.key===`Escape`&&t.currentlyDrawing&&(t.draw?.setActive(!1),t.currentlyDrawing=!1,t.requestUpdate())};function Ta(e,t){let n=e.drawnFeatures.indexOf(t);n>-1&&Ea(e,n)}function Ea(e,t){if(t>-1&&t<e.drawnFeatures.length){let n=[...e.drawnFeatures];n.splice(t,1),e.drawnFeatures=n,e.emitDrawnFeatures()}}function Da(e,t){function n(e){e.preventDefault(),e.stopPropagation()}function r(e){e.srcElement.style.opacity=`0.4`}function i(e){e.srcElement.style.opacity=`1`}[`dragenter`,`dragover`,`dragleave`,`drop`].forEach(e=>{t.addEventListener(e,n,!1),[`dragenter`,`dragover`].includes(e)?t.addEventListener(e,r,!1):t.addEventListener(e,i,!1)}),t.addEventListener(`drop`,t=>ka(t,e),!1)}function Oa(e){e.preventDefault(),e.stopPropagation()}function ka(e,t){Oa(e);let n;n=`dataTransfer`in e&&e.dataTransfer?e.dataTransfer.files:e.target&&`files`in e.target?e.target.files:[],Array.from(n).forEach(e=>Aa(e,t)),e.target&&`value`in e.target&&(e.target.value=``)}function Aa(e,t){let n=new FileReader;n.readAsText(e),n.onloadend=function(){typeof n.result==`string`&&t.handleFeatureChange(n.result)}}var ja=class extends M{static get properties(){return{allowModify:{attribute:`allow-modify`,type:Boolean},for:{type:String},currentlyDrawing:{attribute:!1,state:!0,type:Boolean},continuous:{type:Boolean},draw:{attribute:!1,state:!0},drawLayer:{attribute:!1,state:!0},drawnFeatures:{attribute:!1,state:!0,type:Array},featureName:{attribute:`feature-name`,type:String},featureNameKey:{attribute:`feature-name-key`,type:String},layerId:{attribute:`layer-id`,type:String},featureStyles:{attribute:!1},modify:{attribute:!1,state:!0},multipleFeatures:{attribute:`multiple-features`,type:Boolean},measure:{type:Boolean},importFeatures:{attribute:`import-features`,type:Boolean},showEditor:{attribute:`show-editor`,type:Boolean},showList:{attribute:`show-list`,type:Boolean},projection:{type:String},noShadow:{attribute:`no-shadow`,type:Boolean},format:{type:String},type:{type:String},unstyled:{type:Boolean}}}#e;#t;#n;#r;#i=!1;#a;#o=[];#s=e=>wa(e,this);constructor(){super(),this.allowModify=!1,this.for=`eox-map`,this.currentlyDrawing=!1,this.draw=null,this.drawLayer=null,this.layerId=``,this.featureName=`Feature`,this.featureNameKey=null,this.featureStyles=null,this.modify=null,this.multipleFeatures=!1,this.measure=!1,this.importFeatures=!1,this.showEditor=!1,this.showList=!1,this.projection=`EPSG:4326`,this.type=`Polygon`,this.selectionEvents=null,this.format=`feature`,this.unstyled=!1,this.noShadow=!1}set continuous(e){this.#a=e,e&&(this.multipleFeatures=!0)}get continuous(){return this.#a}setDrawnFeaturesInternal(e){this.#i=!0,this.drawnFeatures=e,this.#i=!1}set drawnFeatures(e){let t=this.#o;if(this.#o=e,this.drawLayer&&!this.#i){if(this.drawLayer.getSource().clear(),e?.length){let t=this.eoxMap?.projection||`EPSG:3857`,n=this.projection||`EPSG:4326`,r=e;t&&n&&t!==n&&(r=e.map(e=>{e=e.clone();let r=e.getGeometry().transform(n,t);return e.setGeometry(r),e})),this.drawLayer.getSource().addFeatures(r)}this.updateGeoJSON()}this.requestUpdate(`drawnFeatures`,t)}get drawnFeatures(){return this.#o}set layerId(e){Sa(this,this.eoxMap,e,this.#r),this.#r=e}get layerId(){return this.#r}startDrawing(){ma(this)}discardDrawing(){ya(this)}removeFeature(e){Ta(this,e)}removeFeatureByIndex(e){Ea(this,e)}handleFeatureChange(e,t=!1,n=!0){this.eoxMap.parseTextToFeature(e||JSON.stringify(Ue),this.drawLayer,this.eoxMap,t,n)}handleFilesChange(e){ka(e,this)}onModifyEnd(){this.emitDrawnFeatures()}updateGeoJSON(){this.#n=JSON.stringify(this.eoxMap.parseFeature(this.drawnFeatures)||Ue,void 0,2)}emitDrawnFeatures(){ba(this,e=>{this.dispatchEvent(new CustomEvent(`drawupdate`,{detail:e}))})}createRenderRoot(){return this.noShadow?this:super.createRenderRoot()}updateLayer(){this.resetLayer&&this.resetLayer(this);let{EoxMap:e,OlMap:t,reset:n}=va(this,this.multipleFeatures);this.resetLayer=n,this.eoxMap=e,this.#t=t}firstUpdated(){this.updateLayer(),this.selectionEvents=xa(this),this.importFeatures&&Da(this,this.eoxMap),this.drawnFeatures?.length>0?this.drawnFeatures=[...this.drawnFeatures]:this.updateGeoJSON(),this.requestUpdate()}updated(e){((t=>e.has(t)&&e.get(t)!==void 0)(`for`)||e.has(`type`)&&e.get(`type`)!==this.type||e.has(`measure`)&&e.get(`measure`)!==this.measure)&&(this.updateLayer(),this.currentlyDrawing=!1)}get eoxMap(){return this.#e}set eoxMap(e){let t=this.#e;this.#e=e,this.requestUpdate(`eoxMap`,t)}connectedCallback(){if(super.connectedCallback(),document.addEventListener(`keydown`,this.#s),this.drawLayer&&this.eoxMap){let{reset:e}=va(this,this.multipleFeatures);this.resetLayer=e}}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener(`keydown`,this.#s),this.resetLayer?.(this)}render(){return D`
|
|
250
|
+
`,pa=e=>{(()=>{if(e.emitDrawnFeatures(),!e.multipleFeatures)e.draw?.setActive(!1),e.selectionEvents.removeSelectionEvent(),e.currentlyDrawing=!1;else if(e.continuous)if(!e.layerId)e.drawLayer.getSource().clear(),e.drawnFeatures=[];else{let t=e.drawLayer.getSource().getFeatures().at(-1);if(e.drawLayer.getSource().clear(),!t)return;e.drawLayer.getSource().addFeature(t),e.drawnFeatures=[t]}})(),e.requestUpdate()},ma=e=>{e.drawLayer.set(`isDrawingEnabled`,!0),e.draw?.setActive(!0),e.selectionEvents.addSelectionEvent(),e.currentlyDrawing=!0,e.requestUpdate()},ha=(e,t,n)=>{if(!n||!t)return;let r=t.getLayerById(n),i=r?JSON.parse(JSON.stringify(r.get(`_jsonDefinition`))):null;if(!i){console.error(`Layer with id ${n} not found`);return}i.interactions=[{type:`select`,active:!1,options:{id:`SelectLayerHoverInteraction`,condition:`pointermove`,active:!1,style:e.featureStyles?.hover||{"fill-color":`rgba(0, 0, 0,0.0)`,"stroke-color":`#3399CC`,"stroke-width":2.5}}},{type:`select`,options:{id:`SelectLayerClickInteraction`,condition:`click`,multi:e.multipleFeatures,modify:e.allowModify,active:!1,style:e.featureStyles?.click||{"fill-color":`rgba(0, 0, 0,0.0)`,"stroke-color":`rgba(0, 0, 0,0.0)`}}}],t.addOrUpdateLayer(i),ga(t.layers,n,[i]);let a=e.draw;e.draw=t.selectInteractions.SelectLayerClickInteraction,a?.setActive(!1),t.selectInteractions.SelectLayerClickInteraction?.setActive(!1),t.selectInteractions.SelectLayerHoverInteraction?.setActive(!1)};function ga(e,t,n){let r=e.findIndex(e=>e.properties.id===t);if(r!==-1)return e.splice(r,1,...n),e;for(let r of e)if(r.type===`Group`){let e=ga(r.layers,t,n);e?.length&&(r.layers=e)}return e}var $=e=>{let t=e.getGeometry();if(!t)return;let n=``;if(t.getType()===`Polygon`||t.getType()===`MultiPolygon`){let e=Bn(t);n=e>1e6?(e/1e6).toFixed(2)+` km²`:e.toFixed(2)+` m²`}else if(t.getType()===`LineString`||t.getType()===`MultiLineString`){let e=Rn(t);n=e>1e3?(e/1e3).toFixed(2)+` km`:e.toFixed(2)+` m`}else if(t.getType()===`Circle`){let e=t.getRadius(),r=Math.PI*e**2;n=r>1e6?(r/1e6).toFixed(2)+` km²`:r.toFixed(2)+` m²`}n&&e.get(`measure`)!==n&&e.set(`measure`,n)},_a=e=>{let t=e.drawLayer.getSource();t.on(`addfeature`,e=>{let t=e.feature;t&&($(t),t.getGeometry().on(`change`,()=>$(t)))}),t.getFeatures().forEach(e=>{$(e),e.getGeometry().on(`change`,()=>$(e))})},va=(e,t)=>{let n=da(e.for),r=n.map,i=`0, 65, 112`;e.drawLayer=n.addOrUpdateLayer({zIndex:100,type:`Vector`,properties:{id:`drawLayer`,layerControlHide:!0,isDrawingEnabled:!1,multipleFeatures:t},source:{type:`Vector`},style:e.featureStyles?.layer||{"fill-color":`rgba(${i}, 0.1)`,"stroke-color":`rgba(${i}, 1)`,"stroke-width":2,"circle-radius":5,"circle-fill-color":`rgba(${i}, 1)`,...e.measure&&{"text-value":[`coalesce`,[`get`,`measure`],``],"text-fill-color":`rgba(${i}, 1)`,"text-stroke-color":`white`,"text-stroke-width":3,"text-font":`bold 14px sans-serif`,"text-overflow":!0}},interactions:[{type:`draw`,options:{active:!1,id:`drawInteraction`,type:e.type,modify:e.allowModify,stopClick:!0,style:e.featureStyles?.layer||{"fill-color":`rgba(${i}, 0.1)`,"stroke-color":`rgba(${i}, 1)`,"stroke-width":1,"stroke-line-dash":[7,3],"circle-radius":5,"circle-fill-color":`rgba(${i}, 1)`,...e.measure&&{"text-value":[`coalesce`,[`get`,`measure`],``],"text-fill-color":`rgba(${i}, 1)`,"text-stroke-color":`white`,"text-stroke-width":3,"text-font":`bold 14px sans-serif`,"text-overflow":!0}}}},...e.layerId?[]:[{type:`select`,options:{id:`SelectLayerHoverInteraction`,condition:`pointermove`,style:e.featureStyles?.hover||{"fill-color":`rgba(${i}, 0.2)`,"stroke-color":`rgba(${i}, 1)`,"stroke-width":2},tooltip:!1}},{type:`select`,options:{id:`SelectLayerClickInteraction`,condition:`click`,panIn:!0,style:e.featureStyles?.click||{"fill-color":`rgba(${i}, 0.2)`,"stroke-color":`rgba(${i}, 1)`,"stroke-width":2}}}]]}),e.draw=n.interactions.drawInteraction,e.modify=n.interactions.drawInteraction_modify,ha(e,n,e.layerId),e.measure&&_a(e);let a=()=>e.onModifyEnd(),o=()=>pa(e);return e.modify?.on(`modifyend`,a),e.measure&&e.draw&&typeof e.draw.on==`function`&&e.draw.on(`drawstart`,e=>{let t=e.feature;$(t),t.getGeometry().on(`change`,()=>$(t))}),n.addEventListener(`addfeatures`,o),{EoxMap:n,OlMap:r,reset:e=>{!e.eoxMap||!e.drawLayer||(e.drawLayer.getSource().clear(),e.eoxMap.map.removeLayer(e.drawLayer),e.modify?.un(`modifyend`,a),e.eoxMap.removeEventListener(`addfeatures`,o),e.layerId||(e.draw=null),e.modify=null)}}},ya=e=>{e.drawnFeatures=[],e.draw?.setActive(!1),e.layerId&&e.selectionEvents.removeSelectionEvent(),e.drawLayer.getSource().clear(),e.geoJSON=null,e.emitDrawnFeatures(),e.currentlyDrawing=!1,e.requestUpdate()},ba=(e,t)=>{setTimeout(()=>{let n=e.drawLayer.getSource().getFeatures(),r=e.eoxMap.projection||`EPSG:3857`,i=e.projection,a=i?n.map(e=>{e=e.clone();let t=e.getGeometry().transform(r,i);return e.setGeometry(t),e}):n;e.setDrawnFeaturesInternal?e.setDrawnFeaturesInternal(a):e.drawnFeatures=a;let o;switch(e.format){case`geojson`:o=Ri(e.drawnFeatures);break;case`wkt`:o=oa(e.drawnFeatures);break;case`feature`:o=e.drawnFeatures;break;default:o=e.drawnFeatures;break}e.updateGeoJSON(),e.requestUpdate(),t(o)},0)},xa=e=>{let t=t=>{t?.detail.id!==`SelectLayerClickInteraction`||!t.detail.feature||(typeof t.detail.feature.getGeometry().getCoordinates!=`function`&&(t.detail.feature=li(t.detail.feature)),e.drawLayer.getSource().addFeature(t.detail.feature),e.eoxMap.dispatchEvent(new CustomEvent(`addfeatures`,{detail:t.detail})))};return{addSelectionEvent:()=>{e.layerId&&(e.eoxMap.selectInteractions.SelectLayerHoverInteraction?.setActive(!0),e.eoxMap.addEventListener(`select`,t))},removeSelectionEvent:()=>{let n=e.eoxMap.selectInteractions?.SelectLayerHoverInteraction;n&&(n.selectedFids=[],n?.setActive(!1)),e.eoxMap.removeEventListener(`select`,t)}}},Sa=(e,t,n,r)=>{if(t){if(n){r&&n!==r&&Ca(e,t),ha(e,t,n);return}if(!n&&r){Ca(e,t);return}}};function Ca(e,t){t&&(e.discardDrawing(),e.selectionEvents.removeSelectionEvent(),e.draw=t.interactions.drawInteraction,t.selectInteractions.SelectLayerClickInteraction.remove(),t.selectInteractions.SelectLayerHoverInteraction.remove())}var wa=e=>{e.currentlyDrawing&&(e.draw?.setActive(!1),e.currentlyDrawing=!1,e.requestUpdate())},Ta=(e,t)=>{e.key===`Escape`&&wa(t)};function Ea(e,t){let n=e.drawnFeatures.indexOf(t);n>-1&&Da(e,n)}function Da(e,t){if(t>-1&&t<e.drawnFeatures.length){let n=[...e.drawnFeatures];n.splice(t,1),e.drawnFeatures=n,e.emitDrawnFeatures()}}function Oa(e,t){function n(e){e.preventDefault(),e.stopPropagation()}function r(e){e.srcElement.style.opacity=`0.4`}function i(e){e.srcElement.style.opacity=`1`}[`dragenter`,`dragover`,`dragleave`,`drop`].forEach(e=>{t.addEventListener(e,n,!1),[`dragenter`,`dragover`].includes(e)?t.addEventListener(e,r,!1):t.addEventListener(e,i,!1)}),t.addEventListener(`drop`,t=>Aa(t,e),!1)}function ka(e){e.preventDefault(),e.stopPropagation()}function Aa(e,t){ka(e);let n;n=`dataTransfer`in e&&e.dataTransfer?e.dataTransfer.files:e.target&&`files`in e.target?e.target.files:[],Array.from(n).forEach(e=>ja(e,t)),e.target&&`value`in e.target&&(e.target.value=``)}function ja(e,t){let n=new FileReader;n.readAsText(e),n.onloadend=function(){typeof n.result==`string`&&t.handleFeatureChange(n.result)}}var Ma=class extends M{static get properties(){return{allowModify:{attribute:`allow-modify`,type:Boolean},for:{type:String},currentlyDrawing:{attribute:!1,state:!0,type:Boolean},continuous:{type:Boolean},draw:{attribute:!1,state:!0},drawLayer:{attribute:!1,state:!0},drawnFeatures:{attribute:!1,state:!0,type:Array},featureName:{attribute:`feature-name`,type:String},featureNameKey:{attribute:`feature-name-key`,type:String},layerId:{attribute:`layer-id`,type:String},featureStyles:{type:Object},modify:{attribute:!1,state:!0},multipleFeatures:{attribute:`multiple-features`,type:Boolean},measure:{type:Boolean},importFeatures:{attribute:`import-features`,type:Boolean},showEditor:{attribute:`show-editor`,type:Boolean},showList:{attribute:`show-list`,type:Boolean},projection:{type:String},noShadow:{attribute:`no-shadow`,type:Boolean},format:{type:String},type:{type:String},unstyled:{type:Boolean}}}#e;#t;#n;#r;#i=!1;#a;#o=[];#s=e=>Ta(e,this);constructor(){super(),this.allowModify=!1,this.for=`eox-map`,this.currentlyDrawing=!1,this.draw=null,this.drawLayer=null,this.layerId=``,this.featureName=`Feature`,this.featureNameKey=null,this.featureStyles=null,this.modify=null,this.multipleFeatures=!1,this.measure=!1,this.importFeatures=!1,this.showEditor=!1,this.showList=!1,this.projection=`EPSG:4326`,this.type=`Polygon`,this.selectionEvents=null,this.format=`feature`,this.unstyled=!1,this.noShadow=!1}set continuous(e){this.#a=e,e&&(this.multipleFeatures=!0)}get continuous(){return this.#a}setDrawnFeaturesInternal(e){this.#i=!0,this.drawnFeatures=e,this.#i=!1}set drawnFeatures(e){let t=this.#o;if(this.#o=e,this.drawLayer&&!this.#i){if(this.drawLayer.getSource().clear(),e?.length){let t=this.eoxMap?.projection||`EPSG:3857`,n=this.projection||`EPSG:4326`,r=e;t&&n&&t!==n&&(r=e.map(e=>{e=e.clone();let r=e.getGeometry().transform(n,t);return e.setGeometry(r),e})),this.drawLayer.getSource().addFeatures(r)}this.updateGeoJSON()}this.requestUpdate(`drawnFeatures`,t)}get drawnFeatures(){return this.#o}set layerId(e){Sa(this,this.eoxMap,e,this.#r),this.#r=e}get layerId(){return this.#r}startDrawing(){ma(this)}stopDrawing(){wa(this)}discardDrawing(){ya(this)}removeFeature(e){Ea(this,e)}removeFeatureByIndex(e){Da(this,e)}handleFeatureChange(e,t=!1,n=!0){this.eoxMap.parseTextToFeature(e||JSON.stringify(Ue),this.drawLayer,this.eoxMap,t,n)}handleFilesChange(e){Aa(e,this)}onModifyEnd(){this.emitDrawnFeatures()}updateGeoJSON(){this.#n=JSON.stringify(this.eoxMap.parseFeature(this.drawnFeatures)||Ue,void 0,2)}emitDrawnFeatures(){ba(this,e=>{this.dispatchEvent(new CustomEvent(`drawupdate`,{detail:e}))})}createRenderRoot(){return this.noShadow?this:super.createRenderRoot()}updateLayer(){this.resetLayer&&this.resetLayer(this);let{EoxMap:e,OlMap:t,reset:n}=va(this,this.multipleFeatures);this.resetLayer=n,this.eoxMap=e,this.#t=t}firstUpdated(){this.updateLayer(),this.selectionEvents=xa(this),this.importFeatures&&Oa(this,this.eoxMap),this.drawnFeatures?.length>0?this.drawnFeatures=[...this.drawnFeatures]:this.updateGeoJSON(),this.requestUpdate()}updated(e){((t=>e.has(t)&&e.get(t)!==void 0)(`for`)||e.has(`type`)&&e.get(`type`)!==this.type||e.has(`measure`)&&e.get(`measure`)!==this.measure)&&(this.updateLayer(),this.currentlyDrawing=!1)}get eoxMap(){return this.#e}set eoxMap(e){let t=this.#e;this.#e=e,this.requestUpdate(`eoxMap`,t)}connectedCallback(){if(super.connectedCallback(),document.addEventListener(`keydown`,this.#s),this.drawLayer&&this.eoxMap){let{reset:e}=va(this,this.multipleFeatures);this.resetLayer=e}}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener(`keydown`,this.#s),this.resetLayer?.(this)}render(){return D`
|
|
251
251
|
<style>
|
|
252
252
|
:host { display: block; }
|
|
253
253
|
${!this.unstyled&&fa}
|
|
@@ -287,4 +287,4 @@
|
|
|
287
287
|
.unstyled=${this.unstyled}
|
|
288
288
|
@changed=${()=>{this.updateGeoJSON(),this.requestUpdate()}}
|
|
289
289
|
></eox-drawtools-list>`:k}
|
|
290
|
-
`}};customElements.define(`eox-drawtools`,
|
|
290
|
+
`}};customElements.define(`eox-drawtools`,Ma),e.EOxDrawTools=Ma});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eox/drawtools",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.6.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
},
|
|
9
9
|
"devDependencies": {
|
|
10
10
|
"@eox/map": "*",
|
|
11
|
-
"vite": "^8.0.
|
|
11
|
+
"vite": "^8.0.12"
|
|
12
12
|
},
|
|
13
13
|
"engines": {
|
|
14
14
|
"npm": ">=8.0.0",
|
package/src/main.js
CHANGED
|
@@ -4,6 +4,7 @@ import "./components/controller";
|
|
|
4
4
|
import { styleEOX } from "./style.eox";
|
|
5
5
|
import {
|
|
6
6
|
startDrawingMethod,
|
|
7
|
+
stopDrawingMethod,
|
|
7
8
|
initLayerMethod,
|
|
8
9
|
discardDrawingMethod,
|
|
9
10
|
emitDrawnFeaturesMethod,
|
|
@@ -41,6 +42,7 @@ import {
|
|
|
41
42
|
* ## Methods
|
|
42
43
|
*
|
|
43
44
|
* - `startDrawing`: Triggers starting the drawing interaction on the map.
|
|
45
|
+
* - `stopDrawing`: Triggers stopping the drawing interaction on the map (same as pressing the Escape key).
|
|
44
46
|
* - `discardDrawing`: Triggers discarding/stopping the drawing interaction and deleting the drawn shapes.
|
|
45
47
|
* - `removeFeature`: Removes a feature from the drawn features.
|
|
46
48
|
* - `removeFeatureByIndex`: Removes a feature from the drawn features by its index.
|
|
@@ -64,7 +66,7 @@ export class EOxDrawTools extends LitElement {
|
|
|
64
66
|
featureName: { attribute: "feature-name", type: String },
|
|
65
67
|
featureNameKey: { attribute: "feature-name-key", type: String },
|
|
66
68
|
layerId: { attribute: "layer-id", type: String },
|
|
67
|
-
featureStyles: {
|
|
69
|
+
featureStyles: { type: Object },
|
|
68
70
|
modify: { attribute: false, state: true },
|
|
69
71
|
multipleFeatures: { attribute: "multiple-features", type: Boolean },
|
|
70
72
|
measure: { type: Boolean },
|
|
@@ -328,6 +330,13 @@ export class EOxDrawTools extends LitElement {
|
|
|
328
330
|
startDrawingMethod(this);
|
|
329
331
|
}
|
|
330
332
|
|
|
333
|
+
/**
|
|
334
|
+
* Triggers stopping the drawing interaction on the map (same as pressing the Escape key).
|
|
335
|
+
*/
|
|
336
|
+
stopDrawing() {
|
|
337
|
+
stopDrawingMethod(this);
|
|
338
|
+
}
|
|
339
|
+
|
|
331
340
|
/**
|
|
332
341
|
* Triggers discarding/stopping the drawing interaction and deleting the drawn shapes.
|
|
333
342
|
*/
|
|
@@ -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,
|
|
@@ -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;
|
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.
|
|
@@ -72,7 +73,7 @@ export class EOxDrawTools extends LitElement {
|
|
|
72
73
|
type: StringConstructor;
|
|
73
74
|
};
|
|
74
75
|
featureStyles: {
|
|
75
|
-
|
|
76
|
+
type: ObjectConstructor;
|
|
76
77
|
};
|
|
77
78
|
modify: {
|
|
78
79
|
attribute: boolean;
|
|
@@ -252,6 +253,10 @@ export class EOxDrawTools extends LitElement {
|
|
|
252
253
|
* Triggers starting the drawing interaction on the map.
|
|
253
254
|
*/
|
|
254
255
|
startDrawing(): void;
|
|
256
|
+
/**
|
|
257
|
+
* Triggers stopping the drawing interaction on the map (same as pressing the Escape key).
|
|
258
|
+
*/
|
|
259
|
+
stopDrawing(): void;
|
|
255
260
|
/**
|
|
256
261
|
* Triggers discarding/stopping the drawing interaction and deleting the drawn shapes.
|
|
257
262
|
*/
|
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":"AAsBA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH;IAEE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MAyBC;IA4CC;;OAEG;IACH,qBAAwB;IAExB;;;;;OAKG;IACH,KAFU,SAAO,WAAW,CAER;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,kBAAqB;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;;OAEG;IACH,uBAEC;IAED;;;OAGG;IACH,uBAFW,OAAO,IAAI,EAAE,OAAO,QAI9B;IAED;;;OAGG;IACH,4BAFW,MAAM,QAIhB;IAED;;;;;OAKG;IACH,0BALW,MAAM,oBACN,OAAO,YACP,OAAO,QAWjB;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;;;OAGG;IACH,0BAaC;IAUD;;;;OAIG;IACH,oBAWC;IAHC,iEAAuB;IAkDzB,uBAIC;IAZD;;;OAGG;IACH,kBAEC;IA3CD;;;;;OAKG;IACH,qBAYC;IAED,cAAc;IACd,sCAcC;IAiCD,+CAqDC;;CACF;2BA7jByC,KAAK"}
|
|
@@ -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
|
|
@@ -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"}
|