From 0f8628b28d5439ba10dfa399cc8932c192a5df27 Mon Sep 17 00:00:00 2001 From: Samuel Wilton Date: Sun, 24 Aug 2025 12:46:03 -0400 Subject: [PATCH] Fix bug which caused duplicate applet orders when dropping them in the same position. --- js/ui/panel.js | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/js/ui/panel.js b/js/ui/panel.js index d6b3b8b80d..587f178a29 100644 --- a/js/ui/panel.js +++ b/js/ui/panel.js @@ -1970,7 +1970,12 @@ PanelZoneDNDHandler.prototype = { let children = this._panelZone.get_children(); let curAppletPos = 0; - let insertAppletPos = 0; + let insertAppletPos = -1; + + const { + panel: { panelId: sourceAppletPanel }, + locationLabel: sourceAppletLocation, + } = source.actor._applet; for (let i = 0, len = children.length; i < len; i++) { if (children[i]._delegate instanceof Applet.Applet){ @@ -1982,7 +1987,12 @@ PanelZoneDNDHandler.prototype = { } } - source.actor._applet._newOrder = insertAppletPos; + const isSameLocation = ( + sourceAppletPanel === this._panelId + && sourceAppletLocation === this._zoneString + && insertAppletPos === -1 + ); + if (!isSameLocation) source.actor._applet._newOrder = insertAppletPos === -1 ? 0 : insertAppletPos; source.actor._applet._newPanelLocation = this._panelZone; source.actor._applet._zoneString = this._zoneString; source.actor._applet._newPanelId = this._panelId;