Skip to content

Commit 1b761fd

Browse files
committed
new image dialog: set focus to slider (so can use arrow keys and enter), set new image slider value to current resolution,
1 parent 1e4b09d commit 1b761fd

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

PixelArtTool/MainWindow.xaml.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -599,6 +599,7 @@ private void OnClearButton(object sender, RoutedEventArgs e)
599599
// show dialog for new resolution
600600
NewImageDialog dlg = new NewImageDialog();
601601
dlg.Owner = this;
602+
dlg.sliderResolution.Value = canvasResolutionX;
602603
var result = dlg.ShowDialog();
603604
switch (result)
604605
{
@@ -609,7 +610,6 @@ private void OnClearButton(object sender, RoutedEventArgs e)
609610
// reset title
610611
window.Title = windowTitle;
611612
saveFile = null;
612-
//Console.WriteLine(dlg.sliderResolution.Value);
613613

614614
canvasResolutionX = (int)dlg.sliderResolution.Value;
615615
canvasResolutionY = (int)dlg.sliderResolution.Value;
@@ -1233,7 +1233,7 @@ private void OnHueRectangleMouseMoved(object sender, MouseEventArgs e)
12331233
if (e.LeftButton == MouseButtonState.Pressed) rectHueBar_MouseDown(null, null);
12341234
}
12351235

1236-
1236+
// https://github.com/Chris3606/GoRogue/blob/master/GoRogue/Lines.cs
12371237
private void DrawLine(int startX, int startY, int endX, int endY)
12381238
{
12391239
int dx = endX - startX;

PixelArtTool/NewImageDialog.xaml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,13 @@
1212
WindowStartupLocation="CenterOwner"
1313
>
1414
<Grid>
15-
<StackPanel Grid.Column="0" Grid.ColumnSpan="2" Grid.Row="4">
16-
<Label Content="Resolution *Use only 8x8, 16x16, 32x32, 64x64"/>
17-
<TextBlock Text="{Binding ElementName=sliderResolution, Path=Value, StringFormat={}{0:#}}" HorizontalAlignment="Center" FontWeight="Bold"/>
15+
<StackPanel Grid.Column="0" Grid.ColumnSpan="2" Grid.Row="4" FocusManager.FocusedElement="{Binding ElementName=sliderResolution}">
16+
<Label Content="Resolution"/>
17+
<TextBlock HorizontalAlignment="Center" FontWeight="Bold">
18+
<Run Text="{Binding ElementName=sliderResolution, Path=Value, StringFormat={}{0:#}}"/>
19+
<Run Text="x"/>
20+
<Run Text="{Binding ElementName=sliderResolution, Path=Value, StringFormat={}{0:#}}"/>
21+
</TextBlock>
1822
<Slider x:Name="sliderResolution" Minimum="8" Maximum="64" SmallChange="8" TickFrequency="8" LargeChange="8" TickPlacement="Both" Value="16" AutoToolTipPlacement="TopLeft" IsSnapToTickEnabled="True"/>
1923
<Button x:Name="okButton" IsDefault="True" Content="OK" Click="OnOkButtonClick"/>
2024
<Button x:Name="cancelButton" IsCancel="True" Content="Cancel"/>

0 commit comments

Comments
 (0)