Don't use getHints if it's not needed

memory optimization: `getHints` creates a copy of the hints array.
This commit is contained in:
Frederic Junod
2017-11-08 11:45:23 +01:00
parent 82da43af35
commit 0d01a4ca0f

View File

@@ -341,7 +341,7 @@ ol.View.prototype.animate = function(var_args) {
* @api * @api
*/ */
ol.View.prototype.getAnimating = function() { ol.View.prototype.getAnimating = function() {
return this.getHints()[ol.ViewHint.ANIMATING] > 0; return this.hints_[ol.ViewHint.ANIMATING] > 0;
}; };
@@ -351,7 +351,7 @@ ol.View.prototype.getAnimating = function() {
* @api * @api
*/ */
ol.View.prototype.getInteracting = function() { ol.View.prototype.getInteracting = function() {
return this.getHints()[ol.ViewHint.INTERACTING] > 0; return this.hints_[ol.ViewHint.INTERACTING] > 0;
}; };
@@ -360,7 +360,7 @@ ol.View.prototype.getInteracting = function() {
* @api * @api
*/ */
ol.View.prototype.cancelAnimations = function() { ol.View.prototype.cancelAnimations = function() {
this.setHint(ol.ViewHint.ANIMATING, -this.getHints()[ol.ViewHint.ANIMATING]); this.setHint(ol.ViewHint.ANIMATING, -this.hints_[ol.ViewHint.ANIMATING]);
for (var i = 0, ii = this.animations_.length; i < ii; ++i) { for (var i = 0, ii = this.animations_.length; i < ii; ++i) {
var series = this.animations_[i]; var series = this.animations_[i];
if (series[0].callback) { if (series[0].callback) {