Fix tooltip having editor references.
This commit is contained in:
@@ -4,6 +4,7 @@ using System.ComponentModel;
|
||||
using FlaxEditor.GUI.Docking;
|
||||
using FlaxEditor.Utilities;
|
||||
using FlaxEngine;
|
||||
using FlaxEngine.GUI;
|
||||
|
||||
namespace FlaxEditor.Options
|
||||
{
|
||||
@@ -222,9 +223,15 @@ namespace FlaxEditor.Options
|
||||
/// </summary>
|
||||
[DefaultValue(TextAlignment.Center)]
|
||||
[EditorDisplay("Interface"), EditorOrder(321)]
|
||||
public TextAlignment TooltipTextAlignment { get; set; } = TextAlignment.Center;
|
||||
|
||||
public TextAlignment TooltipTextAlignment { get => _tooltipTextAlignment;
|
||||
set
|
||||
{
|
||||
_tooltipTextAlignment = value;
|
||||
Style.Current.SharedTooltip.HorizontalTextAlignment = value;
|
||||
}
|
||||
}
|
||||
|
||||
private TextAlignment _tooltipTextAlignment = TextAlignment.Center;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the timestamps prefix mode for output log messages.
|
||||
|
||||
@@ -331,6 +331,7 @@ namespace FlaxEditor.Options
|
||||
|
||||
SharedTooltip = new Tooltip(),
|
||||
};
|
||||
style.SharedTooltip.HorizontalTextAlignment = Editor.Instance.Options.Options.Interface.TooltipTextAlignment;
|
||||
style.DragWindow = style.BackgroundSelected * 0.7f;
|
||||
return style;
|
||||
}
|
||||
@@ -386,6 +387,7 @@ namespace FlaxEditor.Options
|
||||
|
||||
SharedTooltip = new Tooltip(),
|
||||
};
|
||||
style.SharedTooltip.HorizontalTextAlignment = Editor.Instance.Options.Options.Interface.TooltipTextAlignment;
|
||||
return style;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
// Copyright (c) 2012-2024 Wojciech Figat. All rights reserved.
|
||||
|
||||
using FlaxEditor;
|
||||
using FlaxEditor.Options;
|
||||
using System;
|
||||
|
||||
namespace FlaxEngine.GUI
|
||||
@@ -19,6 +17,11 @@ namespace FlaxEngine.GUI
|
||||
private string _currentText;
|
||||
private Window _window;
|
||||
|
||||
/// <summary>
|
||||
/// The horizontal alignment of the text.
|
||||
/// </summary>
|
||||
public TextAlignment HorizontalTextAlignment = TextAlignment.Center;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the time in seconds that mouse have to be over the target to show the tooltip.
|
||||
/// </summary>
|
||||
@@ -238,7 +241,7 @@ namespace FlaxEngine.GUI
|
||||
|
||||
// Padding for text
|
||||
var textRect = GetClientArea();
|
||||
float textX = Editor.Instance.Options.Options.Interface.TooltipTextAlignment switch
|
||||
float textX = HorizontalTextAlignment switch
|
||||
{
|
||||
TextAlignment.Near => 15,
|
||||
TextAlignment.Center => 5,
|
||||
@@ -254,7 +257,7 @@ namespace FlaxEngine.GUI
|
||||
_currentText,
|
||||
textRect,
|
||||
style.Foreground,
|
||||
Editor.Instance.Options.Options.Interface.TooltipTextAlignment,
|
||||
HorizontalTextAlignment,
|
||||
TextAlignment.Center,
|
||||
TextWrapping.WrapWords
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user