changeset 705:6aa09d12157f

client: add detection of drawend * Add a function to listen for the end of the draw interaction. Log the result for now.
author Bernhard Reiter <bernhard@intevation.de>
date Fri, 21 Sep 2018 10:25:02 +0200
parents e9c28c42c927
children d47fa556a3e8
files client/src/map/Maplayer.vue
diffstat 1 files changed, 6 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/client/src/map/Maplayer.vue	Fri Sep 21 00:24:41 2018 +0200
+++ b/client/src/map/Maplayer.vue	Fri Sep 21 10:25:02 2018 +0200
@@ -64,16 +64,21 @@
       this.interaction = null;
     },
     createInteraction() {
-      return new Draw({
+      var draw = new Draw({
         source: this.vectorSource,
         type: this.drawMode
       });
+      draw.on("drawend", this.drawEnd);
+      return draw;
     },
     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