Browse Source

Improve UI

Equbuxu 3 years ago
parent
commit
ca4e25c361

+ 3 - 3
PixiEditor/Helpers/Behaviours/ClearFocusOnClickBehavior.cs

@@ -1,6 +1,6 @@
-using System.Windows;
+using PixiEditor.Models.Controllers.Shortcuts;
+using System.Windows;
 using System.Windows.Interactivity;
-using PixiEditor.Models.Controllers.Shortcuts;
 
 namespace PixiEditor.Helpers.Behaviours
 {
@@ -23,4 +23,4 @@ namespace PixiEditor.Helpers.Behaviours
             ShortcutController.BlockShortcutExecution = false;
         }
     }
-}
+}

+ 5 - 8
PixiEditor/Models/Tools/ToolSettings/Settings/SizeSetting.cs

@@ -1,10 +1,6 @@
-using System.Windows;
-using System.Windows.Controls;
+using PixiEditor.Views;
+using System.Windows;
 using System.Windows.Data;
-using System.Windows.Interactivity;
-using PixiEditor.Helpers;
-using PixiEditor.Helpers.Behaviours;
-using PixiEditor.Views;
 
 namespace PixiEditor.Models.Tools.ToolSettings.Settings
 {
@@ -25,7 +21,8 @@ namespace PixiEditor.Models.Tools.ToolSettings.Settings
                 Width = 65,
                 Height = 20,
                 VerticalAlignment = VerticalAlignment.Center,
-                MaxSize = 9999
+                MaxSize = 9999,
+                IsEnabled = true
             };
 
             Binding binding = new Binding("Value")
@@ -36,4 +33,4 @@ namespace PixiEditor.Models.Tools.ToolSettings.Settings
             return tb;
         }
     }
-}
+}

+ 6 - 2
PixiEditor/Views/Dialogs/NewFilePopup.xaml

@@ -5,6 +5,7 @@
         xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
         xmlns:local="clr-namespace:PixiEditor.Views"
         xmlns:vm="clr-namespace:PixiEditor.ViewModels"
+        xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity" xmlns:behaviors="clr-namespace:PixiEditor.Helpers.Behaviours"
         mc:Ignorable="d"
         d:DesignHeight="600" Topmost="True" ShowInTaskbar="False" d:DesignWidth="450"
         DataContext="{DynamicResource NewFileMenuViewModel}" WindowStyle="None" WindowStartupLocation="CenterScreen" MinHeight="300" MinWidth="400" Height="600" Width="450" Name="newFilePopup" BorderBrush="Black" BorderThickness="1">
@@ -21,11 +22,14 @@
                         Executed="CommandBinding_Executed_Close" />
     </Window.CommandBindings>
 
-    <Grid Background="{StaticResource AccentColor}">
+    <Grid Background="{StaticResource AccentColor}" Focusable="True">
         <Grid.RowDefinitions>
             <RowDefinition Height="35" />
             <RowDefinition />
         </Grid.RowDefinitions>
+        <i:Interaction.Behaviors>
+            <behaviors:ClearFocusOnClickBehavior/>
+        </i:Interaction.Behaviors>
 
         <DockPanel Grid.Row="0" Background="{StaticResource MainColor}">
             <Button DockPanel.Dock="Right" HorizontalAlignment="Right" Style="{StaticResource CloseButtonStyle}"
@@ -45,4 +49,4 @@
                     Command="{Binding OkCommand}"
                     CommandParameter="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Window}}}" />
     </Grid>
-</Window>
+</Window>

+ 3 - 3
PixiEditor/Views/UserControls/SizeInput.xaml

@@ -35,8 +35,8 @@
                 <ColumnDefinition Width="Auto"/>
             </Grid.ColumnDefinitions>
             <TextBox IsEnabled="{Binding IsEnabled, ElementName=uc}" HorizontalContentAlignment="Right"
-                     InputScope="Number" BorderThickness="0" Background="{x:Null}"
-                     Foreground="{Binding Foreground, ElementName=uc}" Focusable="True"
+                     InputScope="Number" BorderThickness="0" Background="Transparent"
+                     Foreground="{Binding Foreground, ElementName=uc}" Focusable="True" CaretBrush="{Binding Foreground, ElementName=uc}"
                      Margin="0,0,5,0" VerticalAlignment="Center"
                      x:Name="textBox"
                      Text="{Binding Size, ElementName=uc, Converter={converters:ToolSizeToIntConverter}}"
@@ -52,4 +52,4 @@
                        Grid.Column="2" Margin="5,0" VerticalAlignment="Center"/>
         </Grid>
     </Border>
-</UserControl>
+</UserControl>

+ 3 - 4
PixiEditor/Views/UserControls/SizeInput.xaml.cs

@@ -1,6 +1,4 @@
-using PixiEditor.Helpers;
-using System;
-using System.Diagnostics;
+using System;
 using System.Windows;
 using System.Windows.Controls;
 using System.Windows.Input;
@@ -126,6 +124,7 @@ namespace PixiEditor.Views
         private void Border_MouseLeftButtonDown(object sender, System.Windows.Input.MouseButtonEventArgs e)
         {
             textBox.Focus();
+            e.Handled = true;
         }
 
         private void Border_MouseWheel(object sender, System.Windows.Input.MouseWheelEventArgs e)
@@ -153,4 +152,4 @@ namespace PixiEditor.Views
             }
         }
     }
-}
+}

+ 5 - 5
PixiEditor/Views/UserControls/SizePicker.xaml

@@ -8,28 +8,28 @@
              d:DesignHeight="110" d:DesignWidth="215" Name="uc">
     <StackPanel Background="{StaticResource MainColor}">
         <DockPanel Margin="5,10,0,0" HorizontalAlignment="Center" VerticalAlignment="Center">
-            <TextBlock Height="30" Foreground="Snow" Text="Width:" TextAlignment="Center" FontSize="16"
+            <TextBlock Height="20" Foreground="Snow" Text="Width:" TextAlignment="Center" FontSize="16"
                        HorizontalAlignment="Center" VerticalAlignment="Center" />
             <local:SizeInput x:Name="WidthPicker" IsEnabled="{Binding EditingEnabled, ElementName=uc}" Width="150" Height="30"
                              PreserveAspectRatio="{Binding Path=IsChecked, ElementName=aspectRatio}"
                              AspectRatioValue="{Binding Path=ChosenHeight, ElementName=uc}"
                              AspectRatioControl="{Binding ElementName=HeightPicker}"
                              HorizontalAlignment="Left" Margin="10,0,0,0"
-                             FontSize="16"
+                             FontSize="16" MaxSize="9999"
                              Size="{Binding Path=ChosenWidth, ElementName=uc, Mode=TwoWay}" />
         </DockPanel>
         <DockPanel Margin="5,10,0,0" HorizontalAlignment="Center" VerticalAlignment="Center">
-            <TextBlock Height="30" Foreground="Snow" Text="Height:" TextAlignment="Center" FontSize="16"
+            <TextBlock Height="20" Foreground="Snow" Text="Height:" TextAlignment="Center" FontSize="16"
                        HorizontalAlignment="Center" VerticalAlignment="Center" />
             <local:SizeInput x:Name="HeightPicker" IsEnabled="{Binding EditingEnabled, ElementName=uc}" Margin="5,0,0,0"
                              PreserveAspectRatio="{Binding Path=IsChecked, ElementName=aspectRatio}"
                              AspectRatioValue="{Binding Path=ChosenWidth, ElementName=uc}"
                              AspectRatioControl="{Binding ElementName=WidthPicker}"
                              HorizontalAlignment="Left" Width="150" Height="30"
-                             FontSize="16"
+                             FontSize="16" MaxSize="9999"
                              Size="{Binding ChosenHeight, ElementName=uc, Mode=TwoWay}" />
         </DockPanel>
         <CheckBox Name="aspectRatio" Content="Preserve aspect ratio" Foreground="White" HorizontalAlignment="Left"
                   IsChecked="True" Margin="50,10,0,0" />
     </StackPanel>
-</UserControl>
+</UserControl>