[Libreoffice-commits] online.git: Branch 'distro/collabora/collabora-online-2-1' - loleaflet/src

Marco Cecchetti marco.cecchetti at collabora.com
Thu May 25 09:10:18 UTC 2017


 loleaflet/src/control/Control.Header.js |   11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

New commits:
commit cedeb72b71e26eb04f5763a8cbd858b17185a8e4
Author: Marco Cecchetti <marco.cecchetti at collabora.com>
Date:   Mon May 22 18:05:05 2017 +0200

    loleflet - sc: header incorrectly shows selection sometimes
    
    Problem:
    - Select a whole row, let's say row 10.
    - Select a whole column, let's say column I.
    
    => Columns headers right from I, (J, K etc.) are still highlighted.
    Similarly if a column selected first, and a row next.
    
    Change-Id: I13ad0e2a152ddbf96c4889a3aea5129885bc95b5
    Reviewed-on: https://gerrit.libreoffice.org/38002
    Reviewed-by: Jan Holesovsky <kendy at collabora.com>
    Tested-by: Jan Holesovsky <kendy at collabora.com>

diff --git a/loleaflet/src/control/Control.Header.js b/loleaflet/src/control/Control.Header.js
index 13bcd947..7b309339 100644
--- a/loleaflet/src/control/Control.Header.js
+++ b/loleaflet/src/control/Control.Header.js
@@ -33,11 +33,8 @@ L.Control.Header = L.Control.extend({
 		if (this._selection.start === -1 && this._selection.end === -1)
 			return;
 		var childs = element.children;
-		// if the selection is cleared when the end selection cell is not in the current viewport,
-		// we have _selection.end === -1, since only a portion of the header is fetched;
-		// so, without the following hack, the selection would not be cleared correctly
 		var start = (this._selection.start === -1) ? 0 : this._selection.start;
-		var end = (this._selection.end === -1) ? childs.length : this._selection.end + 1;
+		var end = this._selection.end + 1;
 		for (var iterator = start; iterator < end; iterator++) {
 			this.unselect(childs[iterator]);
 		}
@@ -72,6 +69,12 @@ L.Control.Header = L.Control.extend({
 			}
 		}
 
+		// if end is greater than the last fetched header position set itEnd to the max possible value
+		// without this hack selecting a whole row and then a whole column (or viceversa) leads to an incorrect selection
+		if (itStart !== -1 && itEnd === -1) {
+			itEnd = childs.length - 1;
+		}
+
 		// we need to unselect the row (column) header entry for the current cell cursor position
 		// since the selection could be due to selecting a whole row (column), so the selection
 		// does not start by clicking on a cell


More information about the Libreoffice-commits mailing list