[Libreoffice-commits] online.git: Branch 'distro/collabora/collabora-online-4' - loleaflet/src
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Mon Apr 15 03:02:57 UTC 2019
loleaflet/src/control/Control.PartsPreview.js | 16 ++++++++++++----
1 file changed, 12 insertions(+), 4 deletions(-)
New commits:
commit 685f10a287c23e22ad77468f10cfc0f2dac5955e
Author: Ashod Nakashian <ashod.nakashian at collabora.co.uk>
AuthorDate: Fri Nov 23 01:36:17 2018 -0500
Commit: Ashod Nakashian <ashnakash at gmail.com>
CommitDate: Mon Apr 15 05:02:39 2019 +0200
leaflet: support reordering slides to first position
Change-Id: I23fba5d7e10d861ec482974cf355c9fb1ae13a64
Reviewed-on: https://gerrit.libreoffice.org/69637
Reviewed-by: Ashod Nakashian <ashnakash at gmail.com>
Tested-by: Ashod Nakashian <ashnakash at gmail.com>
diff --git a/loleaflet/src/control/Control.PartsPreview.js b/loleaflet/src/control/Control.PartsPreview.js
index 23ef831d2..1492f03ab 100644
--- a/loleaflet/src/control/Control.PartsPreview.js
+++ b/loleaflet/src/control/Control.PartsPreview.js
@@ -66,7 +66,7 @@ L.Control.PartsPreview = L.Control.extend({
this._map.on('click', function() {
this.partsFocused = false;
}, this);
-
+
this._map.on('keydown', function(e) {
if (this.partsFocused === true) {
switch (e.originalEvent.keyCode) {
@@ -82,6 +82,12 @@ L.Control.PartsPreview = L.Control.extend({
this._scrollContainer = $('#slide-sorter .mCSB_container').get(0);
+ // Add a special frame just as a drop-site for reordering.
+ var frame = L.DomUtil.create('div', 'preview-frame', this._scrollContainer);
+ this._addDnDHandlers(frame);
+ frame.setAttribute('draggable', false);
+ L.DomUtil.setStyle(frame, 'height', '12px');
+
// Create the preview parts
for (var i = 0; i < parts; i++) {
this._previewTiles.push(this._createPreview(i, e.partNames[i], bottomBound));
@@ -189,12 +195,12 @@ L.Control.PartsPreview = L.Control.extend({
$('#slide-sorter').mCustomScrollbar('scrollTo', nodePos-(sliderHeight-nodeHeight-nodeHeight/2));
}, 50);
}
- }
+ }
return;
}
var part = $('#slide-sorter .mCSB_container .preview-frame').index(e.target.parentNode);
if (part !== null) {
- var partId = parseInt(part);
+ var partId = parseInt(part) - 1; // The first part is just a drop-site for reordering.
if (e.ctrlKey) {
this._map.selectPart(partId, 2, false); // Toggle selection on ctrl+click.
@@ -381,7 +387,9 @@ L.Control.PartsPreview = L.Control.extend({
var part = $('#slide-sorter .mCSB_container .preview-frame').index(e.target.parentNode);
if (part !== null) {
- var partId = parseInt(part);
+ var partId = parseInt(part) - 1; // First frame is a drop-site for reordering.
+ if (partId < 0)
+ partId = -1; // First item is -1.
this.partsPreview._map._socket.sendMessage('moveselectedclientparts position=' + partId);
}
More information about the Libreoffice-commits
mailing list