[Libreoffice-commits] online.git: Branch 'libreoffice-5-3' - loleaflet/src

Pranav Kant pranavk at collabora.co.uk
Mon Mar 20 06:24:45 UTC 2017


 loleaflet/src/layer/tile/CalcTileLayer.js    |    4 ++--
 loleaflet/src/layer/tile/GridLayer.js        |   12 ++++++------
 loleaflet/src/layer/tile/ImpressTileLayer.js |    4 ++--
 loleaflet/src/layer/tile/TileLayer.js        |   21 ++++++++++++---------
 loleaflet/src/layer/tile/WriterTileLayer.js  |    4 ++--
 5 files changed, 24 insertions(+), 21 deletions(-)

New commits:
commit 734e40f55f3698d52cb8b153202b6efb32bb013a
Author: Pranav Kant <pranavk at collabora.co.uk>
Date:   Wed Dec 7 20:54:26 2016 +0530

    tdf#106602 loleaflet: Request higher pixel density tiles on retina display
    
    Change-Id: I418f0db47239c915d8f12c07979306a814370b65
    Reviewed-on: https://gerrit.libreoffice.org/35368
    Reviewed-by: pranavk <pranavk at collabora.co.uk>
    Tested-by: pranavk <pranavk at collabora.co.uk>

diff --git a/loleaflet/src/layer/tile/CalcTileLayer.js b/loleaflet/src/layer/tile/CalcTileLayer.js
index b66a6577..5d6e6e4c 100644
--- a/loleaflet/src/layer/tile/CalcTileLayer.js
+++ b/loleaflet/src/layer/tile/CalcTileLayer.js
@@ -83,8 +83,8 @@ L.CalcTileLayer = L.TileLayer.extend({
 		{
 			var message = 'tilecombine ' +
 				'part=' + command.part + ' ' +
-				'width=' + this._tileSize + ' ' +
-				'height=' + this._tileSize + ' ' +
+				'width=' + this._tileWidthPx + ' ' +
+				'height=' + this._tileHeightPx + ' ' +
 				'tileposx=' + tilePositionsX + ' ' +
 				'tileposy=' + tilePositionsY + ' ' +
 				'tilewidth=' + this._tileWidthTwips + ' ' +
diff --git a/loleaflet/src/layer/tile/GridLayer.js b/loleaflet/src/layer/tile/GridLayer.js
index a704b42c..9f675d1b 100644
--- a/loleaflet/src/layer/tile/GridLayer.js
+++ b/loleaflet/src/layer/tile/GridLayer.js
@@ -684,8 +684,8 @@ L.GridLayer = L.Layer.extend({
 			if (tilePositionsX !== '' && tilePositionsY !== '') {
 				var message = 'tilecombine ' +
 					'part=' + this._selectedPart + ' ' +
-					'width=' + this._tileSize + ' ' +
-					'height=' + this._tileSize + ' ' +
+					'width=' + this._tileWidthPx + ' ' +
+					'height=' + this._tileHeightPx + ' ' +
 					'tileposx=' + tilePositionsX + ' ' +
 					'tileposy=' + tilePositionsY + ' ' +
 					'tilewidth=' + this._tileWidthTwips + ' ' +
@@ -916,8 +916,8 @@ L.GridLayer = L.Layer.extend({
 				twips = this._coordsToTwips(coords);
 				msg = 'tile ' +
 					'part=' + coords.part + ' ' +
-					'width=' + this._tileSize + ' ' +
-					'height=' + this._tileSize + ' ' +
+					'width=' + this._tileWidthPx + ' ' +
+					'height=' + this._tileHeightPx + ' ' +
 					'tileposx=' + twips.x + ' '	+
 					'tileposy=' + twips.y + ' ' +
 					'tilewidth=' + this._tileWidthTwips + ' ' +
@@ -946,8 +946,8 @@ L.GridLayer = L.Layer.extend({
 				twips = this._coordsToTwips(coords);
 				msg = 'tilecombine ' +
 					'part=' + coords.part + ' ' +
-					'width=' + this._tileSize + ' ' +
-					'height=' + this._tileSize + ' ' +
+					'width=' + this._tileWidthPx + ' ' +
+					'height=' + this._tileHeightPx + ' ' +
 					'tileposx=' + tilePositionsX + ' '	+
 					'tileposy=' + tilePositionsY + ' ' +
 					'tilewidth=' + this._tileWidthTwips + ' ' +
diff --git a/loleaflet/src/layer/tile/ImpressTileLayer.js b/loleaflet/src/layer/tile/ImpressTileLayer.js
index 07bb75cc..da0166c6 100644
--- a/loleaflet/src/layer/tile/ImpressTileLayer.js
+++ b/loleaflet/src/layer/tile/ImpressTileLayer.js
@@ -67,8 +67,8 @@ L.ImpressTileLayer = L.TileLayer.extend({
 		{
 			var message = 'tilecombine ' +
 				'part=' + command.part + ' ' +
-				'width=' + this._tileSize + ' ' +
-				'height=' + this._tileSize + ' ' +
+				'width=' + this._tileWidthPx + ' ' +
+				'height=' + this._tileHeightPx + ' ' +
 				'tileposx=' + tilePositionsX + ' ' +
 				'tileposy=' + tilePositionsY + ' ' +
 				'tilewidth=' + this._tileWidthTwips + ' ' +
diff --git a/loleaflet/src/layer/tile/TileLayer.js b/loleaflet/src/layer/tile/TileLayer.js
index d47a6e5b..ef401ef7 100644
--- a/loleaflet/src/layer/tile/TileLayer.js
+++ b/loleaflet/src/layer/tile/TileLayer.js
@@ -57,10 +57,13 @@ L.TileLayer = L.GridLayer.extend({
 
 		options = L.setOptions(this, options);
 
-		// detecting retina displays, adjusting tileSize and zoom levels
-		if (options.detectRetina && L.Browser.retina && options.maxZoom > 0) {
+		this._tileWidthPx = options.tileSize;
+		this._tileHeightPx = options.tileSize;
 
-			options.tileSize = Math.floor(options.tileSize / 2);
+		// detecting retina displays, adjusting tileWidthPx, tileHeightPx and zoom levels
+		if (options.detectRetina && L.Browser.retina && options.maxZoom > 0) {
+			this._tileWidthPx *= 2;
+			this._tileHeightPx *= 2;
 			options.zoomOffset++;
 
 			options.minZoom = Math.max(0, options.minZoom);
@@ -134,8 +137,8 @@ L.TileLayer = L.GridLayer.extend({
 		this._previewInvalidations = [];
 		this._partPageRectanglesTwips = [];
 		this._partPageRectanglesPixels = [];
-		this._clientZoom = 'tilepixelwidth=' + this.options.tileSize + ' ' +
-			'tilepixelheight=' + this.options.tileSize + ' ' +
+		this._clientZoom = 'tilepixelwidth=' + this._tileWidthPx + ' ' +
+			'tilepixelheight=' + this._tileHeightPx + ' ' +
 			'tiletwipwidth=' + this.options.tileWidthTwips + ' ' +
 			'tiletwipheight=' + this.options.tileHeightTwips;
 
@@ -1837,8 +1840,8 @@ L.TileLayer = L.GridLayer.extend({
 	_onCellCursorShift: function (force) {
 		if (this._cellCursorMarker || force) {
 			this._map._socket.sendMessage('commandvalues command=.uno:CellCursor'
-			                     + '?outputHeight=' + this._tileSize
-			                     + '&outputWidth=' + this._tileSize
+			                     + '?outputHeight=' + this._tileWidthPx
+			                     + '&outputWidth=' + this._tileHeightPx
 			                     + '&tileHeight=' + this._tileWidthTwips
 			                     + '&tileWidth=' + this._tileHeightTwips);
 		}
@@ -1910,8 +1913,8 @@ L.TileLayer = L.GridLayer.extend({
 	},
 
 	_updateClientZoom: function () {
-		this._clientZoom = 'tilepixelwidth=' + this._tileSize + ' ' +
-			'tilepixelheight=' + this._tileSize + ' ' +
+		this._clientZoom = 'tilepixelwidth=' + this._tileWidthPx + ' ' +
+			'tilepixelheight=' + this._tileHeightPx + ' ' +
 			'tiletwipwidth=' + this._tileWidthTwips + ' ' +
 			'tiletwipheight=' + this._tileHeightTwips;
 	},
diff --git a/loleaflet/src/layer/tile/WriterTileLayer.js b/loleaflet/src/layer/tile/WriterTileLayer.js
index 7b93b237..9402f6c5 100644
--- a/loleaflet/src/layer/tile/WriterTileLayer.js
+++ b/loleaflet/src/layer/tile/WriterTileLayer.js
@@ -69,8 +69,8 @@ L.WriterTileLayer = L.TileLayer.extend({
 			// always 0 anyway
 			var message = 'tilecombine ' +
 				'part=' + command.part + ' ' +
-				'width=' + this._tileSize + ' ' +
-				'height=' + this._tileSize + ' ' +
+				'width=' + this._tileWidthPx + ' ' +
+				'height=' + this._tileHeightPx + ' ' +
 				'tileposx=' + tilePositionsX + ' ' +
 				'tileposy=' + tilePositionsY + ' ' +
 				'tilewidth=' + this._tileWidthTwips + ' ' +


More information about the Libreoffice-commits mailing list