Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A horizontal line as a preview for the top glyph border. #1346

Merged
merged 1 commit into from
Apr 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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