mirror of
https://github.com/cocos/cocos4.git
synced 2026-11-21 08:02:39 +08:00
fix: animation mode hide add-commonent-btn (#12264)
* fix: animation mode hide add-commonent-btn * feat: handlerSceneChangeMode return bollean * feat:add isAnimationMode funciton
This commit is contained in:
@@ -684,9 +684,12 @@ const Elements = {
|
||||
const panel = this;
|
||||
|
||||
if (!panel.dump || !panel.dump.isScene) {
|
||||
panel.toggleShowAddComponentBtn(true);
|
||||
if (!panel.isAnimationMode()) {
|
||||
panel.toggleShowAddComponentBtn(true);
|
||||
}
|
||||
return;
|
||||
}
|
||||
// 场景模式要隐藏按钮
|
||||
panel.toggleShowAddComponentBtn(false);
|
||||
|
||||
panel.$this.setAttribute('sub-type', 'scene');
|
||||
@@ -1696,9 +1699,11 @@ exports.methods = {
|
||||
toggleShowAddComponentBtn(show) {
|
||||
this.$.componentAdd.style.display = show ? 'inline-block' : 'none';
|
||||
},
|
||||
isAnimationMode() {
|
||||
return Editor.EditMode.getMode() === 'animation';
|
||||
},
|
||||
handlerSceneChangeMode() {
|
||||
const mode = Editor.EditMode.getMode();
|
||||
this.toggleShowAddComponentBtn(mode !== 'animation'); // 动画编辑模式下,要隐藏按钮
|
||||
this.toggleShowAddComponentBtn(!this.isAnimationMode()); // 动画编辑模式下,要隐藏按钮
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user