mirror of
https://github.com/cocos/cocos4.git
synced 2026-12-01 15:52:40 +08:00
Merge pull request #1453 from natural-law/hot-fix
Solve the DragonBones event listeners will be missed when armature is changed in JSB.
This commit is contained in:
@@ -391,6 +391,13 @@ dragonBones.ArmatureDisplay = cc.Class({
|
||||
|
||||
if (listenersBefore) {
|
||||
sgNode._bubblingListeners = listenersBefore; // using the listeners added before
|
||||
if (CC_JSB && !sgNode.hasEventCallback()) {
|
||||
// In JSB, should set event callback of the new sgNode
|
||||
// to make the listeners work well.
|
||||
sgNode.setEventCallback(function (eventObject) {
|
||||
sgNode.emit(eventObject.type, eventObject);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
self._initSgNode();
|
||||
|
||||
Reference in New Issue
Block a user