comparison client/src/map/Maplayer.vue @ 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
comparison
equal deleted inserted replaced
703:e9c28c42c927 705:6aa09d12157f
62 removeCurrentInteraction() { 62 removeCurrentInteraction() {
63 this.openLayersMap.removeInteraction(this.interaction); 63 this.openLayersMap.removeInteraction(this.interaction);
64 this.interaction = null; 64 this.interaction = null;
65 }, 65 },
66 createInteraction() { 66 createInteraction() {
67 return new Draw({ 67 var draw = new Draw({
68 source: this.vectorSource, 68 source: this.vectorSource,
69 type: this.drawMode 69 type: this.drawMode
70 }); 70 });
71 draw.on("drawend", this.drawEnd);
72 return draw;
71 }, 73 },
72 activateInteraction() { 74 activateInteraction() {
73 const interaction = this.createInteraction(this.drawMode); 75 const interaction = this.createInteraction(this.drawMode);
74 this.interaction = interaction; 76 this.interaction = interaction;
75 this.openLayersMap.addInteraction(interaction); 77 this.openLayersMap.addInteraction(interaction);
78 },
79 drawEnd(event) {
80 console.log(event);
76 }, 81 },
77 buildVectorLoader(featureRequestOptions, endpoint, vectorSource) { 82 buildVectorLoader(featureRequestOptions, endpoint, vectorSource) {
78 // build a function to be used for VectorSource.setLoader() 83 // build a function to be used for VectorSource.setLoader()
79 // make use of WFS().writeGetFeature to build the request 84 // make use of WFS().writeGetFeature to build the request
80 // and use our HTTP library to actually do it 85 // and use our HTTP library to actually do it