Restore tool focus by picking context
This commit is contained in:
parent
4ec4cf77ee
commit
9be5d250e8
@ -49,7 +49,7 @@ namespace NavisworksTransport
|
||||
if (currentTool != Tool.CustomToolPlugin)
|
||||
{
|
||||
LogManager.Info($"[InputMonitor] 用户按空格键,当前工具为{currentTool},强制恢复ToolPlugin焦点");
|
||||
bool restored = pathManager.ForceReinitializeToolPlugin(subscribeToEvents: false);
|
||||
bool restored = pathManager.RestoreToolPluginFocusForCurrentContext();
|
||||
if (restored)
|
||||
{
|
||||
return true;
|
||||
|
||||
@ -4562,6 +4562,33 @@ namespace NavisworksTransport
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据当前业务上下文恢复 ToolPlugin 焦点。
|
||||
/// 普通手动建/编辑路径应恢复 PathPlanningManager 主链;
|
||||
/// 自动路径、装配拾取、多层吊装等外部自管拾取模式则保持外部事件处理。
|
||||
/// </summary>
|
||||
public bool RestoreToolPluginFocusForCurrentContext()
|
||||
{
|
||||
try
|
||||
{
|
||||
bool shouldSubscribeToManagerEvents = !IsInAutoPathMode;
|
||||
string contextLabel = shouldSubscribeToManagerEvents
|
||||
? "普通手动取点"
|
||||
: "外部自管拾取";
|
||||
|
||||
LogManager.Info(
|
||||
$"[工具插件恢复] 按当前上下文恢复焦点: 模式={contextLabel}, " +
|
||||
$"PathEditState={PathEditState}, 订阅PathPlanningManager事件={shouldSubscribeToManagerEvents}");
|
||||
|
||||
return ForceReinitializeToolPlugin(shouldSubscribeToManagerEvents);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
LogManager.Error($"[工具插件恢复] 按当前上下文恢复焦点失败: {ex.Message}", ex);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region 路径计算和保存
|
||||
|
||||
Loading…
Reference in New Issue
Block a user