This commit is contained in:
Eric Rowell
2013-04-08 01:02:08 -07:00
parent 2f6e93dab6
commit a8802c31ca
2 changed files with 8 additions and 20 deletions

View File

@@ -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.

View File

@@ -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) {