iconGrid: Return page and position for drop targets instead of items
Returning a page and a position for the drop target seems more straightforward than returning an actual grid item in getDropTarget(). With the next commit, this will allow us to throw away drop targets that are not on the current page. Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2348>
This commit is contained in:
@ -1172,14 +1172,8 @@ var BaseAppView = GObject.registerClass({
|
||||
}
|
||||
|
||||
_getDropTarget(x, y, source) {
|
||||
const { currentPage } = this._grid;
|
||||
|
||||
let [item, dragLocation] = this._grid.getDropTarget(x, y);
|
||||
|
||||
const [sourcePage, sourcePosition] = this._grid.getItemPosition(source);
|
||||
const targetPage = currentPage;
|
||||
let targetPosition = item
|
||||
? this._grid.getItemPosition(item)[1] : -1;
|
||||
let [targetPage, targetPosition, dragLocation] = this._grid.getDropTarget(x, y);
|
||||
|
||||
// In case we're hovering over the edge of an item but the
|
||||
// reflow will happen in the opposite direction (the drag
|
||||
@ -1212,14 +1206,6 @@ var BaseAppView = GObject.registerClass({
|
||||
}
|
||||
}
|
||||
|
||||
// Append to the page if dragging over empty area
|
||||
if (dragLocation === IconGrid.DragLocation.EMPTY_SPACE) {
|
||||
const pageItems =
|
||||
this._grid.getItemsAtPage(currentPage).filter(c => c.visible);
|
||||
|
||||
targetPosition = pageItems.length;
|
||||
}
|
||||
|
||||
return [targetPage, targetPosition, dragLocation];
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user