[Libreoffice-commits] online.git: loleaflet/dist loleaflet/src

Pranav Kant pranavk at collabora.co.uk
Mon Mar 20 08:30:20 UTC 2017


 loleaflet/dist/loleaflet.css                  |    4 ++++
 loleaflet/dist/partsPreviewControl.css        |    2 ++
 loleaflet/src/control/Control.PartsPreview.js |    4 ++--
 loleaflet/src/layer/tile/ImpressTileLayer.js  |   11 ++++++++++-
 4 files changed, 18 insertions(+), 3 deletions(-)

New commits:
commit 064b2508a7bde1e2d3422824cd06bf0f7c915061
Author: Pranav Kant <pranavk at collabora.co.uk>
Date:   Mon Mar 20 13:58:33 2017 +0530

    loleaflet: Slide sorter for draw documents
    
    Change-Id: I4ad11236c0186561b5c7df1a3c634e54f8576c8c

diff --git a/loleaflet/dist/loleaflet.css b/loleaflet/dist/loleaflet.css
index fbecbf7e..a3880d46 100644
--- a/loleaflet/dist/loleaflet.css
+++ b/loleaflet/dist/loleaflet.css
@@ -50,6 +50,10 @@ body {
     display: block;
 }
 
+#presentation-controls-wrapper.drawing {
+    bottom: 34px; /* Hide the presentation toolbar (insert slide etc.) for doctype = drawing */
+}
+
 #presentation-controls-wrapper.readonly {
     top: 30px;
 }
diff --git a/loleaflet/dist/partsPreviewControl.css b/loleaflet/dist/partsPreviewControl.css
index 4dc87f95..438b137d 100644
--- a/loleaflet/dist/partsPreviewControl.css
+++ b/loleaflet/dist/partsPreviewControl.css
@@ -19,6 +19,8 @@
 	}
 
 .preview-img {
+	/* In draw docs, the width of previews are small, but we want a min of 180px to align it with document's left edge */
+        min-width: 180px;
 	vertical-align: middle;
 	max-width: 184px;
 	cursor: pointer;
diff --git a/loleaflet/src/control/Control.PartsPreview.js b/loleaflet/src/control/Control.PartsPreview.js
index c4409105..f466be8c 100644
--- a/loleaflet/src/control/Control.PartsPreview.js
+++ b/loleaflet/src/control/Control.PartsPreview.js
@@ -28,7 +28,7 @@ L.Control.PartsPreview = L.Control.extend({
 			return;
 		}
 
-		if (docType === 'presentation') {
+		if (docType === 'presentation' || docType === 'drawing') {
 			if (!this._previewInitialized)
 			{
 				// make room for the preview
@@ -145,7 +145,7 @@ L.Control.PartsPreview = L.Control.extend({
 	},
 
 	_updatePreview: function (e) {
-		if (this._map.getDocType() === 'presentation') {
+		if (this._map.getDocType() === 'presentation' || this._map.getDocType() === 'drawing') {
 			// the scrollbar has to be re-initialized here else it doesn't work
 			// probably a bug from the scrollbar
 			this._previewTiles[e.id].onload = function () {
diff --git a/loleaflet/src/layer/tile/ImpressTileLayer.js b/loleaflet/src/layer/tile/ImpressTileLayer.js
index 2584679d..1390216e 100644
--- a/loleaflet/src/layer/tile/ImpressTileLayer.js
+++ b/loleaflet/src/layer/tile/ImpressTileLayer.js
@@ -145,7 +145,13 @@ L.ImpressTileLayer = L.TileLayer.extend({
 	},
 
 	_onCommandValuesMsg: function (textMsg) {
-		var values = JSON.parse(textMsg.substring(textMsg.indexOf('{')));
+		try {
+			var values = JSON.parse(textMsg.substring(textMsg.indexOf('{')));
+		} catch (e) {
+			// One such case is 'commandvalues: ' for draw documents in response to .uno:AcceptTrackedChanges
+			values = null;
+		}
+
 		if (!values) {
 			return;
 		}
@@ -325,6 +331,9 @@ L.ImpressTileLayer = L.TileLayer.extend({
 			this._docWidthTwips = command.width;
 			this._docHeightTwips = command.height;
 			this._docType = command.type;
+			if (this._docType === 'drawing') {
+				L.DomUtil.addClass(L.DomUtil.get('presentation-controls-wrapper'), 'drawing');
+			}
 			this._updateMaxBounds(true);
 			this._documentInfo = textMsg;
 			this._parts = command.parts;


More information about the Libreoffice-commits mailing list