From b1602877d9b2488ae90303892676d04d7d64d2c1 Mon Sep 17 00:00:00 2001 From: Frederic Junod Date: Wed, 12 Dec 2018 12:54:41 +0100 Subject: [PATCH] Remove type cast in ol.View --- src/ol/View.js | 31 ++++++++++++++----------------- 1 file changed, 14 insertions(+), 17 deletions(-) diff --git a/src/ol/View.js b/src/ol/View.js index bf23973caa..0b33692e0c 100644 --- a/src/ol/View.js +++ b/src/ol/View.js @@ -439,13 +439,14 @@ class View extends BaseObject { for (let i = 0; i < animationCount; ++i) { const options = /** @type {AnimationOptions} */ (arguments[i]); - const animation = /** @type {Animation} */ ({ + const animation = { start: start, complete: false, anchor: options.anchor, duration: options.duration !== undefined ? options.duration : 1000, - easing: options.easing || inAndOut - }); + easing: options.easing || inAndOut, + callback: callback + }; if (options.center) { animation.sourceCenter = center; @@ -471,8 +472,6 @@ class View extends BaseObject { rotation = animation.targetRotation; } - animation.callback = callback; - // check if animation is a no-op if (isNoopAnimation(animation)) { animation.complete = true; @@ -902,18 +901,16 @@ class View extends BaseObject { const resolution = /** @type {number} */ (this.getResolution()); const pixelResolution = resolution / pixelRatio; const rotation = this.getRotation(); - return ( - /** @type {State} */ ({ - center: [ - Math.round(center[0] / pixelResolution) * pixelResolution, - Math.round(center[1] / pixelResolution) * pixelResolution - ], - projection: projection !== undefined ? projection : null, - resolution: resolution, - rotation: rotation, - zoom: this.getZoom() - }) - ); + return { + center: [ + Math.round(center[0] / pixelResolution) * pixelResolution, + Math.round(center[1] / pixelResolution) * pixelResolution + ], + projection: projection !== undefined ? projection : null, + resolution: resolution, + rotation: rotation, + zoom: this.getZoom() + }; } /**