@h21-map/google-drawing-manager
Advanced tools
Comparing version 3.0.2 to 3.0.3
153
index.js
@@ -5,2 +5,3 @@ let DRAWING_MODE_MARKER = "marker"; | ||
let DRAWING_MODE_FITBOUNDS = "fitbounds"; | ||
let DRAWING_MODE_RESET = "reset"; | ||
@@ -33,5 +34,5 @@ function DrawingManager(map, opts) { | ||
DrawingManager.prototype.onAdd = function() { | ||
DrawingManager.prototype.onAdd = function () { | ||
let me = this; | ||
google.maps.event.addListener(me.map, 'click', function(event) { | ||
google.maps.event.addListener(me.map, 'click', function (event) { | ||
google.maps.event.trigger(me, 'click', event); | ||
@@ -42,46 +43,46 @@ }); | ||
DrawingManager.prototype.setDrawingMode = function(drawingType, opts) { | ||
let me = this; | ||
me.markerOptions = opts.markerOptions || {}; | ||
me.circleOptions = opts.circleOptions || {}; | ||
me.areaOptions = opts.areaOptions || {}; | ||
me._enableDraw = opts.enableDraw; | ||
DrawingManager.prototype.setDrawingMode = function (drawingType, opts) { | ||
let me = this; | ||
me.markerOptions = opts.markerOptions || {}; | ||
me.circleOptions = opts.circleOptions || {}; | ||
me.areaOptions = opts.areaOptions || {}; | ||
me._enableDraw = opts.enableDraw; | ||
if (me.markerOptions) { | ||
me.setPosition(me.markerOptions.markerLatitude, me.markerOptions.markerLongitude) | ||
} | ||
if (me.markerOptions) { | ||
me.setPosition(me.markerOptions.markerLatitude, me.markerOptions.markerLongitude) | ||
} | ||
if (me.circleOptions) { | ||
me.radius = me.circleOptions.radius; | ||
} | ||
if (me.circleOptions) { | ||
me.radius = me.circleOptions.radius; | ||
} | ||
if (me.areaOptions) { | ||
me.areaCoordinates = me.areaOptions.areaCoordinates; | ||
} | ||
if (me.areaOptions) { | ||
me.areaCoordinates = me.areaOptions.areaCoordinates; | ||
} | ||
if (me._drawingType != drawingType) { | ||
switch (drawingType) { | ||
case DRAWING_MODE_MARKER: | ||
me._bindMarker(); | ||
break; | ||
case DRAWING_MODE_CIRCLE: | ||
me._bindCircle(); | ||
break; | ||
case DRAWING_MODE_AREA: | ||
me._bindArea(); | ||
break; | ||
case DRAWING_MODE_FITBOUNDS: | ||
me._fitBounds(); | ||
break; | ||
default: | ||
me._reset(); | ||
break; | ||
} | ||
if (drawingType == DRAWING_MODE_FITBOUNDS) { return false } | ||
me._drawingType = drawingType; | ||
if (me._drawingType != drawingType) { | ||
switch (drawingType) { | ||
case DRAWING_MODE_MARKER: | ||
me._bindMarker(); | ||
break; | ||
case DRAWING_MODE_CIRCLE: | ||
me._bindCircle(); | ||
break; | ||
case DRAWING_MODE_AREA: | ||
me._bindArea(); | ||
break; | ||
case DRAWING_MODE_FITBOUNDS: | ||
me._fitBounds(); | ||
break; | ||
case DRAWING_MODE_RESET: | ||
me._reset(); | ||
break; | ||
} | ||
}, | ||
if (drawingType == DRAWING_MODE_FITBOUNDS || drawingType == DRAWING_MODE_RESET) { return false } | ||
me._drawingType = drawingType; | ||
} | ||
}, | ||
DrawingManager.prototype._fitBounds = function() { | ||
DrawingManager.prototype._fitBounds = function () { | ||
let me = this; | ||
@@ -99,3 +100,3 @@ if (me._centerMarker) { | ||
DrawingManager.prototype._fitBoundsMarker = function() { | ||
DrawingManager.prototype._fitBoundsMarker = function () { | ||
let me = this; | ||
@@ -110,3 +111,3 @@ if (me._centerMarker) { | ||
DrawingManager.prototype._fitBoundsArea = function(coordinates) { | ||
DrawingManager.prototype._fitBoundsArea = function (coordinates) { | ||
let me = this; | ||
@@ -121,3 +122,3 @@ let bounds = new google.maps.LatLngBounds(); | ||
DrawingManager.prototype._fitBoundsCircle = function() { | ||
DrawingManager.prototype._fitBoundsCircle = function () { | ||
let me = this; | ||
@@ -129,3 +130,3 @@ if (me._circle) { | ||
DrawingManager.prototype._setPosition = function(e) { | ||
DrawingManager.prototype._setPosition = function (e) { | ||
let me = this; | ||
@@ -139,3 +140,3 @@ me.position = null; | ||
DrawingManager.prototype.setPosition = function(lat, lng) { | ||
DrawingManager.prototype.setPosition = function (lat, lng) { | ||
let me = this; | ||
@@ -147,3 +148,3 @@ me.position = null; | ||
DrawingManager.prototype._reset = function() { | ||
DrawingManager.prototype._reset = function () { | ||
let me = this; | ||
@@ -156,3 +157,3 @@ me._removeArea(); | ||
DrawingManager.prototype._bindArea = function() { | ||
DrawingManager.prototype._bindArea = function () { | ||
let me = this; | ||
@@ -180,3 +181,3 @@ google.maps.event.clearListeners(me, 'click'); | ||
var move = google.maps.event.addListener(me.map, 'mousemove', function(e) { | ||
var move = google.maps.event.addListener(me.map, 'mousemove', function (e) { | ||
if (typeof e.latLng !== "undefined") { | ||
@@ -225,3 +226,3 @@ me._area.getPath().push(e.latLng); | ||
DrawingManager.prototype._redrawArea = function() { | ||
DrawingManager.prototype._redrawArea = function () { | ||
let me = this; | ||
@@ -249,3 +250,3 @@ if (me.areaCoordinates) { | ||
DrawingManager.prototype._convertlatlngs = function() { | ||
DrawingManager.prototype._convertlatlngs = function () { | ||
let me = this; | ||
@@ -263,3 +264,3 @@ let latlngs = []; | ||
DrawingManager.prototype._setDrawing = function(enabled) { | ||
DrawingManager.prototype._setDrawing = function (enabled) { | ||
let me = this; | ||
@@ -273,3 +274,3 @@ me.map.setOptions({ | ||
DrawingManager.prototype._fitBoundsArea = function() { | ||
DrawingManager.prototype._fitBoundsArea = function () { | ||
let me = this; | ||
@@ -288,3 +289,3 @@ if (me._area) { | ||
DrawingManager.prototype._convertCoordinates = function(coordinates) { | ||
DrawingManager.prototype._convertCoordinates = function (coordinates) { | ||
let positions = []; | ||
@@ -303,3 +304,3 @@ for (var n = 0; n < coordinates.length; n++) { | ||
DrawingManager.prototype._bindMarker = function() { | ||
DrawingManager.prototype._bindMarker = function () { | ||
let me = this; | ||
@@ -366,3 +367,3 @@ me._removeArea(); | ||
DrawingManager.prototype._bindCircle = function() { | ||
DrawingManager.prototype._bindCircle = function () { | ||
let me = this; | ||
@@ -403,3 +404,3 @@ me._removeCircle(); | ||
DrawingManager.prototype._setIconMarker = function(iconUrl) { | ||
DrawingManager.prototype._setIconMarker = function (iconUrl) { | ||
let me = this; | ||
@@ -414,7 +415,7 @@ if (me._centerMarker) { | ||
DrawingManager.prototype.setEnableDraw = function(enabled) { | ||
DrawingManager.prototype.setEnableDraw = function (enabled) { | ||
this._enableDraw = enabled; | ||
}, | ||
DrawingManager.prototype._removeCircle = function() { | ||
DrawingManager.prototype._removeCircle = function () { | ||
let me = this; | ||
@@ -430,3 +431,3 @@ if (me._circle) { | ||
DrawingManager.prototype._removeCenterMarker = function() { | ||
DrawingManager.prototype._removeCenterMarker = function () { | ||
let me = this; | ||
@@ -440,3 +441,3 @@ if (me._centerMarker) { | ||
DrawingManager.prototype._removeArea = function() { | ||
DrawingManager.prototype._removeArea = function () { | ||
let me = this; | ||
@@ -450,3 +451,3 @@ if (me._area) { | ||
DrawingManager.prototype._createVertexMarker = function() { | ||
DrawingManager.prototype._createVertexMarker = function () { | ||
let me = this; | ||
@@ -479,3 +480,3 @@ me.to = null; | ||
DrawingManager.prototype._vertexMarkerAddEventListener = function() { | ||
DrawingManager.prototype._vertexMarkerAddEventListener = function () { | ||
let me = this; | ||
@@ -508,3 +509,3 @@ google.maps.event.addListener(me._vertexMarker, 'drag', (event) => { | ||
DrawingManager.prototype.getXYbyEvent = function(event) { | ||
DrawingManager.prototype.getXYbyEvent = function (event) { | ||
let me = this; | ||
@@ -518,5 +519,5 @@ let client = me.getProjection().fromLatLngToContainerPixel(event.latLng); | ||
DrawingManager.prototype._centerMarkerAddEventListener = function() { | ||
DrawingManager.prototype._centerMarkerAddEventListener = function () { | ||
let me = this; | ||
google.maps.event.addListener(me._centerMarker, 'drag', function(event) { | ||
google.maps.event.addListener(me._centerMarker, 'drag', function (event) { | ||
@@ -534,11 +535,11 @@ me._circle.setCenter(event.latLng); | ||
google.maps.event.addListener(me._centerMarker, 'dragend', function() { | ||
google.maps.event.addListener(me._centerMarker, 'dragend', function () { | ||
google.maps.event.trigger(me, 'draw:circle_center_complete', me._getInfo()); | ||
}); | ||
google.maps.event.addListener(me._centerMarker, 'mouseover', function(event) { | ||
google.maps.event.addListener(me._centerMarker, 'mouseover', function (event) { | ||
google.maps.event.trigger(me, 'draw:marker_mouseover', me._getInfo()); | ||
}); | ||
google.maps.event.addListener(me._centerMarker, 'mouseout', function(event) { | ||
google.maps.event.addListener(me._centerMarker, 'mouseout', function (event) { | ||
google.maps.event.trigger(me, 'draw:marker_mouseout', me._getInfo()); | ||
@@ -551,3 +552,3 @@ }); | ||
DrawingManager.prototype.destination = function(latlng, heading, distance) { | ||
DrawingManager.prototype.destination = function (latlng, heading, distance) { | ||
heading = (heading + 360) % 360; | ||
@@ -573,7 +574,7 @@ var rad = Math.PI / 180, | ||
DrawingManager.prototype.degreeToRad = function(degree) { | ||
DrawingManager.prototype.degreeToRad = function (degree) { | ||
return Math.PI * degree / 180; | ||
}, | ||
DrawingManager.prototype._getRange = function(v, a, b) { | ||
DrawingManager.prototype._getRange = function (v, a, b) { | ||
if (a != null) { | ||
@@ -588,3 +589,3 @@ v = Math.max(v, a); | ||
DrawingManager.prototype._getLoop = function(v, a, b) { | ||
DrawingManager.prototype._getLoop = function (v, a, b) { | ||
while (v > b) { | ||
@@ -599,3 +600,3 @@ v -= b - a | ||
DrawingManager.prototype.getDistanceTo = function(point1, point2) { | ||
DrawingManager.prototype.getDistanceTo = function (point1, point2) { | ||
@@ -617,4 +618,4 @@ let me = this; | ||
DrawingManager.prototype.extend = function(obj1, obj2) { | ||
return (function(object) { | ||
DrawingManager.prototype.extend = function (obj1, obj2) { | ||
return (function (object) { | ||
var property; | ||
@@ -628,3 +629,3 @@ for (property in object.prototype) { | ||
DrawingManager.prototype._getInfo = function() { | ||
DrawingManager.prototype._getInfo = function () { | ||
let me = this; | ||
@@ -643,3 +644,3 @@ let position = { | ||
DrawingManager.prototype._getPosition = function() { | ||
DrawingManager.prototype._getPosition = function () { | ||
let me = this; | ||
@@ -646,0 +647,0 @@ let position = { |
{ | ||
"name": "@h21-map/google-drawing-manager", | ||
"scope": "@h21-map", | ||
"version": "3.0.2", | ||
"version": "3.0.3", | ||
"description": "A library of Google Map JS API", | ||
@@ -6,0 +6,0 @@ "main": "index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
514
21056