Remove ol.Map#withFrozenRendering
This commit is contained in:
@@ -215,18 +215,6 @@ ol.Map = function(options) {
|
|||||||
*/
|
*/
|
||||||
this.frameState_ = null;
|
this.frameState_ = null;
|
||||||
|
|
||||||
/**
|
|
||||||
* @private
|
|
||||||
* @type {number}
|
|
||||||
*/
|
|
||||||
this.freezeRenderingCount_ = 0;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @private
|
|
||||||
* @type {boolean}
|
|
||||||
*/
|
|
||||||
this.dirty_ = false;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
* @type {goog.events.Key}
|
* @type {goog.events.Key}
|
||||||
@@ -526,14 +514,6 @@ ol.Map.prototype.forEachFeatureAtPixel =
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Freeze rendering.
|
|
||||||
*/
|
|
||||||
ol.Map.prototype.freezeRendering = function() {
|
|
||||||
++this.freezeRenderingCount_;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the geographical coordinate for a browser event.
|
* Returns the geographical coordinate for a browser event.
|
||||||
* @param {Event} event Event.
|
* @param {Event} event Event.
|
||||||
@@ -1030,13 +1010,9 @@ ol.Map.prototype.renderSync = function() {
|
|||||||
* Request that renderFrame_ be called some time in the future.
|
* Request that renderFrame_ be called some time in the future.
|
||||||
*/
|
*/
|
||||||
ol.Map.prototype.render = function() {
|
ol.Map.prototype.render = function() {
|
||||||
if (this.freezeRenderingCount_ === 0) {
|
|
||||||
if (!this.animationDelay_.isActive()) {
|
if (!this.animationDelay_.isActive()) {
|
||||||
this.animationDelay_.start();
|
this.animationDelay_.start();
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
this.dirty_ = true;
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -1116,10 +1092,6 @@ ol.Map.prototype.renderFrame_ = function(time) {
|
|||||||
|
|
||||||
var i, ii, view2DState;
|
var i, ii, view2DState;
|
||||||
|
|
||||||
if (this.freezeRenderingCount_ !== 0) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check whether a size has non-zero width and height. Note that this
|
* Check whether a size has non-zero width and height. Note that this
|
||||||
* function is here because the compiler doesn't recognize that size is
|
* function is here because the compiler doesn't recognize that size is
|
||||||
@@ -1196,7 +1168,6 @@ ol.Map.prototype.renderFrame_ = function(time) {
|
|||||||
|
|
||||||
this.frameState_ = frameState;
|
this.frameState_ = frameState;
|
||||||
this.renderer_.renderFrame(frameState);
|
this.renderer_.renderFrame(frameState);
|
||||||
this.dirty_ = false;
|
|
||||||
|
|
||||||
if (!goog.isNull(frameState)) {
|
if (!goog.isNull(frameState)) {
|
||||||
if (frameState.animate) {
|
if (frameState.animate) {
|
||||||
@@ -1279,17 +1250,6 @@ goog.exportProperty(
|
|||||||
ol.Map.prototype.setView);
|
ol.Map.prototype.setView);
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Unfreeze rendering.
|
|
||||||
*/
|
|
||||||
ol.Map.prototype.unfreezeRendering = function() {
|
|
||||||
goog.asserts.assert(this.freezeRenderingCount_ > 0);
|
|
||||||
if (--this.freezeRenderingCount_ === 0 && this.dirty_) {
|
|
||||||
this.animationDelay_.fire();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Force a recalculation of the map viewport size. This should be called when
|
* Force a recalculation of the map viewport size. This should be called when
|
||||||
* third-party code changes the size of the map viewport.
|
* third-party code changes the size of the map viewport.
|
||||||
@@ -1313,21 +1273,6 @@ ol.Map.prototype.updateSize = function() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param {function(this: T)} f Function.
|
|
||||||
* @param {T=} opt_this The object to use as `this` in `f`.
|
|
||||||
* @template T
|
|
||||||
*/
|
|
||||||
ol.Map.prototype.withFrozenRendering = function(f, opt_this) {
|
|
||||||
this.freezeRendering();
|
|
||||||
try {
|
|
||||||
f.call(opt_this);
|
|
||||||
} finally {
|
|
||||||
this.unfreezeRendering();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @typedef {{controls: ol.Collection,
|
* @typedef {{controls: ol.Collection,
|
||||||
* deviceOptions: olx.DeviceOptions,
|
* deviceOptions: olx.DeviceOptions,
|
||||||
|
|||||||
Reference in New Issue
Block a user