mirror of
https://github.com/konvajs/konva.git
synced 2025-09-18 09:50:05 +08:00
fixes #383
This commit is contained in:
@@ -135,22 +135,6 @@ var Kinetic = {};
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// bind() shim for older browsers
|
||||
if (!Function.prototype.bind) {
|
||||
Function.prototype.bind = function (oThis) {
|
||||
var aArgs = Array.prototype.slice.call(arguments, 1),
|
||||
fToBind = this,
|
||||
fNOP = function () {},
|
||||
fBound = function () {
|
||||
return fToBind.apply(this instanceof fNOP && oThis ? this : oThis,
|
||||
aArgs.concat(Array.prototype.slice.call(arguments)));
|
||||
};
|
||||
fNOP.prototype = this.prototype;
|
||||
fBound.prototype = new fNOP();
|
||||
return fBound;
|
||||
};
|
||||
}
|
||||
})();
|
||||
|
||||
// Uses Node, AMD or browser globals to create a module.
|
||||
|
12
src/Stage.js
12
src/Stage.js
@@ -28,6 +28,12 @@
|
||||
|
||||
// cached variables
|
||||
eventsLength = EVENTS.length;
|
||||
|
||||
function addEvent(ctx, eventName) {
|
||||
ctx.content.addEventListener(eventName, function(evt) {
|
||||
ctx['_' + eventName](evt);
|
||||
}, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Stage constructor. A stage is used to contain multiple layers
|
||||
@@ -352,12 +358,10 @@
|
||||
*/
|
||||
_bindContentEvents: function() {
|
||||
var that = this,
|
||||
n, pubEvent, f;
|
||||
n;
|
||||
|
||||
for (n = 0; n < eventsLength; n++) {
|
||||
pubEvent = EVENTS[n];
|
||||
f = that['_' + pubEvent];
|
||||
that.content.addEventListener(pubEvent, f.bind(that), false);
|
||||
addEvent(this, EVENTS[n]);
|
||||
}
|
||||
},
|
||||
_mouseout: function(evt) {
|
||||
|
Reference in New Issue
Block a user