Allow for immediate rendering

There is not currently a need for immediate rendering (so this change is not strictly necessary and could be reverted).  If there is a need for immediate rendering, an alternate method can be provided, or an optional argument could be allowed.
This commit is contained in:
Tim Schaub
2012-10-05 23:47:35 -06:00
parent 1092a21333
commit 78e6a635f9

View File

@@ -652,12 +652,20 @@ ol.Map.prototype.recalculateTransforms_ = function() {
/**
* Render.
* Render the map. Map rendering will be called with requestAnimationFrame
* or in a timeout depending on the environment.
*
* @param {boolean=} opt_force Render immediately. If called with force,
* rendering will occur before method returns. If called without force,
* method will return before rendering occurs.
*/
ol.Map.prototype.render = function() {
if (!this.pendingRender_) {
this.delayedRender_.start();
ol.Map.prototype.render = function(opt_force) {
if (opt_force) {
this.delayedRender_.stop();
this.renderFrame_();
} else if (!this.pendingRender_) {
this.pendingRender_ = true;
this.delayedRender_.start();
}
};