Skip to content

Commit

Permalink
In src/define/animation.js, properties.zoom may have a value like…
Browse files Browse the repository at this point in the history
… `{ 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
  • Loading branch information
maxkfranz committed Feb 7, 2020
1 parent 3bf1652 commit e8062ec
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/core/animation/ease.js
Expand Up @@ -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 ){
Expand Down
2 changes: 2 additions & 0 deletions src/define/animation.js
Expand Up @@ -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
}
}

Expand Down

0 comments on commit e8062ec

Please sign in to comment.