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

Pranam Lashkari (via logerrit) logerrit at kemper.freedesktop.org
Wed Jun 10 14:42:55 UTC 2020


 loleaflet/src/control/Control.PartsPreview.js |   23 ++++++++++++++++++++++-
 loleaflet/src/control/Parts.js                |    7 +++++++
 2 files changed, 29 insertions(+), 1 deletion(-)

New commits:
commit 8a223e8c8c29b427a51c01be93895904bb7451d6
Author:     Pranam Lashkari <lpranam at collabora.com>
AuthorDate: Sun May 24 15:57:44 2020 +0530
Commit:     Andras Timar <andras.timar at collabora.com>
CommitDate: Wed Jun 10 16:42:37 2020 +0200

    leaflet: select rang of slides using shift key in slide sorter
    
    Change-Id: I70f76d12a9229cc11594407f510e280d86dea8c3
    Reviewed-on: https://gerrit.libreoffice.org/c/online/+/94754
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
    Tested-by: Jenkins
    Reviewed-by: Andras Timar <andras.timar at collabora.com>
    Reviewed-on: https://gerrit.libreoffice.org/c/online/+/96009

diff --git a/loleaflet/src/control/Control.PartsPreview.js b/loleaflet/src/control/Control.PartsPreview.js
index 045b9b01f..c7250de7f 100644
--- a/loleaflet/src/control/Control.PartsPreview.js
+++ b/loleaflet/src/control/Control.PartsPreview.js
@@ -309,13 +309,34 @@ L.Control.PartsPreview = L.Control.extend({
 
 			if (e.ctrlKey) {
 				this._map.selectPart(partId, 2, false); // Toggle selection on ctrl+click.
+				if (this.firstSelection === undefined)
+					this.firstSelection = this._map._docLayer._selectedPart;
 			} else if (e.altKey) {
 				console.log('alt');
 			} else if (e.shiftKey) {
-				console.log('shift');
+				if (this.firstSelection === undefined)
+					this.firstSelection = this._map._docLayer._selectedPart;
+
+				//deselect all slide
+				this._map.deselectAll();
+
+				//reselect the first origianl selection
+				this._map.setPart(this.firstSelection);
+				this._map.selectPart(this.firstSelection, 1, false);
+
+				if (this.firstSelection < partId) {
+					for (var id = this.firstSelection + 1; id <= partId; ++id) {
+						this._map.selectPart(id, 2, false);
+					}
+				} else if (this.firstSelection > partId) {
+					for (id = this.firstSelection - 1; id >= partId; --id) {
+						this._map.selectPart(id, 2, false);
+					}
+				}
 			} else {
 				this._map.setPart(partId);
 				this._map.selectPart(partId, 1, false); // And select.
+				this.firstSelection = partId;
 			}
 		}
 	},
diff --git a/loleaflet/src/control/Parts.js b/loleaflet/src/control/Parts.js
index 4c3ff9cec..72a213402 100644
--- a/loleaflet/src/control/Parts.js
+++ b/loleaflet/src/control/Parts.js
@@ -90,6 +90,13 @@ L.Map.include({
 		}
 	},
 
+	deselectAll: function() {
+		var docLayer = this._docLayer;
+		while (docLayer._selectedParts.length > 0) {
+			this.selectPart(docLayer._selectedParts[0], 0, false);
+		}
+	},
+
 	getPreview: function (id, index, maxWidth, maxHeight, options) {
 		if (!this._docPreviews) {
 			this._docPreviews = {};


More information about the Libreoffice-commits mailing list