loleaflet/src/control/Control.Parts.js |   14 ++++++++++----
 loleaflet/src/layer/tile/TileLayer.js  |    9 +++++----
 2 files changed, 15 insertions(+), 8 deletions(-)

New commits:
commit bc02be98122687e2d84dec061ec5e5e640573bbd
Author: Jan Holesovsky <ke...@collabora.com>
Date:   Mon May 25 18:43:18 2015 +0200

    Don't cycle the parts, stop at 0 / max.

diff --git a/loleaflet/src/control/Control.Parts.js 
b/loleaflet/src/control/Control.Parts.js
index 5aa3d28..254c10b 100644
--- a/loleaflet/src/control/Control.Parts.js
+++ b/loleaflet/src/control/Control.Parts.js
@@ -29,13 +29,17 @@ L.Control.Parts = L.Control.extend({
 
        _prevPart: function (e) {
                this._map.fire('prevpart');
-               this._currentPart -= 1;
+               if (this._currentPart > 0) {
+                       this._currentPart -= 1;
+               }
                this._updateDisabled();
        },
 
        _nextPart: function (e) {
                this._map.fire('nextpart');
-               this._currentPart += 1;
+               if (this._currentPart < this._parts - 1) {
+                       this._currentPart += 1;
+               }
                this._updateDisabled();
        },
 
@@ -56,13 +60,15 @@ L.Control.Parts = L.Control.extend({
 
        _updateDisabled: function () {
                var className = 'leaflet-disabled';
-               L.DomUtil.removeClass(this._prevPartButton, className);
-               L.DomUtil.removeClass(this._nextPartButton, className);
                if (this._currentPart === 0) {
                        L.DomUtil.addClass(this._prevPartButton, className);
+               } else {
+                       L.DomUtil.removeClass(this._prevPartButton, className);
                }
                if (this._currentPart === this._parts - 1) {
                        L.DomUtil.addClass(this._nextPartButton, className);
+               } else {
+                       L.DomUtil.removeClass(this._nextPartButton, className);
                }
        }
 });
diff --git a/loleaflet/src/layer/tile/TileLayer.js 
b/loleaflet/src/layer/tile/TileLayer.js
index 7f45261..db4f5c7 100644
--- a/loleaflet/src/layer/tile/TileLayer.js
+++ b/loleaflet/src/layer/tile/TileLayer.js
@@ -465,13 +465,14 @@ L.TileLayer = L.GridLayer.extend({
 
        _onSwitchPart: function (e) {
                if (e.type === 'prevpart') {
-                       this._currentPart -= 1;
-                       if (this._currentPart < 0) {
-                               this._currentPart = this._parts - 1;
+                       if (this._currentPart > 0) {
+                               this._currentPart -= 1;
                        }
                }
                else if (e.type === 'nextpart') {
-                       this._currentPart = (this._currentPart + 1) % 
this._parts;
+                       if (this._currentPart < this._parts - 1) {
+                               this._currentPart += 1;
+                       }
                }
                this._update();
                this._pruneTiles();
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to