[Libreoffice-commits] online.git: 3 commits - loleaflet/src
Mihai Varga
mihai.varga at collabora.com
Wed Jul 8 23:39:13 PDT 2015
loleaflet/src/control/Control.Search.js | 4 +++
loleaflet/src/control/Control.js | 8 ++++---
loleaflet/src/layer/tile/GridLayer.js | 36 +++++++++-----------------------
3 files changed, 20 insertions(+), 28 deletions(-)
New commits:
commit 1cea814fcbdb6b0d4d82c40c1fdd747814c451d0
Author: Mihai Varga <mihai.varga at collabora.com>
Date: Thu Jul 9 09:32:24 2015 +0300
loleaflet: removed unnecessary event
diff --git a/loleaflet/src/layer/tile/GridLayer.js b/loleaflet/src/layer/tile/GridLayer.js
index df2e744..6521d5f 100644
--- a/loleaflet/src/layer/tile/GridLayer.js
+++ b/loleaflet/src/layer/tile/GridLayer.js
@@ -694,11 +694,6 @@ L.GridLayer = L.Layer.extend({
L.DomUtil.addClass(tile.el, 'leaflet-tile-loaded');
- this.fire('tileload', {
- tile: tile.el,
- coords: coords
- });
-
if (this._noTilesToLoad()) {
this.fire('load');
}
commit 607ea7b453441712affdf095a367b7b099f49f49
Author: Mihai Varga <mihai.varga at collabora.com>
Date: Thu Jul 9 09:30:28 2015 +0300
loleaflet: fixed isValidTile method and when tilecanceling occurs
diff --git a/loleaflet/src/layer/tile/GridLayer.js b/loleaflet/src/layer/tile/GridLayer.js
index b658b28..df2e744 100644
--- a/loleaflet/src/layer/tile/GridLayer.js
+++ b/loleaflet/src/layer/tile/GridLayer.js
@@ -40,10 +40,6 @@ L.GridLayer = L.Layer.extend({
this._viewReset();
this._update();
this._map._docLayer = this;
- var mapDim = this._map.getSize();
- this._maxVisibleTiles =
- (Math.floor(mapDim.x / this._tileSize) + 2) *
- (Math.floor(mapDim.y / this._tileSize) + 2);
},
beforeAdd: function (map) {
@@ -484,6 +480,8 @@ L.GridLayer = L.Layer.extend({
}
}
+ // if there is no exiting tile in the current view
+ var newView = true;
// create a queue of coordinates to load tiles from
for (var j = tileRange.min.y; j <= tileRange.max.y; j++) {
for (var i = tileRange.min.x; i <= tileRange.max.x; i++) {
@@ -497,6 +495,7 @@ L.GridLayer = L.Layer.extend({
var tile = this._tiles[key];
if (tile) {
tile.current = true;
+ newView = false;
} else {
queue.push(coords);
}
@@ -504,7 +503,7 @@ L.GridLayer = L.Layer.extend({
}
if (queue.length !== 0) {
- if (queue.length > this._maxVisibleTiles) {
+ if (newView) {
// we know that a new set of tiles that cover the whole view has been requested
// so we're able to cancel the previous requests that are being processed
this._map.socket.send('canceltiles');
@@ -533,22 +532,14 @@ L.GridLayer = L.Layer.extend({
},
_isValidTile: function (coords) {
- var crs = this._map.options.crs;
-
- if (!crs.infinite) {
- // don't load tile if it's out of bounds and not wrapped
- var bounds = this._globalTileRange;
- if ((!crs.wrapLng && (coords.x < bounds.min.x || coords.x > bounds.max.x)) ||
- (!crs.wrapLat && (coords.y < bounds.min.y || coords.y > bounds.max.y))) { return false; }
+ if (coords.x < 0 || coords.y < 0) {
+ return false;
}
-
- if (coords.x < 0 || coords.y < 0) { return false; }
-
- if (!this.options.bounds) { return true; }
-
- // don't load tile if it doesn't intersect the bounds in options
- var tileBounds = this._tileCoordsToBounds(coords);
- return L.latLngBounds(this.options.bounds).intersects(tileBounds);
+ if (coords.x * this._tileWidthTwips > this._docWidthTwips ||
+ coords.y * this._tileHeightTwips > this._docHeightTwips) {
+ return false;
+ }
+ return true;
},
_keyToBounds: function (key) {
commit ddaa3b49c14b6c9ee4470830d5db175bb6457a81
Author: Mihai Varga <mihai.varga at collabora.com>
Date: Thu Jul 9 09:28:41 2015 +0300
loleaflet: restore focus to the document after toolbar interaction
diff --git a/loleaflet/src/control/Control.Search.js b/loleaflet/src/control/Control.Search.js
index c007067..39e7cb7 100644
--- a/loleaflet/src/control/Control.Search.js
+++ b/loleaflet/src/control/Control.Search.js
@@ -72,6 +72,7 @@ L.Control.Search = L.Control.extend({
this._map.socket.send('uno .uno:ExecuteSearch ' + JSON.stringify(this._searchCmd));
delete this._searchCmd['SearchItem.SearchStartPointX'];
delete this._searchCmd['SearchItem.SearchStartPointY'];
+ this._refocusOnMap();
}
},
@@ -89,12 +90,14 @@ L.Control.Search = L.Control.extend({
this._searchCmd['SearchItem.Backward'].value = true;
this._searchCmd['SearchItem.SearchString'].value = this._searchBar.value;
this._map.socket.send('uno .uno:ExecuteSearch ' + JSON.stringify(this._searchCmd));
+ this._refocusOnMap();
},
_searchNext: function () {
this._searchCmd['SearchItem.Backward'].value = false;
this._searchCmd['SearchItem.SearchString'].value = this._searchBar.value;
this._map.socket.send('uno .uno:ExecuteSearch ' + JSON.stringify(this._searchCmd));
+ this._refocusOnMap();
},
_cancel: function () {
@@ -102,6 +105,7 @@ L.Control.Search = L.Control.extend({
this._map.fire('clearselection');
this._disabled = true;
this._updateDisabled();
+ this._refocusOnMap();
},
_createSearchBar: function(title, className, container, fn) {
diff --git a/loleaflet/src/control/Control.js b/loleaflet/src/control/Control.js
index 2ce6973..2dd433b 100644
--- a/loleaflet/src/control/Control.js
+++ b/loleaflet/src/control/Control.js
@@ -71,9 +71,11 @@ L.Control = L.Class.extend({
return this;
},
- _refocusOnMap: function (e) {
- // if map exists and event is not a keyboard event
- if (this._map && e && e.screenX > 0 && e.screenY > 0) {
+ _refocusOnMap: function () {
+ if (this._map._docLayer._editMode) {
+ this._map._docLayer._textArea.focus();
+ }
+ else {
this._map.getContainer().focus();
}
}
More information about the Libreoffice-commits
mailing list