Refactoring
This commit is contained in:
parent
ac0a3fdf5c
commit
7f8c3ad0b3
@ -217,6 +217,7 @@ export default abstract class LeafletMap {
|
||||
});
|
||||
|
||||
const dragListener = (e: L.DragEndEvent) => {
|
||||
if (e.type === 'dragend') {
|
||||
const polygonOffset = this.options.provider === MapProviders.image ? 10 : 0.01;
|
||||
|
||||
let convert = this.convertToCustomFormat(mousePositionOnMap,polygonOffset);
|
||||
@ -228,7 +229,6 @@ export default abstract class LeafletMap {
|
||||
const latlng3 = L.latLng(mousePositionOnMap.lat - polygonOffset, mousePositionOnMap.lng);
|
||||
polygonPoints = [latlng1, latlng2, latlng3];
|
||||
|
||||
if (e.type === 'dragend' && polygonPoints) {
|
||||
const newPolygon = L.polygon(polygonPoints).addTo(this.map);
|
||||
this.addPolygons.push(newPolygon);
|
||||
const datasourcesList = document.createElement('div');
|
||||
|
||||
@ -192,7 +192,7 @@ export class ImageMap extends LeafletMap {
|
||||
this.updateMarkers(this.markersData);
|
||||
if (this.options.draggableMarker && this.addMarkers.length) {
|
||||
this.addMarkers.forEach((marker) => {
|
||||
const prevPoint = this.convertToCustomFormat(marker.getLatLng(),null, prevWidth, prevHeight);
|
||||
const prevPoint = this.convertToCustomFormat(marker.getLatLng(), null, prevWidth, prevHeight);
|
||||
marker.setLatLng(this.convertPosition(prevPoint));
|
||||
});
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user