[Libreoffice-commits] online.git: 2 commits - loleaflet/README loleaflet/src
Mihai Varga
mihai.varga at collabora.com
Tue Aug 4 01:24:06 PDT 2015
loleaflet/README | 6 ++++++
loleaflet/src/control/Scroll.js | 19 +++++++++++++++++++
loleaflet/src/map/Map.js | 3 +++
3 files changed, 28 insertions(+)
New commits:
commit 840c87851b93df560e98f942b4b2cd23362fe7d2
Author: Mihai Varga <mihai.varga at collabora.com>
Date: Tue Aug 4 11:22:17 2015 +0300
loleaflet: allow specifying the imagePath in the map init
imagePath is used to load images
diff --git a/loleaflet/src/map/Map.js b/loleaflet/src/map/Map.js
index 1cf4091..3420044 100644
--- a/loleaflet/src/map/Map.js
+++ b/loleaflet/src/map/Map.js
@@ -53,6 +53,9 @@ L.Map = L.Evented.extend({
this.callInitHooks();
+ if (this.options.imagePath) {
+ L.Icon.Default.imagePath = this.options.imagePath;
+ }
this._addLayers(this.options.layers);
},
commit 305ddc4cc1dc92be301be27653868bd0eab38ea0
Author: Mihai Varga <mihai.varga at collabora.com>
Date: Tue Aug 4 11:09:10 2015 +0300
lolealfet: scrollOffset, scrollLeft, scrollTop methods
That scroll to an absolute value, and scrollOffset returns the
absloute offset relative to the beginning of the document
diff --git a/loleaflet/README b/loleaflet/README
index 1e36a95..c2f0531 100644
--- a/loleaflet/README
+++ b/loleaflet/README
@@ -117,6 +117,12 @@ Scroll (the following are measured in pixels):
+ scroll down by 'y' (or up if negative)
map.scrollRight(x)
+ scroll right by 'x' (or left if nevative)
+ map.scrollTop(y)
+ + scroll to 'y' offset relative to the beginning of the document
+ map.scrollLeft(x)
+ + scroll to 'x' offset relative to the beginning of the document
+ map.scrollOffset()
+ + returns the scroll offset relative to the beginning of the document
- events
map.on('docsize', function (e) {}) where:
+ e.x = document width
diff --git a/loleaflet/src/control/Scroll.js b/loleaflet/src/control/Scroll.js
index ba0b2de..e20b3e1 100644
--- a/loleaflet/src/control/Scroll.js
+++ b/loleaflet/src/control/Scroll.js
@@ -15,5 +15,24 @@ L.Map.include({
scrollRight: function (x) {
this.scroll(x, 0);
+ },
+
+ scrollOffset: function () {
+ var center = this.project(this.getCenter());
+ var centerOffset = center.subtract(this.getSize().divideBy(2));
+ var offset = {};
+ offset.x = centerOffset.x < 0 ? 0 : Math.round(centerOffset.x);
+ offset.y = centerOffset.y < 0 ? 0 : Math.round(centerOffset.y);
+ return offset;
+ },
+
+ scrollTop: function (y) {
+ var offset = this.scrollOffset();
+ this.panBy(new L.Point(0, y - offset.y), {animate: false});
+ },
+
+ scrollLeft: function (x) {
+ var offset = this.scrollOffset();
+ this.panBy(new L.Point(x - offset.x, 0), {animate: false});
}
});
More information about the Libreoffice-commits
mailing list