Add new preview position: tooltip
This commit is contained in:
@@ -247,6 +247,7 @@ internal enum PreviewPosition
|
||||
Inside,
|
||||
Top,
|
||||
Bottom,
|
||||
Tooltip,
|
||||
}
|
||||
|
||||
internal static class PreviewPositionExt
|
||||
@@ -257,6 +258,7 @@ internal static class PreviewPositionExt
|
||||
PreviewPosition.Inside => Language.Options_Preview_Inside,
|
||||
PreviewPosition.Top => Language.Options_Preview_Top,
|
||||
PreviewPosition.Bottom => Language.Options_Preview_Bottom,
|
||||
PreviewPosition.Tooltip => Language.Options_Preview_Tooltip,
|
||||
_ => throw new ArgumentOutOfRangeException(nameof(position), position, null),
|
||||
};
|
||||
}
|
||||
|
||||
Generated
+9
@@ -2444,6 +2444,15 @@ namespace ChatTwo.Resources {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Tooltip.
|
||||
/// </summary>
|
||||
internal static string Options_Preview_Tooltip {
|
||||
get {
|
||||
return ResourceManager.GetString("Options_Preview_Tooltip", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Top.
|
||||
/// </summary>
|
||||
|
||||
@@ -1072,4 +1072,7 @@
|
||||
<data name="Options_Preview_Header" xml:space="preserve">
|
||||
<value>Text Preview:</value>
|
||||
</data>
|
||||
<data name="Options_Preview_Tooltip" xml:space="preserve">
|
||||
<value>Tooltip</value>
|
||||
</data>
|
||||
</root>
|
||||
|
||||
@@ -517,8 +517,7 @@ public sealed class ChatLogWindow : Window
|
||||
LastViewport = ImGui.GetWindowViewport().NativePtr;
|
||||
WasDocked = ImGui.IsWindowDocked();
|
||||
|
||||
var drawPreview = Plugin.Config.PreviewPosition is PreviewPosition.Inside;
|
||||
if (drawPreview)
|
||||
if (Plugin.Config.PreviewPosition is PreviewPosition.Inside or PreviewPosition.Tooltip)
|
||||
Plugin.InputPreview.CalculatePreview();
|
||||
|
||||
var currentTab = Plugin.Config.SidebarTabView ? DrawTabSidebar() : DrawTabBar();
|
||||
@@ -527,7 +526,7 @@ public sealed class ChatLogWindow : Window
|
||||
if (currentTab > -1 && currentTab < Plugin.Config.Tabs.Count)
|
||||
activeTab = Plugin.Config.Tabs[currentTab];
|
||||
|
||||
if (drawPreview)
|
||||
if (Plugin.Config.PreviewPosition is PreviewPosition.Inside)
|
||||
Plugin.InputPreview.DrawPreview();
|
||||
|
||||
using (ImRaii.PushStyle(ImGuiStyleVar.ItemSpacing, Vector2.Zero))
|
||||
@@ -702,6 +701,14 @@ public sealed class ChatLogWindow : Window
|
||||
ImGui.InputTextWithHint("##chat2-input", isChatEnabled ? "": Language.ChatLog_DisabledInput, ref Chat, 500, flags, Callback);
|
||||
}
|
||||
|
||||
if (Plugin.Config.PreviewPosition is PreviewPosition.Tooltip && !string.IsNullOrEmpty(Chat) && ImGui.IsItemHovered())
|
||||
{
|
||||
ImGui.SetNextWindowSize(new Vector2(500 * ImGuiHelpers.GlobalScale, -1));
|
||||
using var tooltip = ImRaii.Tooltip();
|
||||
if (tooltip)
|
||||
Plugin.InputPreview.DrawPreview();
|
||||
}
|
||||
|
||||
if (ImGui.IsItemDeactivated())
|
||||
{
|
||||
if (ImGui.IsKeyDown(ImGuiKey.Escape))
|
||||
|
||||
Reference in New Issue
Block a user