[Libreoffice-commits] online.git: 2 commits - loleaflet/spec loleaflet/src
Mihai Varga
mihai.varga at collabora.com
Wed Sep 2 11:37:37 PDT 2015
loleaflet/spec/tilebench/TileBenchSpec.js | 22 ----------------------
loleaflet/src/core/Socket.js | 11 ++++++++++-
loleaflet/src/layer/tile/TileLayer.js | 15 +++------------
3 files changed, 13 insertions(+), 35 deletions(-)
New commits:
commit d82488f0cee99841734fe6df029c04b0bf8765d3
Author: Mihai Varga <mihai.varga at collabora.com>
Date: Wed Sep 2 20:53:20 2015 +0300
loleaflet: remove the scrollbar from tilebench
diff --git a/loleaflet/spec/tilebench/TileBenchSpec.js b/loleaflet/spec/tilebench/TileBenchSpec.js
index 463f2d2..6416156 100644
--- a/loleaflet/spec/tilebench/TileBenchSpec.js
+++ b/loleaflet/spec/tilebench/TileBenchSpec.js
@@ -32,8 +32,6 @@ describe('TileBench', function () {
L.Log.log(msg, L.OUTGOING, coords, now);
this.socket.send(msg);
}, L.Socket);
-
- map.addControl(L.control.scroll());
});
afterEach(function () {
@@ -92,26 +90,6 @@ describe('TileBench', function () {
}, i), keyInput[i][0]);
}
});
-
- it('Scroll to the bottom', function (done) {
- $('.scroll-container').mCustomScrollbar('scrollTo', 'bottom', {scrollInertia: 3000});
- // check how we're doing 200ms after the scroll has ended
- // (allow enough time to request new tiles)
- timeOut = setTimeout(function () {
- if (map._docLayer._emptyTilesCount === 0) {
- // no pending tile requests
- done();
- }
- else {
- map.on('statusindicator', L.bind(function (e) {
- if (e.statusType === 'alltilesloaded') {
- clearTimeout(timeOut);
- done();
- }
- }, done));
- }
- }, 3200);
- });
});
var getTimes = function (done) {
commit 009e9e333749d16ed7daca15d16744c2226a598b
Author: Mihai Varga <mihai.varga at collabora.com>
Date: Wed Sep 2 20:00:42 2015 +0300
loleaflet: moved img decoding in L.Socket
This gives a better tile loading time by 10ms
diff --git a/loleaflet/src/core/Socket.js b/loleaflet/src/core/Socket.js
index 781c25b..4e2846f 100644
--- a/loleaflet/src/core/Socket.js
+++ b/loleaflet/src/core/Socket.js
@@ -84,6 +84,15 @@ L.Socket = {
textMsg = String.fromCharCode.apply(null, imgBytes);
}
}
+ else {
+ var data = imgBytes.subarray(index + 1);
+ // read the tile data
+ var strBytes = '';
+ for (var i = 0; i < data.length; i++) {
+ strBytes += String.fromCharCode(data[i]);
+ }
+ var img = 'data:image/png;base64,' + window.btoa(strBytes);
+ }
if (textMsg.startsWith('status:') && !this._map._docLayer) {
// first status message, we need to create the document layer
@@ -112,7 +121,7 @@ L.Socket = {
this._map.addLayer(docLayer);
}
if (this._map._docLayer) {
- this._map._docLayer._onMessage(textMsg, imgBytes, index);
+ this._map._docLayer._onMessage(textMsg, img);
}
},
diff --git a/loleaflet/src/layer/tile/TileLayer.js b/loleaflet/src/layer/tile/TileLayer.js
index 877c67e..ae722bd 100644
--- a/loleaflet/src/layer/tile/TileLayer.js
+++ b/loleaflet/src/layer/tile/TileLayer.js
@@ -174,7 +174,7 @@ L.TileLayer = L.GridLayer.extend({
return tile;
},
- _onMessage: function (textMsg, imgBytes, index) {
+ _onMessage: function (textMsg, img) {
if (textMsg.startsWith('cursorvisible:')) {
this._onCursorVisibleMsg(textMsg);
}
@@ -221,7 +221,7 @@ L.TileLayer = L.GridLayer.extend({
this._onTextSelectionStartMsg(textMsg);
}
else if (textMsg.startsWith('tile:')) {
- this._onTileMsg(textMsg, imgBytes, index);
+ this._onTileMsg(textMsg, img);
}
},
@@ -379,22 +379,13 @@ L.TileLayer = L.GridLayer.extend({
},
- _onTileMsg: function (textMsg, imgBytes, index) {
+ _onTileMsg: function (textMsg, img) {
var command = L.Socket.parseServerCmd(textMsg);
var coords = this._twipsToCoords(command);
coords.z = command.zoom;
coords.part = command.part;
- var data = imgBytes.subarray(index + 1);
-
- // read the tile data
- var strBytes = '';
- for (var i = 0; i < data.length; i++) {
- strBytes += String.fromCharCode(data[i]);
- }
-
var key = this._tileCoordsToKey(coords);
var tile = this._tiles[key];
- var img = 'data:image/png;base64,' + window.btoa(strBytes);
if (command.id !== undefined) {
this._map.fire('tilepreview', {
tile: img,
More information about the Libreoffice-commits
mailing list