[Libreoffice-commits] online.git: Branch 'feature/calc-canvas' - loleaflet/src
Jan Holesovsky (via logerrit)
logerrit at kemper.freedesktop.org
Wed Sep 9 12:59:18 UTC 2020
loleaflet/src/layer/tile/CanvasTileLayer.js | 11 -----------
loleaflet/src/map/anim/Map.ZoomAnimation.js | 9 ++++++---
loleaflet/src/map/handler/Map.TouchGesture.js | 4 ++--
3 files changed, 8 insertions(+), 16 deletions(-)
New commits:
commit f471724fb263aa9282eec9b3e7d5a8eb8ed8d870
Author: Jan Holesovsky <kendy at collabora.com>
AuthorDate: Wed Sep 9 14:53:17 2020 +0200
Commit: Jan Holesovsky <kendy at collabora.com>
CommitDate: Wed Sep 9 14:57:36 2020 +0200
calc canvas: Better way to set up the zoom animation center and zoom.
Previously there was a problem with tiles that were loaded
asynchronously: When the 'onload' event triggered, we were out of the
swipe handling, so the just loaded tile was painted on its location
without considering the pinch-to-zoom center - that is changing during
the pinch-to-zoom.
Change-Id: I625ab513e5499c1423a335e6b3c88a3024856205
diff --git a/loleaflet/src/layer/tile/CanvasTileLayer.js b/loleaflet/src/layer/tile/CanvasTileLayer.js
index dd198966b..ab7850853 100644
--- a/loleaflet/src/layer/tile/CanvasTileLayer.js
+++ b/loleaflet/src/layer/tile/CanvasTileLayer.js
@@ -486,21 +486,10 @@ L.CanvasTileLayer = L.TileLayer.extend({
},
_animateZoom: function (e) {
- var oldAnimatingZoom = this._map._animatingZoom;
- var oldAnimateToZoom = this._map._animateToZoom;
- var oldAnimateToCenter = this._map._animateToCenter;
- this._map._animatingZoom = true;
- this._map._animateToZoom = e.zoom;
- this._map._animateToCenter = e.center;
-
this._update(e.center, e.zoom);
this._resetPreFetching(true);
this._onCurrentPageUpdate();
this._painter.update(this._painter);
-
- this._map._animatingZoom = oldAnimatingZoom;
- this._map._animateToZoom = oldAnimateToZoom;
- this._map._animateToCenter = oldAnimateToCenter;
},
_setZoomTransforms: function () {
diff --git a/loleaflet/src/map/anim/Map.ZoomAnimation.js b/loleaflet/src/map/anim/Map.ZoomAnimation.js
index 5b0b9ec1a..0a8a23133 100644
--- a/loleaflet/src/map/anim/Map.ZoomAnimation.js
+++ b/loleaflet/src/map/anim/Map.ZoomAnimation.js
@@ -8,7 +8,7 @@ L.Map.mergeOptions({
zoomAnimationThreshold: 4
});
-var zoomAnimated = L.DomUtil.TRANSITION && L.Browser.any3d && !L.Browser.mobileOpera && !(this._docLayer instanceof L.CanvasTileLayer);
+var zoomAnimated = L.DomUtil.TRANSITION && L.Browser.any3d && !L.Browser.mobileOpera;
if (zoomAnimated) {
@@ -18,7 +18,7 @@ if (zoomAnimated) {
// zoom transitions run with the same duration for all layers, so if one of transitionend events
// happens after starting zoom animation (propagating to the map pane), we know that it ended globally
- if (this._zoomAnimated) {
+ if (this._zoomAnimated && !(this._docLayer instanceof L.CanvasTileLayer)) {
this._createAnimProxy();
@@ -90,7 +90,7 @@ L.Map.include(!zoomAnimated ? {} : {
return true;
},
- _animateZoom: function (center, zoom, startAnim, noUpdate) {
+ _animateZoom: function (center, zoom, startAnim, noUpdate, endAnim) {
if (startAnim) {
this._animatingZoom = true;
@@ -99,6 +99,9 @@ L.Map.include(!zoomAnimated ? {} : {
this._animateToZoom = zoom;
L.DomUtil.addClass(this._mapPane, 'leaflet-zoom-anim');
+ } else if (endAnim) {
+ // explicitly end the zoom
+ this._animatingZoom = false;
}
this.fire('zoomanim', {
diff --git a/loleaflet/src/map/handler/Map.TouchGesture.js b/loleaflet/src/map/handler/Map.TouchGesture.js
index bcbc471f1..6e74651be 100644
--- a/loleaflet/src/map/handler/Map.TouchGesture.js
+++ b/loleaflet/src/map/handler/Map.TouchGesture.js
@@ -550,7 +550,7 @@ L.Map.TouchGesture = L.Handler.extend({
L.Util.cancelAnimFrame(this._animRequest);
this._animRequest = L.Util.requestAnimFrame(function () {
console.assert(typeof this._map._animateZoom === 'function');
- this._map._animateZoom(this._center, this._zoom, false, true);
+ this._map._animateZoom(this._center, this._zoom, /* startAnim = */ true, true);
}, this, true, this._map._container);
},
@@ -575,7 +575,7 @@ L.Map.TouchGesture = L.Handler.extend({
if (this._center) {
L.Util.cancelAnimFrame(this._animRequest);
console.assert(typeof this._map._animateZoom === 'function');
- this._map._animateZoom(this._center, finalZoom, true, true);
+ this._map._animateZoom(this._center, finalZoom, /* startAnim = */ false, true, /* endAnim = */ true);
}
if (this._map._docLayer && this._map._docLayer._annotations) {
More information about the Libreoffice-commits
mailing list