@h21-map/google-drawing-manager
Advanced tools
Comparing version 24.1.0 to 25.1.0
57
index.js
@@ -24,3 +24,3 @@ let drawModeMarker = "marker"; | ||
me.areaOptions = opts.areaOptions || {}; | ||
me._enableDraw = false; | ||
me.isDraw = false; | ||
me.radius = opts.circleOptions.radius; | ||
@@ -35,3 +35,4 @@ me.vertex = []; | ||
me.squareArea = opts.areaOptions.areaMaxSquare || 1400; | ||
me._isRedrawEvent = false; | ||
me.isRedraw = null; | ||
me.mode = opts.activeMode; | ||
@@ -54,9 +55,18 @@ }; | ||
me.areaOptions = opts.areaOptions || {}; | ||
me._enableDraw = opts.enableDraw; | ||
me._isRedrawEvent = opts.isRedrawEvent; | ||
me.isDraw = opts.isDraw; | ||
me.isRedraw = opts.isRedraw; | ||
me.radius = opts.circleOptions.radius; | ||
me.mode = opts.activeMode; | ||
me.markerOptions && me.setPosition(me.markerOptions.markerLatitude, me.markerOptions.markerLongitude); | ||
const info = { | ||
isRedraw: opts.isRedraw, | ||
isDraw: opts.isDraw, | ||
mode: me.mode, | ||
} | ||
google.maps.event.trigger(me, 'draw:mode', info); | ||
if (me.areaOptions) { | ||
@@ -95,3 +105,3 @@ me.areaCoordinates = me.areaOptions.areaCoordinates; | ||
me.map.setOptions({ clickableIcons: false }); | ||
me._isRedrawEvent = false; | ||
me.isRedraw = false; | ||
}, | ||
@@ -103,3 +113,3 @@ | ||
me._remove(); | ||
me._isRedrawEvent = false; | ||
me.isRedraw = false; | ||
}, | ||
@@ -124,3 +134,3 @@ | ||
me.setPosition(latitude, longitude); | ||
me._enableDraw = false; | ||
me.isDraw = false; | ||
me._bindMarker(false); | ||
@@ -293,3 +303,3 @@ }, | ||
if (this._enableDraw) { | ||
if (this.isDraw) { | ||
google.maps.event.addDomListener(me.map.getDiv(), 'mousedown', (e) => { | ||
@@ -447,3 +457,3 @@ e = window.event || e; | ||
position, | ||
center | ||
center, | ||
} | ||
@@ -486,3 +496,3 @@ return arrayArea; | ||
this._enableDraw && !enabledCircle && me.map.setOptions({ clickableIcons: true }); | ||
this.isDraw && !enabledCircle && me.map.setOptions({ clickableIcons: true }); | ||
me._removeArea(); | ||
@@ -519,5 +529,2 @@ me._removeCenterMarker(); | ||
if (me._isRedrawEvent && !enabledCircle) { me._enableDraw = true; } | ||
google.maps.event.addListener(me._centerMarker, 'click', () => { | ||
@@ -554,9 +561,10 @@ google.maps.event.trigger(me, 'draw:marker_click', me._getPosition()); | ||
if (!this._enableDraw) { | ||
if (!this.isDraw) { | ||
createCenterMarker(); | ||
google.maps.event.clearListeners(me, 'click'); | ||
google.maps.event.removeListener(me.markerListener); | ||
} | ||
this.markerListener = google.maps.event.addListener(me, 'click', (event) => { | ||
if (this._enableDraw) { | ||
me.markerListener = google.maps.event.addListener(me, 'click', (event) => { | ||
if (this.isDraw || me.isRedraw) { | ||
event.placeId && event.stop(); | ||
@@ -598,5 +606,2 @@ createCenterMarker(event); | ||
me._centerMarkerAddEventListener(); | ||
if (me._isRedrawEvent) { me._enableDraw = true; } | ||
} | ||
@@ -616,3 +621,3 @@ }, | ||
DrawingManager.prototype.setEnableDraw = function (enabled) { | ||
this._enableDraw = enabled; | ||
this.isDraw = enabled; | ||
}, | ||
@@ -950,6 +955,6 @@ | ||
const info = { | ||
isDraw: me._enableDraw, | ||
isDraw: me.isDraw, | ||
bounds: me._circle.getBounds(), | ||
radius: Math.floor(me._circle.getRadius()), | ||
position | ||
position, | ||
}; | ||
@@ -962,10 +967,10 @@ | ||
const me = this; | ||
const position = { | ||
let position = { | ||
latitude: me._centerMarker.getPosition().lat(), | ||
longitude: me._centerMarker.getPosition().lng(), | ||
} | ||
const drawMarker = { | ||
isDraw: me._enableDraw, | ||
let drawMarker = { | ||
isDraw: me.isDraw, | ||
position, | ||
placeId: me._centerMarker.placeId || null | ||
placeId: me._centerMarker.placeId || null, | ||
} | ||
@@ -972,0 +977,0 @@ return drawMarker; |
{ | ||
"name": "@h21-map/google-drawing-manager", | ||
"scope": "@h21-map", | ||
"version": "24.1.0", | ||
"version": "25.1.0", | ||
"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
33800
809