loleaflet/src/control/Control.Parts.js | 19 +++++++++++++++++++ loleaflet/src/layer/tile/TileLayer.js | 4 +++- 2 files changed, 22 insertions(+), 1 deletion(-)
New commits: commit 29d4296d12998852448be937c98247970c023483 Author: Mihai Varga <[email protected]> Date: Mon May 25 17:52:36 2015 +0300 Disable prev/next part buttons for the first/last part diff --git a/loleaflet/src/control/Control.Parts.js b/loleaflet/src/control/Control.Parts.js index 7b7cc6f..5aa3d28 100644 --- a/loleaflet/src/control/Control.Parts.js +++ b/loleaflet/src/control/Control.Parts.js @@ -21,15 +21,22 @@ L.Control.Parts = L.Control.extend({ this._nextPartButton = this._createButton(options.nextPartText, options.nextPartTitle, partName + '-next', container, this._nextPart); + this._parts = options.parts; + this._currentPart = options.currentPart; + this._updateDisabled(); return container; }, _prevPart: function (e) { this._map.fire('prevpart'); + this._currentPart -= 1; + this._updateDisabled(); }, _nextPart: function (e) { this._map.fire('nextpart'); + this._currentPart += 1; + this._updateDisabled(); }, _createButton: function (html, title, className, container, fn) { @@ -45,6 +52,18 @@ L.Control.Parts = L.Control.extend({ .on(link, 'click', this._refocusOnMap, this); return link; + }, + + _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); + } + if (this._currentPart === this._parts - 1) { + L.DomUtil.addClass(this._nextPartButton, className); + } } }); diff --git a/loleaflet/src/layer/tile/TileLayer.js b/loleaflet/src/layer/tile/TileLayer.js index a181c6f..7f45261 100644 --- a/loleaflet/src/layer/tile/TileLayer.js +++ b/loleaflet/src/layer/tile/TileLayer.js @@ -122,7 +122,9 @@ L.TileLayer = L.GridLayer.extend({ this._updateMaxBounds(); this._documentInfo = textMsg; if (this._parts === undefined && command.parts > 1) { - this._map.addControl(L.control.parts({'parts':command.parts})); + this._map.addControl(L.control.parts({ + 'parts': command.parts, + 'currentPart': command.currentPart})); } this._parts = command.parts; this._currentPart = command.currentPart; _______________________________________________ Libreoffice-commits mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
