[Libreoffice-commits] online.git: loleaflet/src
Mihai Varga
mihai.varga at collabora.com
Fri May 29 04:19:03 PDT 2015
loleaflet/src/control/Control.Search.js | 15 +++++++++++++++
loleaflet/src/layer/tile/GridLayer.js | 2 +-
2 files changed, 16 insertions(+), 1 deletion(-)
New commits:
commit 865f23d4e7f5a0e677612fcc0490d7e44c7ba355
Author: Mihai Varga <mihai.varga at collabora.com>
Date: Fri May 29 14:18:39 2015 +0300
Use SearchItem.SearchStartPoint
diff --git a/loleaflet/src/control/Control.Search.js b/loleaflet/src/control/Control.Search.js
index 9f3708d..336b022 100644
--- a/loleaflet/src/control/Control.Search.js
+++ b/loleaflet/src/control/Control.Search.js
@@ -51,12 +51,27 @@ L.Control.Search = L.Control.extend({
_searchStart: function (e) {
this._map.fire('clearselection');
+ var viewTopLeftpx = this._map.project(this._map.getBounds().getNorthWest());
+ var docBoundsTopLeft = this._map.project(this._map.options.maxBounds.getNorthWest());
+ var topLeft = this._map.unproject(new L.Point(
+ Math.max(viewTopLeftpx.x, docBoundsTopLeft.x),
+ Math.max(viewTopLeftpx.y, docBoundsTopLeft.y)));
+ var topLeftTwips = this._map._docLayer._latLngToTwips(topLeft);
+
if (e.keyCode === 13 && this._searchBar.value !== '' ) {
this._disabled = false;
this._updateDisabled();
this._searchCmd['SearchItem.SearchString'].value = this._searchBar.value;
this._searchCmd['SearchItem.Backward'].value = false;
+ this._searchCmd['SearchItem.SearchStartPointX'] = {};
+ this._searchCmd['SearchItem.SearchStartPointX'].type = 'long';
+ this._searchCmd['SearchItem.SearchStartPointX'].value = topLeftTwips.x;
+ this._searchCmd['SearchItem.SearchStartPointY'] = {};
+ this._searchCmd['SearchItem.SearchStartPointY'].type = 'long';
+ this._searchCmd['SearchItem.SearchStartPointY'].value = topLeftTwips.y;
this._map.socket.send('uno .uno:ExecuteSearch ' + JSON.stringify(this._searchCmd));
+ delete this._searchCmd['SearchItem.SearchStartPointX'];
+ delete this._searchCmd['SearchItem.SearchStartPointY'];
}
},
diff --git a/loleaflet/src/layer/tile/GridLayer.js b/loleaflet/src/layer/tile/GridLayer.js
index 5b85b58..a3700e8 100644
--- a/loleaflet/src/layer/tile/GridLayer.js
+++ b/loleaflet/src/layer/tile/GridLayer.js
@@ -38,7 +38,7 @@ L.GridLayer = L.Layer.extend({
this._viewReset();
this._update();
-
+ this._map._docLayer = this;
},
beforeAdd: function (map) {
More information about the Libreoffice-commits
mailing list