From 238ecd50f7a41c120acf0294b766d17cf4fcf70a Mon Sep 17 00:00:00 2001 From: Paulius Varna Date: Wed, 25 Jul 2018 15:24:55 +0300 Subject: [PATCH] Attach coordinates to events --- lib/MeasureTool.js | 10 +++++++--- src/index.js | 10 +++++++--- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/lib/MeasureTool.js b/lib/MeasureTool.js index a1f2e69..9b433bc 100644 --- a/lib/MeasureTool.js +++ b/lib/MeasureTool.js @@ -1954,6 +1954,7 @@ var MeasureTool = function () { this._mapClickEvent.remove(); this._mapZoomChangedEvent.remove(); + var coordinates = this._geometry.nodes; this._geometry = new _geometry.Geometry(); this._onRemoveOverlay(); this._setOverlay(); @@ -1968,7 +1969,8 @@ var MeasureTool = function () { lengthText: this.lengthText, area: this.area, areaText: this.areaText, - segments: this.segments + segments: this.segments, + coordinates: coordinates } }); } @@ -2549,7 +2551,8 @@ var MeasureTool = function () { lengthText: this.lengthText, area: this.area, areaText: this.areaText, - segments: this.segments + segments: this.segments, + coordinates: this._geometry.nodes } }); } @@ -2583,7 +2586,8 @@ var MeasureTool = function () { lengthText: this.lengthText, area: this.area, areaText: this.areaText, - segments: this.segments + segments: this.segments, + coordinates: this._geometry.nodes } }; if (this._lastMeasure && this._lastMeasure.result.lengthText === this.lengthText && this._lastMeasure.result.areaText === this.areaText) return; diff --git a/src/index.js b/src/index.js index 33026c0..4897b47 100644 --- a/src/index.js +++ b/src/index.js @@ -122,6 +122,7 @@ export default class MeasureTool { this._mapClickEvent.remove(); this._mapZoomChangedEvent.remove(); + let coordinates = this._geometry.nodes this._geometry = new Geometry(); this._onRemoveOverlay(); this._setOverlay(); @@ -136,7 +137,8 @@ export default class MeasureTool { lengthText: this.lengthText, area: this.area, areaText: this.areaText, - segments: this.segments + segments: this.segments, + coordinates, } }); } @@ -727,7 +729,8 @@ export default class MeasureTool { lengthText: this.lengthText, area: this.area, areaText: this.areaText, - segments: this.segments + segments: this.segments, + coordinates: this._geometry.nodes, } }); } @@ -759,7 +762,8 @@ export default class MeasureTool { lengthText: this.lengthText, area: this.area, areaText: this.areaText, - segments: this.segments + segments: this.segments, + coordinates: this._geometry.nodes, } }; if (this._lastMeasure && this._lastMeasure.result.lengthText === this.lengthText && this._lastMeasure.result.areaText === this.areaText) return;