measuretool-googlemaps-v3
Advanced tools
Comparing version 0.4.0 to 0.4.1
@@ -14,3 +14,3 @@ # API Reference | ||
|**start()**|Return Value: **None** - starts measuring.| | ||
|**start(initialPoints: `Array<SegmentPoint>`)**|Return Value: **None** - starts measuring with initial points. **The `contextMenu` option must be set to `false`, otherwise, the initial points are ignored.**. Use this method to start a measurement if there are point data need to be loaded as the initial part of the measurement.| | ||
|**start(initialPoints: `Array<SegmentPoint>`)**|Return Value: **None** - starts measuring with initial points. **The `contextMenu` option must be set to `false`, otherwise, the initial points are ignored.**. Use this method to start a measurement if there are point data need to be loaded as the initial part of the measurement. This is an asynchronous operation. Changes could be observed by listening to the `'measure_change'` event.| | ||
@@ -17,0 +17,0 @@ |Properties|Description| |
{ | ||
"name": "measuretool-googlemaps-v3", | ||
"version": "0.4.0", | ||
"version": "0.4.1", | ||
"description": "A handy measurement widget for Google Maps API v3. The functionalities are implemented as close as to what current Google Maps offers.", | ||
@@ -5,0 +5,0 @@ "main": "lib/MeasureTool.min.js", |
@@ -15,3 +15,3 @@ # Measurement Tool for Google Maps API V3 | ||
## Demo | ||
[Visit demo page](https://www.leafyjava.com/projects/measuretool) | ||
[Visit demo page](https://zhenyanghua.github.com/MeasureTool-GoogleMaps-V3) | ||
@@ -31,2 +31,2 @@ ![demo screen shot](https://raw.githubusercontent.com/zhenyanghua/MeasureTool-GoogleMaps-V3/master/demo.jpg) | ||
- [Developer Guide](https://github.com/zhenyanghua/MeasureTool-GoogleMaps-V3/blob/master/docs/GUIDE.md) | ||
- [API Reference](https://github.com/zhenyanghua/MeasureTool-GoogleMaps-V3/blob/master/docs/REFERENCE.md) | ||
- [API Reference](https://github.com/zhenyanghua/MeasureTool-GoogleMaps-V3/blob/master/docs/REFERENCE.md) |
@@ -105,4 +105,5 @@ import css from 'index.scss'; | ||
this._segments = []; | ||
const hasInitialPoints = initialPoints && initialPoints.length > 0; | ||
if (!this._options.contextMenu && initialPoints && initialPoints.length > 0) { | ||
if (!this._options.contextMenu && hasInitialPoints) { | ||
for (let i = 0; i < initialPoints.length; i++) { | ||
@@ -124,3 +125,3 @@ const p = initialPoints[i]; | ||
this._mapClickEvent = this._map.addListener('click', mouseEvent => this._checkClick(mouseEvent)); | ||
this._mapZoomChangedEvent = this._map.addListener('zoom_changed', () => this._redrawOverlay()); | ||
// this._mapZoomChangedEvent = this._map.addListener('zoom_changed', () => this._redrawOverlay()); | ||
this._map.setOptions({draggableCursor: 'default'}); | ||
@@ -141,12 +142,3 @@ this._started = true; | ||
if (typeof this._events.get(EVENT_END) === "function") { | ||
this._events.get(EVENT_END)({ | ||
result: { | ||
length: this.length, | ||
lengthText: this.lengthText, | ||
area: this.area, | ||
areaText: this.areaText, | ||
segments: this.segments, | ||
points: this.points | ||
} | ||
}); | ||
this._events.get(EVENT_END)(this._getResults()); | ||
} | ||
@@ -782,12 +774,4 @@ | ||
if (!this._started) return; | ||
const result = { | ||
result: { | ||
length: this.length, | ||
lengthText: this.lengthText, | ||
area: this.area, | ||
areaText: this.areaText, | ||
segments: this.segments, | ||
points: this.points | ||
} | ||
}; | ||
const result = this._getResults(); | ||
if (this._lastMeasure && this._lastMeasure.result.lengthText === this.lengthText && this._lastMeasure.result.areaText === this.areaText) return; | ||
@@ -804,2 +788,15 @@ if (typeof this._events.get(EVENT_CHANGE) === "function") { | ||
} | ||
_getResults() { | ||
return ({ | ||
result: { | ||
length: this.length, | ||
lengthText: this.lengthText, | ||
area: this.area, | ||
areaText: this.areaText, | ||
segments: this.segments, | ||
points: this.points | ||
} | ||
}); | ||
} | ||
}; |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
397324
4548
31
27