[Libreoffice-commits] online.git: loleaflet/html loleaflet/src
Libreoffice Gerrit user
logerrit at kemper.freedesktop.org
Wed Nov 21 17:43:18 UTC 2018
loleaflet/html/loleaflet.html.m4 | 6 ++++--
loleaflet/src/core/Socket.js | 3 ++-
loleaflet/src/layer/tile/GridLayer.js | 2 +-
loleaflet/src/layer/tile/TileLayer.js | 4 ++--
loleaflet/src/map/Map.js | 7 +++++--
5 files changed, 14 insertions(+), 8 deletions(-)
New commits:
commit e7523c988844e1178ab8f96c131ce0ad5433d4c9
Author: Tor Lillqvist <tml at collabora.com>
AuthorDate: Wed Nov 21 19:08:03 2018 +0200
Commit: Tor Lillqvist <tml at collabora.com>
CommitDate: Wed Nov 21 19:42:27 2018 +0200
Factor out tile pixel size to a global setting
For now the same as before, 256, for both normal Online and mobile
app. If you want to experiment with another value, you only need to
change it in loleaflet.html.m4. I hope.
Note the FIXME in loleaflet/src/core/Socket.js.
Change-Id: Ic881758d7fa70bbfebcf932b7ed6a1da352e375d
diff --git a/loleaflet/html/loleaflet.html.m4 b/loleaflet/html/loleaflet.html.m4
index 3d8eb1a1d..5ac502fcf 100644
--- a/loleaflet/html/loleaflet.html.m4
+++ b/loleaflet/html/loleaflet.html.m4
@@ -143,7 +143,8 @@ ifelse(MOBILEAPP,[true],
window.accessHeader = '';
window.loleafletLogging = 'true';
window.outOfFocusTimeoutSecs = 1000000;
- window.idleTimeoutSecs = 1000000;],
+ window.idleTimeoutSecs = 1000000;
+ window.tileSize = 256;],
[window.host = '%HOST%';
window.serviceRoot = '%SERVICE_ROOT%';
window.accessToken = '%ACCESS_TOKEN%';
@@ -151,7 +152,8 @@ ifelse(MOBILEAPP,[true],
window.accessHeader = '%ACCESS_HEADER%';
window.loleafletLogging = '%LOLEAFLET_LOGGING%';
window.outOfFocusTimeoutSecs = %OUT_OF_FOCUS_TIMEOUT_SECS%;
- window.idleTimeoutSecs = %IDLE_TIMEOUT_SECS%;])
+ window.idleTimeoutSecs = %IDLE_TIMEOUT_SECS%;
+ window.tileSize = 256;])
</script>
<script>
diff --git a/loleaflet/src/core/Socket.js b/loleaflet/src/core/Socket.js
index 80f810926..1d66ce854 100644
--- a/loleaflet/src/core/Socket.js
+++ b/loleaflet/src/core/Socket.js
@@ -785,7 +785,8 @@ L.Socket = L.Class.extend({
if (command.type === 'presentation' &&
this._map.options.defaultZoom === this._map.options.zoom) {
// If we have a presentation document and the zoom level has not been set
- // in the options, resize the document so that it fits the viewing area
+ // in the options, resize the document so that it fits the viewing area.
+ // FIXME: Should this 256 be window.tileSize? Unclear to me.
var verticalTiles = this._map.getSize().y / 256;
tileWidthTwips = Math.round(command.height / verticalTiles);
tileHeightTwips = Math.round(command.height / verticalTiles);
diff --git a/loleaflet/src/layer/tile/GridLayer.js b/loleaflet/src/layer/tile/GridLayer.js
index d19e2d440..afca4f8b4 100644
--- a/loleaflet/src/layer/tile/GridLayer.js
+++ b/loleaflet/src/layer/tile/GridLayer.js
@@ -8,7 +8,7 @@ L.GridLayer = L.Layer.extend({
options: {
pane: 'tilePane',
- tileSize: 256,
+ tileSize: window.tileSize,
opacity: 1,
updateWhenIdle: L.Browser.mobile,
diff --git a/loleaflet/src/layer/tile/TileLayer.js b/loleaflet/src/layer/tile/TileLayer.js
index bbd18f4e3..6147276ff 100644
--- a/loleaflet/src/layer/tile/TileLayer.js
+++ b/loleaflet/src/layer/tile/TileLayer.js
@@ -1358,8 +1358,8 @@ L.TileLayer = L.GridLayer.extend({
else if (tile && typeof(img) == 'object') {
// 'Uint8Array' delta
var canvas = document.createElement('canvas');
- canvas.width = 256;
- canvas.height = 256;
+ canvas.width = window.tileSize;
+ canvas.height = window.tileSize;
var ctx = canvas.getContext('2d');
var oldImg = new Image();
diff --git a/loleaflet/src/map/Map.js b/loleaflet/src/map/Map.js
index 2bc7ff561..e24b0205c 100644
--- a/loleaflet/src/map/Map.js
+++ b/loleaflet/src/map/Map.js
@@ -17,8 +17,11 @@ L.Map = L.Evented.extend({
trackResize: true,
markerZoomAnimation: true,
defaultZoom: 10,
- tileWidthTwips: 3840,
- tileHeightTwips: 3840,
+ // 15 = 1440 twips-per-inch / 96 dpi.
+ // Chosen to match previous hardcoded value of 3840 for
+ // the current tile pixel size of 256.
+ tileWidthTwips: window.tileSize * 15,
+ tileHeightTwips: window.tileSize * 15,
urlPrefix: 'lool',
wopiSrc: '',
cursorURL: 'images/cursors'
More information about the Libreoffice-commits
mailing list