# HG changeset patch # User Bernhard Reiter # Date 1537519994 -7200 # Node ID d47fa556a3e8e62d06446269cbf21fc2b1f420c3 # Parent 6aa09d12157ffad8cb145f8756161a4dadf3826a client: improve draw behaviour * Start drawing new polygons, if one has been ended or if the drawmode is re-enabled. This way we only get one features in the vectorSource. diff -r 6aa09d12157f -r d47fa556a3e8 client/src/map/Maplayer.vue --- a/client/src/map/Maplayer.vue Fri Sep 21 10:25:02 2018 +0200 +++ b/client/src/map/Maplayer.vue Fri Sep 21 10:53:14 2018 +0200 @@ -64,21 +64,27 @@ this.interaction = null; }, createInteraction() { + var that = this; + this.vectorSource.clear(); // start empty var draw = new Draw({ source: this.vectorSource, type: this.drawMode }); + draw.on("drawstart", function(event) { + console.log(event); + that.vectorSource.clear(); // remove old features when draw starts + }); draw.on("drawend", this.drawEnd); return draw; }, + drawEnd(event) { + console.log(event); + }, activateInteraction() { const interaction = this.createInteraction(this.drawMode); this.interaction = interaction; this.openLayersMap.addInteraction(interaction); }, - drawEnd(event) { - console.log(event); - }, buildVectorLoader(featureRequestOptions, endpoint, vectorSource) { // build a function to be used for VectorSource.setLoader() // make use of WFS().writeGetFeature to build the request