Reuse the frame state viewHints array if defined

This commit is contained in:
Frederic Junod
2016-04-14 10:36:12 +02:00
parent 8e1ffbf91e
commit 92c96b95f9
2 changed files with 10 additions and 3 deletions

View File

@@ -256,10 +256,17 @@ ol.View.prototype.getCenter = function() {
/**
* @param {Array.<number>=} opt_hints Destination array.
* @return {Array.<number>} Hint.
*/
ol.View.prototype.getHints = function() {
return this.hints_.slice();
ol.View.prototype.getHints = function(opt_hints) {
if (opt_hints !== undefined) {
opt_hints[0] = this.hints_[0];
opt_hints[1] = this.hints_[1];
return opt_hints;
} else {
return this.hints_.slice();
}
};