[gnome-shell/gbsneto/icon-grid-dnd: 12/18] paginatedIconGrid: Store extra space data
- From: Georges Basile Stavracas Neto <gbsneto src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell/gbsneto/icon-grid-dnd: 12/18] paginatedIconGrid: Store extra space data
- Date: Tue, 2 Jul 2019 20:49:48 +0000 (UTC)
commit ddd59ccdfb80cc47217a3132203b7fc08e59ddd4
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date: Tue Jul 2 15:12:40 2019 -0300
paginatedIconGrid: Store extra space data
This will be used by future commits to calculate the correct
drag row when hovering the icon grid.
https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/603
js/ui/iconGrid.js | 11 +++++++++++
1 file changed, 11 insertions(+)
---
diff --git a/js/ui/iconGrid.js b/js/ui/iconGrid.js
index 845e58ecf..cd106c4da 100644
--- a/js/ui/iconGrid.js
+++ b/js/ui/iconGrid.js
@@ -788,6 +788,7 @@ var PaginatedIconGrid = GObject.registerClass({
this._rowsPerPage = 0;
this._spaceBetweenPages = 0;
this._childrenPerPage = 0;
+ this._extraSpaceData = null;
}
vfunc_get_preferred_height(forWidth) {
@@ -824,6 +825,10 @@ var PaginatedIconGrid = GObject.registerClass({
leftEmptySpace = availWidth - usedWidth;
}
+ // Store some information about the allocated layout
+ this._leftPadding = leftEmptySpace;
+ this._allocatedColumns = nColumns;
+
let x = box.x1 + leftEmptySpace + this.leftPadding;
let y = box.y1 + this.topPadding;
let columnIndex = 0;
@@ -953,6 +958,11 @@ var PaginatedIconGrid = GObject.registerClass({
let childrenUp = children.splice(pageOffset,
nRowsAbove * childrenPerRow);
+ // Store the resulting calculations so that we can properly take
+ // the open space when dragging icons over the icon grid from a
+ // folder popup.
+ this._extraSpaceData = [sourceRow, nRowsUp, nRowsDown];
+
// Special case: On the last row with no rows below the icon,
// there's no need to move any rows either up or down
if (childrenDown.length == 0 && nRowsUp == 0) {
@@ -987,6 +997,7 @@ var PaginatedIconGrid = GObject.registerClass({
closeExtraSpace() {
if (!this._translatedChildren || !this._translatedChildren.length) {
+ this._extraSpaceData = null;
this.emit('space-closed');
return;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]