use goog.bind, safari does not support the native bind
This commit is contained in:
@@ -68,6 +68,7 @@ ol.pointer.PointerEventHandler = function(element) {
|
|||||||
*/
|
*/
|
||||||
this.pointerMap = new goog.structs.Map();
|
this.pointerMap = new goog.structs.Map();
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @const
|
* @const
|
||||||
* @type {ol.structs.WeakMap}
|
* @type {ol.structs.WeakMap}
|
||||||
@@ -87,7 +88,7 @@ ol.pointer.PointerEventHandler = function(element) {
|
|||||||
this.eventSources = {};
|
this.eventSources = {};
|
||||||
this.eventSourceList = [];
|
this.eventSourceList = [];
|
||||||
|
|
||||||
this.boundHandler_ = this.eventHandler_.bind(this);
|
this.boundHandler_ = goog.bind(this.eventHandler_, this);
|
||||||
|
|
||||||
this.registerSources();
|
this.registerSources();
|
||||||
};
|
};
|
||||||
@@ -167,7 +168,7 @@ ol.pointer.PointerEventHandler.prototype.registerSource =
|
|||||||
var handler = s.getHandlerForEvent(e);
|
var handler = s.getHandlerForEvent(e);
|
||||||
|
|
||||||
if (handler) {
|
if (handler) {
|
||||||
this.eventMap[e] = handler.bind(s);
|
this.eventMap[e] = goog.bind(handler, s);
|
||||||
}
|
}
|
||||||
}, this);
|
}, this);
|
||||||
this.eventSources[name] = s;
|
this.eventSources[name] = s;
|
||||||
|
|||||||
@@ -128,7 +128,7 @@ ol.pointer.TouchSource.prototype.resetClickCount_ = function() {
|
|||||||
this.clickCount = 0;
|
this.clickCount = 0;
|
||||||
this.resetId = null;
|
this.resetId = null;
|
||||||
};
|
};
|
||||||
this.resetId = setTimeout(fn.bind(this), this.CLICK_COUNT_TIMEOUT);
|
this.resetId = setTimeout(goog.bind(fn, this), this.CLICK_COUNT_TIMEOUT);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -397,12 +397,12 @@ ol.pointer.TouchSource.prototype.dedupSynthMouse_ = function(inEvent) {
|
|||||||
// remember x/y of last touch
|
// remember x/y of last touch
|
||||||
var lt = {x: t.clientX, y: t.clientY};
|
var lt = {x: t.clientX, y: t.clientY};
|
||||||
lts.push(lt);
|
lts.push(lt);
|
||||||
var fn = (function(lts, lt) {
|
var fn = goog.bind(function(lts, lt) {
|
||||||
var i = lts.indexOf(lt);
|
var i = lts.indexOf(lt);
|
||||||
if (i > -1) {
|
if (i > -1) {
|
||||||
lts.splice(i, 1);
|
lts.splice(i, 1);
|
||||||
}
|
}
|
||||||
}).bind(null, lts, lt);
|
}, null, lts, lt);
|
||||||
setTimeout(fn, this.DEDUP_TIMEOUT);
|
setTimeout(fn, this.DEDUP_TIMEOUT);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user