mirror of
https://github.com/cocos/cocos4.git
synced 2026-12-01 15:52:40 +08:00
fixed error when active/disactive richtext node (#2846)
This commit is contained in:
@@ -291,13 +291,14 @@ let RichText = cc.Class({
|
||||
this._addEventListeners();
|
||||
}
|
||||
this._updateRichText();
|
||||
this._activateChildren(true);
|
||||
},
|
||||
|
||||
onDisable () {
|
||||
if (this.handleTouchEvent) {
|
||||
this._removeEventListeners();
|
||||
}
|
||||
this._resetState();
|
||||
this._activateChildren(false);
|
||||
},
|
||||
|
||||
start () {
|
||||
@@ -407,6 +408,15 @@ let RichText = cc.Class({
|
||||
this._layoutDirty = true;
|
||||
},
|
||||
|
||||
_activateChildren (active) {
|
||||
for (let i = this.node.children.length - 1; i >= 0; i--) {
|
||||
let child = this.node.children[i];
|
||||
if (child.name === RichTextChildName) {
|
||||
child.active = active;
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
_addLabelSegment (stringToken, styleIndex) {
|
||||
let labelSegment;
|
||||
if (this._labelSegmentsCache.length === 0) {
|
||||
|
||||
Reference in New Issue
Block a user