fix dnd bugs
This commit is contained in:
parent
5f7155090b
commit
69334d977d
2 changed files with 22 additions and 4 deletions
|
@ -164,18 +164,30 @@
|
|||
if (sortableLevel === ListLevel.FILE) {
|
||||
Object.keys(elements).forEach((fileId) => {
|
||||
if (!get(fileObservers).has(fileId)) {
|
||||
if (elements[fileId]) {
|
||||
Sortable.utils.deselect(elements[fileId]);
|
||||
}
|
||||
delete elements[fileId];
|
||||
}
|
||||
});
|
||||
} else if (sortableLevel === ListLevel.WAYPOINTS) {
|
||||
if (node.wpt.length === 0) {
|
||||
if (elements['waypoints']) {
|
||||
Sortable.utils.deselect(elements['waypoints']);
|
||||
}
|
||||
delete elements['waypoints'];
|
||||
}
|
||||
} else {
|
||||
Object.keys(elements).forEach((index) => {
|
||||
if ((node instanceof GPXFile || node instanceof Track) && node.children.length <= index) {
|
||||
if (elements[index]) {
|
||||
Sortable.utils.deselect(elements[index]);
|
||||
}
|
||||
delete elements[index];
|
||||
} else if (Array.isArray(node) && node.length <= index) {
|
||||
if (elements[index]) {
|
||||
Sortable.utils.deselect(elements[index]);
|
||||
}
|
||||
delete elements[index];
|
||||
}
|
||||
});
|
||||
|
@ -183,6 +195,10 @@
|
|||
if (sortableLevel !== ListLevel.FILE) {
|
||||
sortable.sort(Object.keys(elements));
|
||||
}
|
||||
Object.defineProperty(sortable, '_item', {
|
||||
value: item,
|
||||
writable: true
|
||||
});
|
||||
});
|
||||
|
||||
const unsubscribe = selection.subscribe(($selection) => {
|
||||
|
|
|
@ -289,16 +289,18 @@ export class GPXLayer {
|
|||
|
||||
showWaypointPopup(waypoint: Waypoint) {
|
||||
let marker = this.markers[waypoint._data.index];
|
||||
currentWaypoint.set(waypoint);
|
||||
marker.setPopup(waypointPopup);
|
||||
marker.togglePopup();
|
||||
if (marker) {
|
||||
currentWaypoint.set(waypoint);
|
||||
marker.setPopup(waypointPopup);
|
||||
marker.togglePopup();
|
||||
}
|
||||
}
|
||||
|
||||
hideWaypointPopup() {
|
||||
let waypoint = get(currentWaypoint);
|
||||
if (waypoint) {
|
||||
let marker = this.markers[waypoint._data.index];
|
||||
marker.getPopup()?.remove();
|
||||
marker?.getPopup()?.remove();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue