[Libreoffice-commits] online.git: 3 commits - loleaflet/reference.html loleaflet/src
Pranav Kant
pranavk at collabora.co.uk
Tue Aug 16 08:20:58 UTC 2016
loleaflet/reference.html | 9 +++++++
loleaflet/src/layer/tile/TileLayer.js | 40 ++++++++++++++--------------------
2 files changed, 26 insertions(+), 23 deletions(-)
New commits:
commit 449861fa12409c608679e32726850899731c0a0a
Author: Pranav Kant <pranavk at collabora.co.uk>
Date: Tue Aug 16 13:29:35 2016 +0530
loleaflet: multi-view; better handling of polygons
diff --git a/loleaflet/src/layer/tile/TileLayer.js b/loleaflet/src/layer/tile/TileLayer.js
index d033c0a..da3062e 100644
--- a/loleaflet/src/layer/tile/TileLayer.js
+++ b/loleaflet/src/layer/tile/TileLayer.js
@@ -820,16 +820,14 @@ L.TileLayer = L.GridLayer.extend({
}
var polygons = L.PolyUtil.rectanglesToPolygons(rectangles, this);
- for (i = 0; i < polygons.length; i++) {
- var selection = new L.Polygon(polygons[i], {
- pointerEvents: 'none',
- fillColor: L.LOUtil.getViewIdHexColor(viewId),
- fillOpacity: 0.25,
- weight: 2,
- opacity: 0.25});
- this._viewSelections[viewId] = selection;
- this._viewSelectionsGroup.addLayer(selection);
- }
+ var selection = new L.Polygon(polygons, {
+ pointerEvents: 'none',
+ fillColor: L.LOUtil.getViewIdHexColor(viewId),
+ fillOpacity: 0.25,
+ weight: 2,
+ opacity: 0.25});
+ this._viewSelections[viewId] = selection;
+ this._viewSelectionsGroup.addLayer(selection);
}
},
commit eac8f32edada2dd4364e624af67483ec8492bef6
Author: Pranav Kant <pranavk at collabora.co.uk>
Date: Tue Aug 16 13:24:33 2016 +0530
loleaflet: Prevent creating Polygon instances unnecessarily
L.Polygon can take array of latlng pairs. Lets pass the full
array instead of passing each array element one by one and
creating Polygon instances everytime.
diff --git a/loleaflet/src/layer/tile/TileLayer.js b/loleaflet/src/layer/tile/TileLayer.js
index 5fd01f2..d033c0a 100644
--- a/loleaflet/src/layer/tile/TileLayer.js
+++ b/loleaflet/src/layer/tile/TileLayer.js
@@ -713,15 +713,13 @@ L.TileLayer = L.GridLayer.extend({
rectangles.push([bottomLeftTwips, bottomRightTwips, topLeftTwips, topRightTwips]);
}
var polygons = L.PolyUtil.rectanglesToPolygons(rectangles, this);
- for (var j = 0; j < polygons.length; j++) {
- var selection = new L.Polygon(polygons[j], {
+ var selection = new L.Polygon(polygons, {
pointerEvents: 'none',
fillColor: _fillColor,
fillOpacity: 0.25,
weight: 2,
opacity: 0.25});
- this._searchResultsLayer.addLayer(selection);
- }
+ this._searchResultsLayer.addLayer(selection);
}
}
},
@@ -777,15 +775,13 @@ L.TileLayer = L.GridLayer.extend({
}
var polygons = L.PolyUtil.rectanglesToPolygons(rectangles, this);
- for (i = 0; i < polygons.length; i++) {
- var selection = new L.Polygon(polygons[i], {
- pointerEvents: 'none',
- fillColor: '#43ACE8',
- fillOpacity: 0.25,
- weight: 2,
- opacity: 0.25});
- this._selections.addLayer(selection);
- }
+ var selection = new L.Polygon(polygons, {
+ pointerEvents: 'none',
+ fillColor: '#43ACE8',
+ fillOpacity: 0.25,
+ weight: 2,
+ opacity: 0.25});
+ this._selections.addLayer(selection);
if (this._selectionContentRequest) {
clearTimeout(this._selectionContentRequest);
}
commit 1b92b481ee83bd37b73ead2234703af175ff1ebc
Author: Pranav Kant <pranavk at collabora.co.uk>
Date: Tue Aug 16 13:01:24 2016 +0530
loleaflet: reference; add missing method to PolyUtil
diff --git a/loleaflet/reference.html b/loleaflet/reference.html
index ecc673c..c22c25a 100644
--- a/loleaflet/reference.html
+++ b/loleaflet/reference.html
@@ -6542,6 +6542,15 @@ Popups will also be automatically opened when the layer is clicked on and closed
<td>Clips the polygon geometry defined by the given points by rectangular bounds. Used by Leaflet to only show polygon points that are on the screen or near, increasing performance. Note that polygon points needs different algorithm for clipping than polyline, so there's a separate method for it.</td>
</tr>
+ <tr>
+ <td><code><b>rectanglesToPolygons</b>(
+ <nobr><<a href="#rectangle">Rectangles</a>[]> <i>rectangles</i></nobr>,
+ <nobr><<a href="#tilelayer">TileLayer</a>> <i>tilelayer</i> )</nobr>
+ </code></td>
+
+ <td><code><a href="#latlng">LatLng</a>[]</code></td>
+ <td>Accepts a array of rectangles and convert that into a polygon. Returned value consists of an array of <a href="#latlng">LatLng</a> pairs.</td>
+ </tr>
</table>
More information about the Libreoffice-commits
mailing list