From 620d384fa2f18d8a94c20a20a82075a2738c1433 Mon Sep 17 00:00:00 2001 From: VladiStep Date: Sat, 22 Apr 2023 15:56:42 +0300 Subject: [PATCH] Add a horizontal line as a preview for the top glyph border. --- .../EditGlyphRectangleWindow.xaml | 13 ++++++++++++- .../EditGlyphRectangleWindow.xaml.cs | 16 +++++++++++++++- 2 files changed, 27 insertions(+), 2 deletions(-) diff --git a/UndertaleModTool/Editors/UndertaleFontEditor/EditGlyphRectangleWindow.xaml b/UndertaleModTool/Editors/UndertaleFontEditor/EditGlyphRectangleWindow.xaml index b3d9129c5..600c0eb8e 100644 --- a/UndertaleModTool/Editors/UndertaleFontEditor/EditGlyphRectangleWindow.xaml +++ b/UndertaleModTool/Editors/UndertaleFontEditor/EditGlyphRectangleWindow.xaml @@ -26,7 +26,7 @@ + PreviewKeyDown="TextureScroll_PreviewKeyDown" PreviewKeyUp="TextureScroll_PreviewKeyUp"> @@ -162,6 +162,17 @@ + + + + + + + + + diff --git a/UndertaleModTool/Editors/UndertaleFontEditor/EditGlyphRectangleWindow.xaml.cs b/UndertaleModTool/Editors/UndertaleFontEditor/EditGlyphRectangleWindow.xaml.cs index 129434165..046efbe8e 100644 --- a/UndertaleModTool/Editors/UndertaleFontEditor/EditGlyphRectangleWindow.xaml.cs +++ b/UndertaleModTool/Editors/UndertaleFontEditor/EditGlyphRectangleWindow.xaml.cs @@ -201,7 +201,11 @@ private void TextureViewbox_MouseLeftButtonDown(object sender, MouseButtonEventA initShift = SelectedGlyph.Shift; } else + { initType = GetHitType(selectedRect, initPoint); + if (initType == HitType.T || initType == HitType.UL || initType == HitType.UR) + GlyphTopLine.Visibility = Visibility.Visible; + } dragInProgress = true; } @@ -214,7 +218,9 @@ private void TextureViewbox_MouseLeftButtonUp(object sender, MouseButtonEventArg TextureViewbox.MouseMove += TextureViewbox_MouseMove; TextureViewbox.Cursor = Cursors.Arrow; ToolTipService.SetIsEnabled(selectedRect, true); - } + } + else + GlyphTopLine.Visibility = Visibility.Collapsed; dragInProgress = false; } @@ -359,6 +365,9 @@ private void TextureScroll_PreviewKeyDown(object sender, KeyEventArgs e) if (SelectedGlyph is null) return; + if (e.Key == Key.LeftShift || e.Key == Key.RightShift) + GlyphTopLine.Visibility = Visibility.Visible; + if ((Keyboard.Modifiers & ModifierKeys.Shift) == ModifierKeys.Shift) { switch (e.Key) @@ -418,6 +427,11 @@ private void TextureScroll_PreviewKeyDown(object sender, KeyEventArgs e) break; } } + private void TextureScroll_PreviewKeyUp(object sender, KeyEventArgs e) + { + if (e.Key == Key.LeftShift || e.Key == Key.RightShift) + GlyphTopLine.Visibility = Visibility.Collapsed; + } private void HelpButton_Click(object sender, RoutedEventArgs e) {