[gnome-shell/gbsneto/icon-grid-dnd-fixes: 6/14] appDisplay: Adjust folder position
- From: Georges Basile Stavracas Neto <gbsneto src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell/gbsneto/icon-grid-dnd-fixes: 6/14] appDisplay: Adjust folder position
- Date: Fri, 25 Sep 2020 14:50:49 +0000 (UTC)
commit cab6d6be239602e30d1f204faca5de723c2e1d9c
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date: Thu Sep 24 12:00:03 2020 -0300
appDisplay: Adjust folder position
If you try and drop an icon that's in the same page, but before the
drop target, it'll be one position ahead of where it should be -
because we just removed one icon before the target position.
Adjust the final position of the to-be-created folder.
https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1447
js/ui/appDisplay.js | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
---
diff --git a/js/ui/appDisplay.js b/js/ui/appDisplay.js
index 67f67f81cb..d5563c6fba 100644
--- a/js/ui/appDisplay.js
+++ b/js/ui/appDisplay.js
@@ -1311,9 +1311,18 @@ class AppDisplay extends BaseAppView {
// The hovered AppIcon always passes its own id as the first
// one, and this is where we want the folder to be created
- const [folderPage, folderPosition] =
+ let [folderPage, folderPosition] =
this._grid.getItemPosition(this._items.get(apps[0]));
+ // Adjust the final position
+ folderPosition -= apps.reduce((counter, appId) => {
+ const [page, position] =
+ this._grid.getItemPosition(this._items.get(appId));
+ if (page === folderPage && position < folderPosition)
+ counter++;
+ return counter;
+ }, 0);
+
let appItems = apps.map(id => this._items.get(id).app);
let folderName = _findBestFolderName(appItems);
if (!folderName)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]