Reuse previousExtent_ local variable

This commit is contained in:
Frederic Junod
2014-12-17 10:35:07 +01:00
parent 13ce41a1d5
commit 7c6ccca572
+3 -4
View File
@@ -215,7 +215,7 @@ ol.Map = function(options) {
* @private * @private
* @type {ol.Extent} * @type {ol.Extent}
*/ */
this.previousExtent_ = null; this.previousExtent_ = ol.extent.createEmpty();
/** /**
* @private * @private
@@ -1261,13 +1261,12 @@ ol.Map.prototype.renderFrame_ = function(time) {
var idle = this.preRenderFunctions_.length === 0 && var idle = this.preRenderFunctions_.length === 0 &&
!frameState.viewHints[ol.ViewHint.ANIMATING] && !frameState.viewHints[ol.ViewHint.ANIMATING] &&
!frameState.viewHints[ol.ViewHint.INTERACTING] && !frameState.viewHints[ol.ViewHint.INTERACTING] &&
(!this.previousExtent_ || !ol.extent.equals(frameState.extent, this.previousExtent_);
!ol.extent.equals(frameState.extent, this.previousExtent_));
if (idle) { if (idle) {
this.dispatchEvent( this.dispatchEvent(
new ol.MapEvent(ol.MapEventType.MOVEEND, this, frameState)); new ol.MapEvent(ol.MapEventType.MOVEEND, this, frameState));
this.previousExtent_ = ol.extent.clone(frameState.extent); ol.extent.clone(frameState.extent, this.previousExtent_);
} }
} }