mirror of
https://gitlab.com/NvlblNm/wayfarer.git
synced 2024-09-18 02:24:58 +08:00
Merge branch 'bug-fix-updated-markers' into 'master'
Bug fix - Update markercollection after making changes to markers See merge request NvlblNm/wayfarer!14
This commit is contained in:
commit
88e1d32920
@ -441,6 +441,12 @@
|
||||
contentType: false,
|
||||
success: function (data, status, header) {
|
||||
removeExistingMarker(id);
|
||||
for (let i = 0; i < markercollection.length; i++) {
|
||||
if (markercollection[i].id === id) {
|
||||
markercollection.splice(i, 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
map.closePopup();
|
||||
},
|
||||
error: function (x, y, z) {
|
||||
@ -730,6 +736,17 @@
|
||||
contentType: false,
|
||||
success: function (data, status, header) {
|
||||
drawMarker(data);
|
||||
let markerAlreadyExists = false;
|
||||
for (let i = 0; i < markercollection.length; i++) {
|
||||
if (markercollection[i].id === data.id) {
|
||||
Object.assign(markercollection[i], data);
|
||||
markerAlreadyExists = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!markerAlreadyExists) {
|
||||
markercollection.push(data);
|
||||
}
|
||||
if (editmarker != null) {
|
||||
map.removeLayer(editmarker);
|
||||
editmarker = null;
|
||||
@ -836,4 +853,4 @@
|
||||
// Tampermonkey, run code directly
|
||||
wrapper(plugin_info);
|
||||
}
|
||||
})();
|
||||
})();
|
||||
|
Loading…
Reference in New Issue
Block a user