This commit is contained in:
2025-09-22 19:50:34 +08:00
parent 556194f24a
commit 650b34d8df
2 changed files with 19 additions and 73 deletions
@@ -366,74 +366,6 @@ export class NavigationManager {
ViewManager.I.openBundlesView(panelName, data, callback);
}
/**
* 支持自定义动画方向的面板切换方法
* @param panelType 目标面板类型
* @param transitionConfig 过渡动画配置
* @param force 是否强制切换
*/
public switchToPanelWithTransition(
panelType: PanelType,
transitionConfig: PageTransitionConfig,
force: boolean = false
): Node {
if (!panelType) {
logger.error(
"[NavigationManager] switchToPanelWithTransition: panelType is invalid"
);
return null;
}
if (this.currentActivePanelType === panelType && !force) {
logger.log(
`[NavigationManager] Already on ${panelType}, skipping switch`
);
return this.currentActivePanel;
}
if (!this.navigationPanel) {
logger.warn(
"[NavigationManager] NavigationPanel not registered, fallback to direct ViewManager call"
);
return null;
}
// 切换面板前先关闭所有弹窗
this.closeAllPopups();
// 通知NavigationPanel显示加载状态
this.navigationPanel.showLoading?.();
// 获取动画方向
const hideDirection = this.getDirectionFromTransitionType(
transitionConfig.outgoingTransition
);
const showDirection = this.getDirectionFromTransitionType(
transitionConfig.incomingTransition
);
// 隐藏当前面板(包括子页面)
if (this.currentActivePanel && this.currentActivePanel.isValid) {
this.hidePanelWithAnimation(this.currentActivePanel, hideDirection);
}
// 加载并显示目标面板
this.loadOrGetPanel(panelType, (panel: Node) => {
this.currentActivePanelType = panelType;
// 更新NavigationPanel按钮状态
this.navigationPanel.updateButtonStates?.(panelType);
// 显示面板
this.showPanelWithAnimation(panel, showDirection, () => {
this.currentActivePanel = panel;
this.navigationPanel.hideLoading?.();
});
});
return null;
}
/**
* 将过渡类型转换为方向字符串
*/
@@ -877,6 +809,7 @@ export class NavigationManager {
}
panel.active = true;
panel.getComponent(li_BaseView)
switch (direction) {
case "left":