mirror of
https://github.com/konvajs/konva.git
synced 2025-12-17 09:54:56 +08:00
update dispatchEvent and addEventListener for new API
This commit is contained in:
18
src/Node.js
18
src/Node.js
@@ -398,14 +398,20 @@
|
||||
}
|
||||
return this;
|
||||
},
|
||||
// some event aliases for third party integration like HammerJS
|
||||
// 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
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user