Commit 2bc2624a60063b7a640a97b9b87f3fad6fadaadd

Authored by Igor Kulikov
Committed by GitHub
2 parents 5a41def9 3e2600cb

Merge pull request #3286 from vvlladd28/bugs/map/edit-polygon

Fix createed and updated polygon
@@ -180,7 +180,7 @@ export default abstract class LeafletMap { @@ -180,7 +180,7 @@ export default abstract class LeafletMap {
180 } 180 }
181 181
182 addPolygonControl() { 182 addPolygonControl() {
183 - if (this.options.editablePolygon) { 183 + if (this.options.showPolygon && this.options.editablePolygon) {
184 let mousePositionOnMap: L.LatLng[]; 184 let mousePositionOnMap: L.LatLng[];
185 let addPolygon: L.Control; 185 let addPolygon: L.Control;
186 this.map.on('mousemove', (e: L.LeafletMouseEvent) => { 186 this.map.on('mousemove', (e: L.LeafletMouseEvent) => {
@@ -195,7 +195,7 @@ export default abstract class LeafletMap { @@ -195,7 +195,7 @@ export default abstract class LeafletMap {
195 icon.options.shadowSize = [0, 0]; 195 icon.options.shadowSize = [0, 0];
196 const newPolygon = L.polygon(mousePositionOnMap).addTo(this.map); 196 const newPolygon = L.polygon(mousePositionOnMap).addTo(this.map);
197 const datasourcesList = document.createElement('div'); 197 const datasourcesList = document.createElement('div');
198 - const customLatLng = {coordinates: this.convertToPolygonFormat(mousePositionOnMap)}; 198 + const customLatLng = {[this.options.polygonKeyName]: this.convertToPolygonFormat(mousePositionOnMap)};
199 this.datasources.forEach(ds => { 199 this.datasources.forEach(ds => {
200 const dsItem = document.createElement('p'); 200 const dsItem = document.createElement('p');
201 dsItem.appendChild(document.createTextNode(ds.entityName)); 201 dsItem.appendChild(document.createTextNode(ds.entityName));