Skip to content

Commit

Permalink
Merge pull request #1346 from VladiStep/editGlyphRectLine
Browse files Browse the repository at this point in the history
A horizontal line as a preview for the top glyph border.
  • Loading branch information
Grossley authored Apr 22, 2023
2 parents 4336bdd + 620d384 commit 38c83bc
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
<ScrollViewer Name="TextureScroll" Grid.Row="1" Margin="3"
HorizontalScrollBarVisibility="Visible" VerticalScrollBarVisibility="Visible"
PreviewMouseWheel="TextureScroll_MouseWheel" ScrollChanged="TextureScroll_ScrollChanged"
PreviewKeyDown="TextureScroll_PreviewKeyDown">
PreviewKeyDown="TextureScroll_PreviewKeyDown" PreviewKeyUp="TextureScroll_PreviewKeyUp">
<ScrollViewer.Background>
<DynamicResource ResourceKey="{x:Static SystemColors.MenuBrushKey}"/>
</ScrollViewer.Background>
Expand Down Expand Up @@ -162,6 +162,17 @@
</DataTemplate>
</ItemsControl.Resources>
</ItemsControl>

<Rectangle Name="GlyphTopLine" VerticalAlignment="Top" HorizontalAlignment="Stretch"
StrokeThickness="1" Height="1"
Visibility="Collapsed" Focusable="False">
<Rectangle.Stroke>
<SolidColorBrush Color="Gold" Opacity="0.6"/>
</Rectangle.Stroke>
<Rectangle.RenderTransform>
<TranslateTransform x:Name="transform3" Y="{Binding SelectedGlyph.SourceY}"/>
</Rectangle.RenderTransform>
</Rectangle>
</Grid>
</Viewbox>
</ScrollViewer>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand All @@ -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;
}
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
{
Expand Down

0 comments on commit 38c83bc

Please sign in to comment.