From ea9fea000a7afc2a7ce93fc981a816a301f230b9 Mon Sep 17 00:00:00 2001 From: Tim Schaub Date: Sun, 6 Nov 2016 17:00:23 -0700 Subject: [PATCH] Deprecation warning for map.beforeRender() and ol.animation functions --- package.json | 3 ++- src/ol/animation.js | 8 ++++++++ src/ol/map.js | 2 ++ 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 16d3fe0d0f..e7240ef2c1 100644 --- a/package.json +++ b/package.json @@ -91,7 +91,8 @@ 2, { "allow": [ - "assert" + "assert", + "warn" ] } ], diff --git a/src/ol/animation.js b/src/ol/animation.js index b32d4de422..ec555c1fef 100644 --- a/src/ol/animation.js +++ b/src/ol/animation.js @@ -7,6 +7,7 @@ goog.require('ol.easing'); /** + * Deprecated (use {@link ol.View#animate} instead). * Generate an animated transition that will "bounce" the resolution as it * approaches the final value. * @param {olx.animation.BounceOptions} options Bounce options. @@ -14,6 +15,7 @@ goog.require('ol.easing'); * @api */ ol.animation.bounce = function(options) { + ol.DEBUG && console.warn('ol.animation.bounce() is deprecated. Use view.animate() instead.'); var resolution = options.resolution; var start = options.start ? options.start : Date.now(); var duration = options.duration !== undefined ? options.duration : 1000; @@ -45,12 +47,14 @@ ol.animation.bounce = function(options) { /** + * Deprecated (use {@link ol.View#animate} instead). * Generate an animated transition while updating the view center. * @param {olx.animation.PanOptions} options Pan options. * @return {ol.PreRenderFunction} Pre-render function. * @api */ ol.animation.pan = function(options) { + ol.DEBUG && console.warn('ol.animation.pan() is deprecated. Use view.animate() instead.'); var source = options.source; var start = options.start ? options.start : Date.now(); var sourceX = source[0]; @@ -86,12 +90,14 @@ ol.animation.pan = function(options) { /** + * Deprecated (use {@link ol.View#animate} instead). * Generate an animated transition while updating the view rotation. * @param {olx.animation.RotateOptions} options Rotate options. * @return {ol.PreRenderFunction} Pre-render function. * @api */ ol.animation.rotate = function(options) { + ol.DEBUG && console.warn('ol.animation.rotate() is deprecated. Use view.animate() instead.'); var sourceRotation = options.rotation ? options.rotation : 0; var start = options.start ? options.start : Date.now(); var duration = options.duration !== undefined ? options.duration : 1000; @@ -133,12 +139,14 @@ ol.animation.rotate = function(options) { /** + * Deprecated (use {@link ol.View#animate} instead). * Generate an animated transition while updating the view resolution. * @param {olx.animation.ZoomOptions} options Zoom options. * @return {ol.PreRenderFunction} Pre-render function. * @api */ ol.animation.zoom = function(options) { + ol.DEBUG && console.warn('ol.animation.zoom() is deprecated. Use view.animate() instead.'); var sourceResolution = options.resolution; var start = options.start ? options.start : Date.now(); var duration = options.duration !== undefined ? options.duration : 1000; diff --git a/src/ol/map.js b/src/ol/map.js index 78c989b7b3..91ef5674ee 100644 --- a/src/ol/map.js +++ b/src/ol/map.js @@ -512,6 +512,7 @@ ol.Map.prototype.addOverlayInternal_ = function(overlay) { /** + * Deprecated (use {@link ol.View#animate} instead). * Add functions to be called before rendering. This can be used for attaching * animations before updating the map's view. The {@link ol.animation} * namespace provides several static methods for creating prerender functions. @@ -519,6 +520,7 @@ ol.Map.prototype.addOverlayInternal_ = function(overlay) { * @api */ ol.Map.prototype.beforeRender = function(var_args) { + ol.DEBUG && console.warn('map.beforeRender() is deprecated. Use view.animate() instead.'); this.render(); Array.prototype.push.apply(this.preRenderFunctions_, arguments); };