322,11 → 322,7 |
coordinates = this.formatCoordinates(coordinates); |
|
if(!!coordinates && !!coordinates.lat && coordinates.lng) { |
this.setMapCoordinates(coordinates); |
if('point' === this.geometryFilter) { |
this.createDraggableMarker(); |
this.handleMarkerEvents(); |
} |
this.setMapPosition(coordinates); |
this.getLocationInfo(coordinates, polyline); |
} |
}; |
350,13 → 346,24 |
return polyline; |
}; |
|
Geoloc.prototype.setMapCoordinates = function (coordinates) { |
Geoloc.prototype.setMapPosition = function (coordinates) { |
const latLng = new L.LatLng(coordinates.lat, coordinates.lng); |
|
|
this.coordinates = coordinates; |
if('point' === this.geometryFilter) { |
this.createDraggableMarker(latLng); |
this.handleMarkerEvents(); |
} |
// updates map |
this.map.setView(coordinates); |
this.map.setView(latLng); |
}; |
|
Geoloc.prototype.createDraggableMarker = function() { |
Geoloc.prototype.createDraggableMarker = function(latLng) { |
if (undefined === latLng) { |
latLng = new L.LatLng(this.coordinates.lat, this.coordinates.lng); |
} |
|
if (undefined === this.map.marker) { |
// after many attempts, did not manage |
// to make marker from draw control draggable |
375,7 → 382,7 |
} |
} |
|
this.map.marker.setLatLng(this.coordinates, {draggable: 'true'}); |
this.map.marker.setLatLng(latLng, {draggable: 'true'}); |
}; |
|
Geoloc.prototype.getLocationInfo = function(coordinates, polyline) { |