loleaflet/Makefile | 3 ++- loleaflet/spec/tilebench.html | 10 ++-------- loleaflet/spec/tilebench/TileBenchSpec.js | 15 +++++++++++++-- loleaflet/src/layer/tile/GridLayer.js | 30 ++++++++++++++++++++++++++++++ loleaflet/src/map/Map.js | 5 +++++ 5 files changed, 52 insertions(+), 11 deletions(-)
New commits: commit ebcf779d785d40c6aa670451d9d02ffdd2396430 Author: Mihai Varga <[email protected]> Date: Thu Dec 3 22:55:14 2015 +0200 loleaflet: include reference.html in the tarball diff --git a/loleaflet/Makefile b/loleaflet/Makefile index 3d0554a..6eab4b4 100644 --- a/loleaflet/Makefile +++ b/loleaflet/Makefile @@ -17,7 +17,8 @@ dist: all rm -rf loleaflet-$(VERSION) mkdir loleaflet-$(VERSION) cp README loleaflet-$(VERSION) - tar cf - dist plugins/draw-$(DRAW_VERSION)/dist debug/document src/scrollbar | (cd loleaflet-$(VERSION) && tar xf -) + cp reference.html loleaflet-$(VERSION) + tar cf - dist plugins/draw-$(DRAW_VERSION)/dist debug/document src/scrollbar docs | (cd loleaflet-$(VERSION) && tar xf -) tar cfz loleaflet-$(VERSION).tar.gz loleaflet-$(VERSION) rm -rf loleaflet-$(VERSION) commit 493d560203580cb7499b0c88682d3dd9c959b247 Author: Mihai Varga <[email protected]> Date: Thu Dec 3 22:47:10 2015 +0200 loleaflet: the current tilebench replay only works for text docs diff --git a/loleaflet/spec/tilebench/TileBenchSpec.js b/loleaflet/spec/tilebench/TileBenchSpec.js index 841b5d9..9724d57 100644 --- a/loleaflet/spec/tilebench/TileBenchSpec.js +++ b/loleaflet/spec/tilebench/TileBenchSpec.js @@ -146,6 +146,7 @@ describe('TileBench', function () { done(); }; + // since we don't click anywhere, this replay will only work for text documents var keyInput = [ [135, 'key type=input char=84 key=0'], [237, 'key type=up char=0 key=16'], commit 4a1ec210ed4abfcb1f1b84e3fd8d8378826ae79c Author: Mihai Varga <[email protected]> Date: Thu Dec 3 22:44:16 2015 +0200 loleaflet: allow adding the file_path and host for tilebench diff --git a/loleaflet/spec/tilebench/TileBenchSpec.js b/loleaflet/spec/tilebench/TileBenchSpec.js index 120665e..841b5d9 100644 --- a/loleaflet/spec/tilebench/TileBenchSpec.js +++ b/loleaflet/spec/tilebench/TileBenchSpec.js @@ -11,15 +11,24 @@ describe('TileBench', function () { li.style.class = 'test pass'; li.innerHTML = '<h2>' + msg + '</h2>'; cont.appendChild(li); - } + }; + + var getParameterByName = function (name) { + name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]"); + var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"), + results = regex.exec(location.search); + return results === null ? "" : results[1].replace(/\+/g, " "); + }; before(function () { var htmlPath = window.location.pathname; var dir = htmlPath.substring(0, htmlPath.lastIndexOf('/')); var fileURL = 'file://' + dir + '/data/eval.odt'; + fileURL = getParameterByName('file_path') || fileURL; + var server = getParameterByName('host') || 'ws://localhost:9980'; // initialize the map and load the document map = L.map('map', { - server: 'ws://localhost:9980', + server: server, doc: fileURL, edit: false, readOnly: false commit 552514c35dc7c6ed0d99a9083b3762eb38155873 Author: Mihai Varga <[email protected]> Date: Thu Dec 3 22:37:22 2015 +0200 loleaflet: hide the document container after running tilebench diff --git a/loleaflet/spec/tilebench/TileBenchSpec.js b/loleaflet/spec/tilebench/TileBenchSpec.js index 6abd54e..120665e 100644 --- a/loleaflet/spec/tilebench/TileBenchSpec.js +++ b/loleaflet/spec/tilebench/TileBenchSpec.js @@ -43,6 +43,7 @@ describe('TileBench', function () { after(function () { map.remove(); + document.getElementById('document-container').style.visibility = 'hidden'; }); describe('Benchmarking', function () { commit c57cd5b46830cb83908a0ef4aad701cfcfdbb336 Author: Mihai Varga <[email protected]> Date: Thu Dec 3 22:21:59 2015 +0200 loleaflet: remove the scrollbar from tilebench.html diff --git a/loleaflet/spec/tilebench.html b/loleaflet/spec/tilebench.html index 4cf5f50..8f4cdb1 100644 --- a/loleaflet/spec/tilebench.html +++ b/loleaflet/spec/tilebench.html @@ -5,7 +5,6 @@ <title>LOOL Spec Runner</title> <link rel="stylesheet" type="text/css" href="../node_modules/mocha/mocha.css"> <link rel="stylesheet" type="text/css" href="../dist/leaflet.css"> - <link rel="stylesheet" type="text/css" href="../src/scrollbar/jquery.mCustomScrollbar.css"> <link rel="stylesheet" type="text/css" href="../dist/dialog/vex.css" /> <link rel="stylesheet" type="text/css" href="../dist/dialog/vex-theme-plain.css" /> </head> @@ -15,16 +14,11 @@ <script type="text/javascript" src="../node_modules/mocha/mocha.js"></script> <script type="text/javascript" src="../node_modules/happen/happen.js"></script> <script type="text/javascript" src="sinon.js"></script> - <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script> - <script>window.jQuery || document.write('<script src="../src/scrollbar/jquery-1.11.0.min.js"><\/script>')</script> - <script src="../src/scrollbar/jquery.mCustomScrollbar.js"></script> <script src="../dist/dialog/vex.combined.min.js"></script> <script>vex.defaultOptions.className = 'vex-theme-plain';</script> <!-- source files --> - <script type="text/javascript" src="../build/deps.js"></script> - - <script type="text/javascript" src="../debug/leaflet-include.js"></script> + <script type="text/javascript" src="../dist/leaflet-src.js"></script> <script> mocha.setup({ @@ -38,7 +32,7 @@ <div id="toolbar" style="hidden"> </div> - <div id="document-container" style="top:300px"> + <div id="document-container" style="top:210px"> <div id="map"></div> </div> commit cfda6755373b1060f433407978b6307ec73066a7 Author: Mihai Varga <[email protected]> Date: Wed Dec 2 14:16:35 2015 +0200 loleaflet: glue the spreadsheet to the row/column headers Previously when the spreadsheet was zoomed out and it was smaller than the viewing area, the document would've been centered diff --git a/loleaflet/src/layer/tile/GridLayer.js b/loleaflet/src/layer/tile/GridLayer.js index df981f5..e023189 100644 --- a/loleaflet/src/layer/tile/GridLayer.js +++ b/loleaflet/src/layer/tile/GridLayer.js @@ -389,6 +389,36 @@ L.GridLayer = L.Layer.extend({ this._map.fire('docsize', {x: scrollPixelLimits.x, y: scrollPixelLimits.y}); }, + _checkSpreadSheetBounds: function (newZoom) { + // for spreadsheets, when the document is smaller than the viewing area + // we want it to be glued to the row/column headers instead of being centered + // In the future we probably want to remove this and set the bonds only on the + // left/upper side of the spreadsheet so that we can have an 'infinite' number of + // cells downwards and to the right, like we have on desktop + var viewSize = this._map.getSize(); + var scale = this._map.getZoomScale(newZoom); + var width = this._docWidthTwips / this._tileWidthTwips * this._tileSize * scale; + var height = this._docHeightTwips / this._tileHeightTwips * this._tileSize * scale; + if (width < viewSize.x || height < viewSize.y) { + // if after zoomimg the document becomes smaller than the viewing area + width = Math.max(width, viewSize.x); + height = Math.max(height, viewSize.y); + if (!this._map.options._origMaxBounds) { + this._map.options._origMaxBounds = this._map.options.maxBounds; + } + scale = this._map.options.crs.scale(1); + this._map.setMaxBounds(new L.LatLngBounds( + this._map.unproject(new L.Point(0, 0)), + this._map.unproject(new L.Point(width * scale, height * scale)))); + } + else if (this._map.options._origMaxBounds) { + // if after zoomimg the document becomes larger than the viewing area + // we need to restore the inital bounds + this._map.setMaxBounds(this._map.options._origMaxBounds); + this._map.options._origMaxBounds = null; + } + }, + _updateScrollOffset: function () { var centerPixel = this._map.project(this._map.getCenter()); var newScrollPos = centerPixel.subtract(this._map.getSize().divideBy(2)); diff --git a/loleaflet/src/map/Map.js b/loleaflet/src/map/Map.js index 28c2209..7dd0ce5 100644 --- a/loleaflet/src/map/Map.js +++ b/loleaflet/src/map/Map.js @@ -74,6 +74,11 @@ L.Map = L.Evented.extend({ this._zoom = this._limitZoom(zoom); return this; } + if (this._docLayer && this._docLayer._docType === 'spreadsheet') { + // for spreadsheets, when the document is smaller than the viewing area + // we want it to be glued to the row/column headers instead of being centered + this._docLayer._checkSpreadSheetBounds(zoom); + } return this.setView(this.getCenter(), zoom, {zoom: options}); }, _______________________________________________ Libreoffice-commits mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
