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

Marco Cecchetti marco.cecchetti at collabora.com
Mon Oct 17 10:39:59 UTC 2016


 loleaflet/src/layer/tile/TileLayer.js |   31 +++++++++++++++++--------------
 1 file changed, 17 insertions(+), 14 deletions(-)

New commits:
commit e61d8aaa5f3baa27651338b1074ccda3ecbaa8fb
Author: Marco Cecchetti <marco.cecchetti at collabora.com>
Date:   Mon Oct 17 12:36:50 2016 +0200

    loleaflet: handle EMPTY invalid tiles msg with part in the payload
    
    Change-Id: I73e363f51101c8e4e258131ea1692a7709d6a544
    Reviewed-on: https://gerrit.libreoffice.org/29964
    Reviewed-by: Marco Cecchetti <mrcekets at gmail.com>
    Tested-by: Marco Cecchetti <mrcekets at gmail.com>

diff --git a/loleaflet/src/layer/tile/TileLayer.js b/loleaflet/src/layer/tile/TileLayer.js
index dfe8b7a..d8836d5 100644
--- a/loleaflet/src/layer/tile/TileLayer.js
+++ b/loleaflet/src/layer/tile/TileLayer.js
@@ -304,21 +304,24 @@ L.TileLayer = L.GridLayer.extend({
 		else if (textMsg.startsWith('invalidatecursor:')) {
 			this._onInvalidateCursorMsg(textMsg);
 		}
-		else if (textMsg.startsWith('invalidatetiles:') && !textMsg.startsWith('EMPTY')) {
-			this._onInvalidateTilesMsg(textMsg);
-		}
-		else if (textMsg.startsWith('invalidatetiles:') && textMsg.startsWith('EMPTY')) {
-			var msg = 'invalidatetiles: ';
-			if (this._docType === 'text') {
-				msg += 'part=0 ';
-			} else {
-				var partNumber = parseInt(textMsg.substring(6));
-				msg += 'part=' + (isNaN(partNumber) ? this._selectedPart : partNumber) + ' ';
+		else if (textMsg.startsWith('invalidatetiles:')) {
+			var payload = textMsg.substring('invalidatetiles:'.length + 1);
+			if (!payload.startsWith('EMPTY')) {
+				this._onInvalidateTilesMsg(textMsg);
+			}
+			else {
+				var msg = 'invalidatetiles: ';
+				if (this._docType === 'text') {
+					msg += 'part=0 ';
+				} else {
+					var partNumber = parseInt(payload.substring('EMPTY'.length + 1));
+					msg += 'part=' + (isNaN(partNumber) ? this._selectedPart : partNumber) + ' ';
+				}
+				msg += 'x=0 y=0 ';
+				msg += 'width=' + this._docWidthTwips + ' ';
+				msg += 'height=' + this._docHeightTwips;
+				this._onInvalidateTilesMsg(msg);
 			}
-			msg += 'x=0 y=0 ';
-			msg += 'width=' + this._docWidthTwips + ' ';
-			msg += 'height=' + this._docHeightTwips;
-			this._onInvalidateTilesMsg(msg);
 		}
 		else if (textMsg.startsWith('mousepointer:')) {
 			this._onMousePointerMsg(textMsg);


More information about the Libreoffice-commits mailing list