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

Tor Lillqvist (via logerrit) logerrit at kemper.freedesktop.org
Fri Oct 4 13:22:25 UTC 2019


 loleaflet/src/control/Control.PartsPreview.js |    8 ++++++++
 1 file changed, 8 insertions(+)

New commits:
commit 71be6ce1ac3533df4cd04b8c01beef89888d5809
Author:     Tor Lillqvist <tml at collabora.com>
AuthorDate: Fri Oct 4 15:43:17 2019 +0300
Commit:     Tor Lillqvist <tml at collabora.com>
CommitDate: Fri Oct 4 15:22:06 2019 +0200

    tdf#127942: Make a slide that is being dragged (for re-ordering) the selected
    
    Otherwise we would have to add a new message to to the protocol to
    move an arbitrary part of a document. (Currently there only is the
    'moveselectedclientparts' message.) Also a new API would be needed in
    LibreOfficeKit to move an arbitrary part.
    
    Change-Id: I3012982cb0c2bc18e55f47554be51958817f9015
    Reviewed-on: https://gerrit.libreoffice.org/80214
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice at gmail.com>
    Reviewed-by: Tor Lillqvist <tml at collabora.com>

diff --git a/loleaflet/src/control/Control.PartsPreview.js b/loleaflet/src/control/Control.PartsPreview.js
index 92bbd2673..f40d4fe7a 100644
--- a/loleaflet/src/control/Control.PartsPreview.js
+++ b/loleaflet/src/control/Control.PartsPreview.js
@@ -357,6 +357,14 @@ L.Control.PartsPreview = L.Control.extend({
 	},
 
 	_handleDragStart: function (e) {
+		// To avoid having to add a new message to move an arbitrary part, let's select the
+		// slide that is being dragged.
+		var part = $('#slide-sorter .mCSB_container .preview-frame').index(e.target.parentNode);
+		if (part !== null) {
+			var partId = parseInt(part) - 1; // The first part is just a drop-site for reordering.
+			this.partsPreview._map.setPart(partId);
+			this.partsPreview._map.selectPart(partId, 1, false); // And select.
+		}
 		// By default we move when dragging, but can
 		// support duplication with ctrl in the future.
 		e.dataTransfer.effectAllowed = 'move';


More information about the Libreoffice-commits mailing list