Browse Source

Fixed label not clickable for checkbox in toolbar

Krzysztof Krysiński 4 months ago
parent
commit
10346a48db

+ 1 - 0
src/PixiEditor/ViewModels/Tools/ToolSettings/Settings/BoolSettingViewModel.cs

@@ -19,5 +19,6 @@ internal sealed class BoolSettingViewModel : Setting<bool>
     {
     {
         Label = label;
         Label = label;
         Value = isChecked;
         Value = isChecked;
+        IsLabelVisible = false;
     }
     }
 }
 }

+ 3 - 1
src/PixiEditor/ViewModels/Tools/ToolSettings/Settings/Setting.cs

@@ -104,10 +104,12 @@ internal abstract class Setting : ObservableObject
     public string Tooltip { get; set; }
     public string Tooltip { get; set; }
 
 
     public bool HasLabel => !string.IsNullOrEmpty(Label);
     public bool HasLabel => !string.IsNullOrEmpty(Label);
+    public bool IsBuiltInLabelVisible => HasLabel && IsLabelVisible;
     public bool HasIcon => !string.IsNullOrEmpty(Icon);
     public bool HasIcon => !string.IsNullOrEmpty(Icon);
-
     public bool AllowIconLabel { get; protected set; } = true;
     public bool AllowIconLabel { get; protected set; } = true;
 
 
+    public bool IsLabelVisible { get; set; } = true;
+
     public object UserValue
     public object UserValue
     {
     {
         get => _value;
         get => _value;

+ 1 - 1
src/PixiEditor/Views/Main/Tools/Toolbar.axaml

@@ -69,7 +69,7 @@
                         <StackPanel IsVisible="{Binding IsExposed}" Orientation="Horizontal"
                         <StackPanel IsVisible="{Binding IsExposed}" Orientation="Horizontal"
                                     VerticalAlignment="Center" Margin="5,0,5,0">
                                     VerticalAlignment="Center" Margin="5,0,5,0">
                             <Label
                             <Label
-                                IsVisible="{Binding HasLabel}" VerticalAlignment="Center"
+                                IsVisible="{Binding IsBuiltInLabelVisible}" VerticalAlignment="Center"
                                 Foreground="{DynamicResource ThemeForegroundBrush}"
                                 Foreground="{DynamicResource ThemeForegroundBrush}"
                                 ui:Translator.TooltipKey="{Binding Tooltip}"
                                 ui:Translator.TooltipKey="{Binding Tooltip}"
                                 ui:Translator.Key="{Binding Label.Key}" />
                                 ui:Translator.Key="{Binding Label.Key}" />

+ 3 - 1
src/PixiEditor/Views/Tools/ToolSettings/Settings/BoolSettingView.axaml

@@ -12,7 +12,9 @@
     </Design.DataContext>
     </Design.DataContext>
 
 
     <Grid>
     <Grid>
-        <CheckBox VerticalAlignment="Center" Focusable="False" IsChecked="{Binding Value, Mode=TwoWay}">
+        <CheckBox VerticalAlignment="Center" Focusable="False"
+                  ui:Translator.Key="{Binding Label}"
+                  IsChecked="{Binding Value, Mode=TwoWay}">
            <CheckBox.IsVisible>
            <CheckBox.IsVisible>
                <MultiBinding Converter="{converters:AllTrueConverter}">
                <MultiBinding Converter="{converters:AllTrueConverter}">
                    <Binding Path="HasLabel"/>
                    <Binding Path="HasLabel"/>