update dispatchEvent and addEventListener for new API

This commit is contained in:
Лаврёнов Антон
2014-03-21 14:45:38 +08:00
parent 188cd5da8e
commit a737baad62
2 changed files with 13 additions and 6 deletions

View File

@@ -400,12 +400,18 @@
},
// some event aliases for third party integration like HammerJS
dispatchEvent: function(evt) {
evt.target = this;
evt.type = evt.evt.type;
this.fire(evt.type, evt);
var e = {
target: this,
type: evt.type,
evt: evt
};
this.fire(evt.type, e);
},
addEventListener: function() {
this.on.apply(this, arguments);
addEventListener: function(type, handler) {
// we to pass native event to handler
this.on(type, function(evt){
handler.call(this, evt.evt);
});
},
/**
* remove self from parent, but don't destroy

View File

@@ -684,6 +684,7 @@
}
},
// currently cache function is now working for stage, because stage has no its own canvas element
// TODO: may be it is better to cache all children layers?
cache: function() {
Kinetic.Util.warn('Cache function is not allowed for stage. You may use cache only for layers, groups and shapes.');
return;