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
This commit is contained in:
parent
8d84e05a2a
commit
1709592811
@ -1314,9 +1314,18 @@ class AppDisplay extends BaseAppView {
|
|||||||
|
|
||||||
// The hovered AppIcon always passes its own id as the first
|
// The hovered AppIcon always passes its own id as the first
|
||||||
// one, and this is where we want the folder to be created
|
// 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]));
|
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 appItems = apps.map(id => this._items.get(id).app);
|
||||||
let folderName = _findBestFolderName(appItems);
|
let folderName = _findBestFolderName(appItems);
|
||||||
if (!folderName)
|
if (!folderName)
|
||||||
|
Loading…
Reference in New Issue
Block a user