Add tooltip service and integrate with MinimapControl

- Introduced TuiTooltipService for managing tooltips across TUI components.
- Updated MinimapControl to utilize the new tooltip service for enhanced entity information display.
- Refactored tooltip rendering logic to improve visibility and interaction based on mouse position.
This commit is contained in:
BruceChen 2026-03-29 19:53:31 +08:00
parent 0566f2518b
commit d427a6e160
3 changed files with 194 additions and 73 deletions

View file

@ -45,6 +45,8 @@ namespace MinecraftClient.Tui
private readonly MinimapControl _minimapControl;
private volatile bool _minimapVisible;
private TuiTooltipService? _tooltipService;
private readonly Border _suggestionBorder;
private readonly StackPanel _suggestionPanel;
private CommandSuggestion[] _suggestions = Array.Empty<CommandSuggestion>();
@ -57,6 +59,8 @@ namespace MinecraftClient.Tui
private int MaxVisibleSuggestions =>
Math.Max(1, Settings.Config.Console.CommandSuggestion.Max_Displayed_Suggestions);
public TuiTooltipService? TooltipService => _tooltipService;
public MainTuiView()
{
Background = Brushes.Black;
@ -194,6 +198,10 @@ namespace MinecraftClient.Tui
Children = { _mainContent, _minimapBorder, _notificationBorder, _suggestionBorder }
};
_tooltipService = new TuiTooltipService(_rootPanel);
_minimapControl.TooltipService = _tooltipService;
_minimapControl.Position = mmCfg.Position;
Content = _rootPanel;
if (mmCfg.Enabled)
@ -1083,6 +1091,7 @@ namespace MinecraftClient.Tui
_minimapBorder.HorizontalAlignment = hAlign;
_minimapBorder.VerticalAlignment = vAlign;
_minimapBorder.Margin = margin;
_minimapControl.Position = pos;
Settings.Config.Console.Minimap.Position = pos;
}