Socket
Socket
Sign inDemoInstall

measuretool-googlemaps-v3

Package Overview
Dependencies
0
Maintainers
1
Versions
28
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.3.0 to 0.4.0

src/utils.js

4

docs/CHANGES.md
# Changes
## v0.4.0
*Released on 11/12/2018*
- **[Enhancement]** Expose getters for segments and points of measurements. [#45](https://github.com/zhenyanghua/MeasureTool-GoogleMaps-V3/issues/45)
## v0.3.0

@@ -3,0 +7,0 @@ *Released on 11/06/2018*

5

docs/REFERENCE.md

@@ -9,3 +9,3 @@ # API Reference

|-------|-----------|
|**addListener(eventName: `string`, handler:`Function`)**|Return Value: **None** - addes the given listener function to the given event name.|
|**addListener(eventName: `string`, handler:`Function`)**|Return Value: **None** - adds the given listener function to the given event name.|
|**end()**|Return Value: **None** - ends measuring.|

@@ -23,2 +23,4 @@ |**removeListener(eventName: `string`)**|Return Value: **None** - removes the given listener.|

|**lengthText**|Type: `string` - the formatted total length with unit of the path drawn.|
|**points**|Type: `Array<SegmentPoint>` - an array of segment points in measurement.|
|**segments**|Type: `Array<Segment>` - an array of all segments in measurement.|

@@ -51,2 +53,3 @@ |Events|Description|

|**lengthText**|Type: `string` - the formatted total length with unit of the path drawn.|
|**points**|Type: `Array<SegmentPoint>` - an array of segment points in measurement.|
|**segments**|Type: `Array<Segment>` - an array of all segments in measurement.|

@@ -53,0 +56,0 @@

{
"name": "measuretool-googlemaps-v3",
"version": "0.3.0",
"version": "0.4.0",
"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",

@@ -12,3 +12,2 @@ # Measurement Tool for Google Maps API V3

- API for more customizations.
- Support Google Maps JavaScript API V3
- Support most modern browsers (Chrome, Firefox, Safari, Edge, IE11)

@@ -15,0 +14,0 @@

@@ -14,2 +14,3 @@ import css from 'index.scss';

import {ObjectAssign} from './polyfills';
import {deepClone} from "./utils";

@@ -22,6 +23,12 @@ export default class MeasureTool {

get area() { return this._area || 0; };
get segments() { return this._segments || []};
get segments() { return deepClone(this._segments) || []; };
get points() { return deepClone(this._geometry.nodes.map(x=> ({lat: x[1], lng: x[0]}))) || []; };
static get UnitTypeId() { return UnitTypeId};
/**
* Creates a new measure tool for the google.maps.Map instance.
* @param map - {google.maps.Map} instance.
* @param options {MeasureToolOptions}
*/
constructor(map, options) {

@@ -132,9 +139,22 @@ MeasureTool._initPolyfills();

if (!this._started) return;
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
}
});
}
if (this._options.contextMenu) {
this._contextMenu.toggleItems([this._startElementNode], [this._endElementNode]);
}
this._mapClickEvent.remove();
this._mapZoomChangedEvent.remove();
this._geometry = new Geometry();

@@ -145,15 +165,4 @@ this._onRemoveOverlay();

this._map.setOptions({draggableCursor: null});
this._started = false;
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
}
});
}
}

@@ -178,7 +187,7 @@

/**
* Updates a configuration option with a new value
* @param option - option to update
* @param value - value to set
*/
/**
* Updates a configuration option with a new value
* @param option - option to update
* @param value - value to set
*/
setOption(option, value) {

@@ -781,3 +790,4 @@ if (!this._options[option]) {

areaText: this.areaText,
segments: this.segments
segments: this.segments,
points: this.points
}

@@ -784,0 +794,0 @@ };

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc