From a7b653f0b74c9af8b1435760de08c1db27904f56 Mon Sep 17 00:00:00 2001 From: bird_egop Date: Tue, 19 Nov 2024 02:28:49 +0300 Subject: [PATCH] =?UTF-8?q?=D0=B4=D0=BE=D0=B1=D0=B0=D0=B2=D0=B8=D0=BB=20?= =?UTF-8?q?=D1=84=D0=BE=D0=BD=D1=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- NResUI/ImGuiUI/TexmExplorer.cs | 19 ++++++++++++++----- NResUI/Models/TexmExplorerViewModel.cs | 1 + 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/NResUI/ImGuiUI/TexmExplorer.cs b/NResUI/ImGuiUI/TexmExplorer.cs index 040a37c..438dc2a 100644 --- a/NResUI/ImGuiUI/TexmExplorer.cs +++ b/NResUI/ImGuiUI/TexmExplorer.cs @@ -70,9 +70,12 @@ public class TexmExplorer : IImGuiPanel ImGui.Text(_viewModel.TexmFile.IsIndexed.ToString()); ImGui.Checkbox("Включить чёрный фон", ref _viewModel.IsBlackBgEnabled); + ImGui.SameLine(); ImGui.Checkbox("Включить белый фон", ref _viewModel.IsWhiteBgEnabled); + ImGui.SameLine(); + ImGui.Checkbox("Увеличить в 2 раза", ref _viewModel.DoubleSize); - if (_viewModel.IsWhiteBgEnabled && _viewModel.IsBlackBgEnabled) + if (_viewModel is {IsWhiteBgEnabled: true, IsBlackBgEnabled: true}) { _viewModel.IsBlackBgEnabled = false; _viewModel.IsWhiteBgEnabled = false; @@ -85,22 +88,28 @@ public class TexmExplorer : IImGuiPanel { var glTexture = _viewModel.GlTextures[index]; var screenPos = ImGui.GetCursorScreenPos(); + Vector2 imageSize = new Vector2(glTexture.Width, glTexture.Height); + if (_viewModel.DoubleSize) + { + imageSize *= 2; + } + if (_viewModel.IsBlackBgEnabled) { - drawList.AddRectFilled(screenPos, screenPos + new Vector2(glTexture.Width, glTexture.Height), 0xFF000000); + drawList.AddRectFilled(screenPos, screenPos + imageSize, 0xFF000000); } else if (_viewModel.IsWhiteBgEnabled) { - drawList.AddRectFilled(screenPos, screenPos + new Vector2(glTexture.Width, glTexture.Height), 0xFFFFFFFF); + drawList.AddRectFilled(screenPos, screenPos + imageSize, 0xFFFFFFFF); } - ImGui.Image((IntPtr) glTexture.GlTexture, new Vector2(glTexture.Width, glTexture.Height)); + ImGui.Image((IntPtr) glTexture.GlTexture, imageSize); ImGui.SameLine(); if (ImGui.IsItemHovered()) { var mousePos = ImGui.GetMousePos(); - var relativePos = mousePos - screenPos; + var relativePos = (mousePos - screenPos) / (_viewModel.DoubleSize ? 2 : 1); ImGui.Text("Hovering over: "); ImGui.SameLine(); diff --git a/NResUI/Models/TexmExplorerViewModel.cs b/NResUI/Models/TexmExplorerViewModel.cs index cfc08b7..2684572 100644 --- a/NResUI/Models/TexmExplorerViewModel.cs +++ b/NResUI/Models/TexmExplorerViewModel.cs @@ -17,6 +17,7 @@ public class TexmExplorerViewModel public bool IsWhiteBgEnabled; public bool IsBlackBgEnabled; + public bool DoubleSize; public void SetParseResult(TexmParseResult result, string path) {