Cache the result of goog.object.getCount

This commit is contained in:
Frederic Junod
2014-03-18 08:50:45 +01:00
parent a2375d58b6
commit 6d4552c783
+3 -4
View File
@@ -124,10 +124,9 @@ ol.pointer.TouchSource.prototype.isPrimaryTouch_ = function(inTouch) {
* @private * @private
*/ */
ol.pointer.TouchSource.prototype.setPrimaryTouch_ = function(inTouch) { ol.pointer.TouchSource.prototype.setPrimaryTouch_ = function(inTouch) {
if (goog.object.getCount(this.pointerMap) === 0 || var count = goog.object.getCount(this.pointerMap);
(goog.object.getCount(this.pointerMap) === 1 && if (count === 0 || (count === 1 && goog.object.containsKey(this.pointerMap,
goog.object.containsKey(this.pointerMap, ol.pointer.MouseSource.POINTER_ID.toString()))) {
ol.pointer.MouseSource.POINTER_ID.toString()))) {
this.firstTouchId_ = inTouch.identifier; this.firstTouchId_ = inTouch.identifier;
this.cancelResetClickCount_(); this.cancelResetClickCount_();
} }