From e8062ec4d93fd62512c021141ae352858a488c5a Mon Sep 17 00:00:00 2001 From: Max Franz Date: Fri, 31 Jan 2020 16:14:35 -0500 Subject: [PATCH] In `src/define/animation.js`, `properties.zoom` may have a value like `{ level: 1 }` if an invalid zoom level is specified. The application of a zoom animation to the current zoom level is invalid. For example, animating from zoom:1 to zoom:1 doesn't make sense. When there is a case of an invalid zoom animation, the entire `zoom` animation value is discarded. This voids the animation. In the easing application routine, there is now an extra check for equal start and end values. While this does not affect the code path for the zoom:1 to zoom:1 example, it adds an extra layer of safety. Ref : Specifying a no-effect zoom animation causes an error #2614 --- src/core/animation/ease.js | 4 ++++ src/define/animation.js | 2 ++ 2 files changed, 6 insertions(+) diff --git a/src/core/animation/ease.js b/src/core/animation/ease.js index 2cc0d6bd9..550b44bea 100644 --- a/src/core/animation/ease.js +++ b/src/core/animation/ease.js @@ -5,6 +5,10 @@ function getEasedValue( type, start, end, percent, easingFn ){ return end; } + if( start === end ){ + return end; + } + let val = easingFn( start, end, percent ); if( type == null ){ diff --git a/src/define/animation.js b/src/define/animation.js index 84d12f3f6..ec3ba5f41 100644 --- a/src/define/animation.js +++ b/src/define/animation.js @@ -156,6 +156,8 @@ let define = { if( vp.zoomed ){ properties.zoom = vp.zoom; } if( vp.panned ){ properties.pan = vp.pan; } + } else { + properties.zoom = null; // an inavalid zoom (e.g. no delta) gets automatically destroyed } }