loleaflet/src/layer/marker/ProgressOverlay.js | 54 +++++++++++++++++++++++++- loleaflet/src/layer/tile/TileLayer.js | 6 -- loleaflet/src/map/Map.js | 14 ------ 3 files changed, 55 insertions(+), 19 deletions(-)
New commits: commit 0cf416e736abfaa1d4d26674514040f2f43fc0a6 Author: Michael Meeks <michael.me...@collabora.com> AuthorDate: Fri Oct 4 17:11:46 2019 +0100 Commit: Michael Meeks <michael.me...@collabora.com> CommitDate: Fri Oct 4 17:12:32 2019 +0100 Spinner: accelerate the spin, and hold off showing the progress bar. Ironically the progress bar makes people think something is slow. Change-Id: I3fb85ba1a44cdb436159abe5448d71b666020c5c diff --git a/loleaflet/src/layer/marker/ProgressOverlay.js b/loleaflet/src/layer/marker/ProgressOverlay.js index 93835c583..7100243d8 100644 --- a/loleaflet/src/layer/marker/ProgressOverlay.js +++ b/loleaflet/src/layer/marker/ProgressOverlay.js @@ -6,13 +6,15 @@ L.ProgressOverlay = L.Layer.extend({ options: { - spinnerSpeed: 15 + spinnerSpeed: 30 }, initialize: function (latlng, size) { this._latlng = L.latLng(latlng); this._size = size; + this._percent = 0; this._initLayout(); + this.intervalTimer = undefined; }, onAdd: function () { @@ -67,6 +69,55 @@ L.ProgressOverlay = L.Layer.extend({ L.DomUtil.setPosition(this._container, pos); }, + shutdownTimer: function() { + if (this.intervalTimer) + clearInterval(this.intervalTimer); + this.intervalTimer = undefined; + }, + + // Show the progress bar, but only if things seem slow + delayedStart: function(map, label, bar) { + this.setLabel(label); + this.setBar(false); + this.setValue(0); + + this.shutdownTimer(); + + var self = this; + self.state = 0; + this.intervalTimer = setInterval( + function() { + self.state = self.state + 1; + switch (self.state) { + // 0.5s -> start the spinner + case 1: + if (!map.hasLayer(self)) + map.addLayer(self); + break; + // 2s -> enable the progress bar if we have one & it's low + case 4: + if (self._percent < 80) + self.setBar(bar); + break; + // 3s -> show the bar if it's not up. + case 6: + self.setBar(bar); + break; + } + if (!map.hasLayer(self)) { + map.addLayer(self); + } + }, 500 /* ms */); + }, + + // Hide ourselves if there is anything to hide + end: function(map) { + this.shutdownTimer(); + if (map.hasLayer(this)) { + map.removeLayer(this); + } + }, + setLabel: function (label) { if (this._label.innerHTML !== label) { this._label.innerHTML = label; @@ -83,6 +134,7 @@ L.ProgressOverlay = L.Layer.extend({ }, setValue: function (value) { + this._percent = value; this._bar.style.width = value + '%'; this._value.innerHTML = value + '%'; } diff --git a/loleaflet/src/map/Map.js b/loleaflet/src/map/Map.js index 1b5b78b68..f201ed847 100644 --- a/loleaflet/src/map/Map.js +++ b/loleaflet/src/map/Map.js @@ -425,22 +425,12 @@ L.Map = L.Evented.extend({ this.fire('showbusy', {label: label}); return; } - - this._progressBar.setLabel(label); - this._progressBar.setBar(bar); - this._progressBar.setValue(0); - - if (!this.hasLayer(this._progressBar)) { - this.addLayer(this._progressBar); - } + this._progressBar.delayedStart(this, label, bar); }, hideBusy: function () { this.fire('hidebusy'); - - if (this.hasLayer(this._progressBar)) { - this.removeLayer(this._progressBar); - } + this._progressBar.end(this); }, setZoom: function (zoom, options) { commit b8326b9caa2f85c957eb95a310a25ba34dab9001 Author: Michael Meeks <michael.me...@collabora.com> AuthorDate: Fri Oct 4 16:33:07 2019 +0100 Commit: Michael Meeks <michael.me...@collabora.com> CommitDate: Fri Oct 4 17:12:32 2019 +0100 Remove unused method. Change-Id: Ibf50ddb79058e9793b0437bc265e3d8a1c25fc7c diff --git a/loleaflet/src/layer/tile/TileLayer.js b/loleaflet/src/layer/tile/TileLayer.js index db2da511d..1609b9ed0 100644 --- a/loleaflet/src/layer/tile/TileLayer.js +++ b/loleaflet/src/layer/tile/TileLayer.js @@ -1449,12 +1449,6 @@ L.TileLayer = L.GridLayer.extend({ this._updateReferenceMarks(); }, - _onTextSelectionContentMsg: function (textMsg) { - this._selectionTextContent = textMsg.substr(22); - this._map._clipboardContainer.setValue(this._selectionTextContent); - this._map._clipboardContainer.select(); - }, - _updateScrollOnCellSelection: function (oldSelection, newSelection) { if (this._map._docLayer._docType === 'spreadsheet' && oldSelection) { var mapBounds = this._map.getBounds(); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits