Deprecation warning for map.beforeRender() and ol.animation functions

This commit is contained in:
Tim Schaub
2016-11-06 17:00:23 -07:00
parent 7fde4a48f4
commit ea9fea000a
3 changed files with 12 additions and 1 deletions
+2 -1
View File
@@ -91,7 +91,8 @@
2, 2,
{ {
"allow": [ "allow": [
"assert" "assert",
"warn"
] ]
} }
], ],
+8
View File
@@ -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 * Generate an animated transition that will "bounce" the resolution as it
* approaches the final value. * approaches the final value.
* @param {olx.animation.BounceOptions} options Bounce options. * @param {olx.animation.BounceOptions} options Bounce options.
@@ -14,6 +15,7 @@ goog.require('ol.easing');
* @api * @api
*/ */
ol.animation.bounce = function(options) { ol.animation.bounce = function(options) {
ol.DEBUG && console.warn('ol.animation.bounce() is deprecated. Use view.animate() instead.');
var resolution = options.resolution; var resolution = options.resolution;
var start = options.start ? options.start : Date.now(); var start = options.start ? options.start : Date.now();
var duration = options.duration !== undefined ? options.duration : 1000; 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. * Generate an animated transition while updating the view center.
* @param {olx.animation.PanOptions} options Pan options. * @param {olx.animation.PanOptions} options Pan options.
* @return {ol.PreRenderFunction} Pre-render function. * @return {ol.PreRenderFunction} Pre-render function.
* @api * @api
*/ */
ol.animation.pan = function(options) { ol.animation.pan = function(options) {
ol.DEBUG && console.warn('ol.animation.pan() is deprecated. Use view.animate() instead.');
var source = options.source; var source = options.source;
var start = options.start ? options.start : Date.now(); var start = options.start ? options.start : Date.now();
var sourceX = source[0]; 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. * Generate an animated transition while updating the view rotation.
* @param {olx.animation.RotateOptions} options Rotate options. * @param {olx.animation.RotateOptions} options Rotate options.
* @return {ol.PreRenderFunction} Pre-render function. * @return {ol.PreRenderFunction} Pre-render function.
* @api * @api
*/ */
ol.animation.rotate = function(options) { 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 sourceRotation = options.rotation ? options.rotation : 0;
var start = options.start ? options.start : Date.now(); var start = options.start ? options.start : Date.now();
var duration = options.duration !== undefined ? options.duration : 1000; 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. * Generate an animated transition while updating the view resolution.
* @param {olx.animation.ZoomOptions} options Zoom options. * @param {olx.animation.ZoomOptions} options Zoom options.
* @return {ol.PreRenderFunction} Pre-render function. * @return {ol.PreRenderFunction} Pre-render function.
* @api * @api
*/ */
ol.animation.zoom = function(options) { ol.animation.zoom = function(options) {
ol.DEBUG && console.warn('ol.animation.zoom() is deprecated. Use view.animate() instead.');
var sourceResolution = options.resolution; var sourceResolution = options.resolution;
var start = options.start ? options.start : Date.now(); var start = options.start ? options.start : Date.now();
var duration = options.duration !== undefined ? options.duration : 1000; var duration = options.duration !== undefined ? options.duration : 1000;
+2
View File
@@ -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 * Add functions to be called before rendering. This can be used for attaching
* animations before updating the map's view. The {@link ol.animation} * animations before updating the map's view. The {@link ol.animation}
* namespace provides several static methods for creating prerender functions. * namespace provides several static methods for creating prerender functions.
@@ -519,6 +520,7 @@ ol.Map.prototype.addOverlayInternal_ = function(overlay) {
* @api * @api
*/ */
ol.Map.prototype.beforeRender = function(var_args) { ol.Map.prototype.beforeRender = function(var_args) {
ol.DEBUG && console.warn('map.beforeRender() is deprecated. Use view.animate() instead.');
this.render(); this.render();
Array.prototype.push.apply(this.preRenderFunctions_, arguments); Array.prototype.push.apply(this.preRenderFunctions_, arguments);
}; };