mirror of
https://github.com/cocos/cocos4.git
synced 2026-11-21 16:12:40 +08:00
Fix components undo issue in editor (#2871)
This commit is contained in:
@@ -172,6 +172,12 @@ let Graphics = cc.Class({
|
||||
LineCap: LineCap
|
||||
},
|
||||
|
||||
onRestore () {
|
||||
if (!this._impl) {
|
||||
this._impl = Graphics._assembler.createImpl();
|
||||
}
|
||||
},
|
||||
|
||||
onEnable () {
|
||||
this._super();
|
||||
this._activateMaterial();
|
||||
|
||||
@@ -322,6 +322,12 @@ let VideoPlayer = cc.Class({
|
||||
}
|
||||
},
|
||||
|
||||
onRestore () {
|
||||
if (!this._impl) {
|
||||
this._impl = new WebViewImpl();
|
||||
}
|
||||
},
|
||||
|
||||
onEnable () {
|
||||
if (this._impl) {
|
||||
this._impl.enable();
|
||||
|
||||
@@ -114,6 +114,12 @@ let WebView = cc.Class({
|
||||
this._impl = new WebViewImpl();
|
||||
},
|
||||
|
||||
onRestore () {
|
||||
if (!this._impl) {
|
||||
this._impl = new WebViewImpl();
|
||||
}
|
||||
},
|
||||
|
||||
onEnable () {
|
||||
let impl = this._impl;
|
||||
impl.createDomElementIfNeeded(this.node.width, this.node.height);
|
||||
|
||||
@@ -376,6 +376,17 @@ sp.Skeleton = cc.Class({
|
||||
this._updateSkeletonData();
|
||||
},
|
||||
|
||||
onRestore () {
|
||||
// Destroyed and restored in Editor
|
||||
if (!this._material) {
|
||||
this._boundingBox = cc.rect();
|
||||
this._material = new SpriteMaterial();
|
||||
this._renderDatas = [];
|
||||
this._debugNode = new Node();
|
||||
this._debugRenderer = this._debugNode.addComponent(Graphics);
|
||||
}
|
||||
},
|
||||
|
||||
onDestroy () {
|
||||
this._super();
|
||||
this._debugNode.destroy();
|
||||
|
||||
Reference in New Issue
Block a user