155,9 → 155,7 |
this.initMap(); |
this.handleCoordinates(); |
this.onCoordinates(); |
if('point' === this.geometryFilter) { |
this.initSearchLocality(); |
} |
}; |
|
Geoloc.prototype.initMap = function() { |
284,7 → 282,7 |
const lthis = this; |
// move marker on click |
$(this.map).off('click').on('click', function(evt) { |
lthis.handleNewLocation(evt.latlng); |
lthis.handleNewLocation(evt.originalEvent.latlng); |
}); |
// move marker on drag |
$(this.map.marker).off('dragend').on('dragend', function() { |
322,13 → 320,21 |
coordinates = this.formatCoordinates(coordinates); |
|
if(!!coordinates && !!coordinates.lat && coordinates.lng) { |
this.zoom = 20; |
this.setMapCoordinates(coordinates); |
|
if('point' === this.geometryFilter) { |
this.createDraggableMarker(); |
this.handleMarkerEvents(); |
} |
|
if ( |
('rue' === this.geometryFilter && 0 < polyline.length) || |
('point' === this.geometryFilter && 0 === polyline.length) |
) { |
this.getLocationInfo(coordinates, polyline); |
} |
} |
}; |
|
Geoloc.prototype.formatCoordinates = function (coordinates) { |
353,7 → 359,7 |
Geoloc.prototype.setMapCoordinates = function (coordinates) { |
this.coordinates = coordinates; |
// updates map |
this.map.setView(coordinates); |
this.map.setView(coordinates,this.zoom); |
}; |
|
Geoloc.prototype.createDraggableMarker = function() { |
504,7 → 510,10 |
'lng' : localityData.lon |
}; |
|
if ('point' === this.geometryFilter) { |
this.map.removeControl(this.drawControl); |
} |
this.zoom = 18; |
this.handleNewLocation(coordinates); |
} |
}; |