1
0
mirror of https://github.com/Artemis-RGB/Artemis synced 2025-12-13 05:48:35 +00:00

Layer properties - Tweaked step sizes for draggable float

UI - Tweak selection rectangle design
This commit is contained in:
Robert 2022-06-15 21:57:10 +02:00
parent c0e2d8e579
commit e1a66f8a7e
14 changed files with 85 additions and 57 deletions

View File

@ -32,6 +32,7 @@
<entry key="Artemis.UI/DefaultTypes/PropertyInput/SKColorPropertyInputView.axaml" value="Artemis.UI.Linux/Artemis.UI.Linux.csproj" /> <entry key="Artemis.UI/DefaultTypes/PropertyInput/SKColorPropertyInputView.axaml" value="Artemis.UI.Linux/Artemis.UI.Linux.csproj" />
<entry key="Artemis.UI/DefaultTypes/PropertyInput/SKPointPropertyInputView.axaml" value="Artemis.UI.Linux/Artemis.UI.Linux.csproj" /> <entry key="Artemis.UI/DefaultTypes/PropertyInput/SKPointPropertyInputView.axaml" value="Artemis.UI.Linux/Artemis.UI.Linux.csproj" />
<entry key="Artemis.UI/DefaultTypes/PropertyInput/SKSizePropertyInputView.axaml" value="Artemis.UI.Linux/Artemis.UI.Linux.csproj" /> <entry key="Artemis.UI/DefaultTypes/PropertyInput/SKSizePropertyInputView.axaml" value="Artemis.UI.Linux/Artemis.UI.Linux.csproj" />
<entry key="Artemis.UI/DefaultTypes/PropertyInput/StringPropertyInputView.axaml" value="Artemis.UI.Linux/Artemis.UI.Linux.csproj" />
<entry key="Artemis.UI/MainWindow.axaml" value="Artemis.UI.Linux/Artemis.UI.Linux.csproj" /> <entry key="Artemis.UI/MainWindow.axaml" value="Artemis.UI.Linux/Artemis.UI.Linux.csproj" />
<entry key="Artemis.UI/Screens/Device/DevicePropertiesView.axaml" value="Artemis.UI.Linux/Artemis.UI.Linux.csproj" /> <entry key="Artemis.UI/Screens/Device/DevicePropertiesView.axaml" value="Artemis.UI.Linux/Artemis.UI.Linux.csproj" />
<entry key="Artemis.UI/Screens/Device/DeviceSettingsView.axaml" value="Artemis.UI.Linux/Artemis.UI.Linux.csproj" /> <entry key="Artemis.UI/Screens/Device/DeviceSettingsView.axaml" value="Artemis.UI.Linux/Artemis.UI.Linux.csproj" />
@ -62,6 +63,8 @@
<entry key="Artemis.UI/Screens/ProfileEditor/Panels/Properties/Tree/TreePropertyView.axaml" value="Artemis.UI.Linux/Artemis.UI.Linux.csproj" /> <entry key="Artemis.UI/Screens/ProfileEditor/Panels/Properties/Tree/TreePropertyView.axaml" value="Artemis.UI.Linux/Artemis.UI.Linux.csproj" />
<entry key="Artemis.UI/Screens/ProfileEditor/Panels/Properties/Windows/EffectConfigurationWindowView.axaml" value="Artemis.UI.Linux/Artemis.UI.Linux.csproj" /> <entry key="Artemis.UI/Screens/ProfileEditor/Panels/Properties/Windows/EffectConfigurationWindowView.axaml" value="Artemis.UI.Linux/Artemis.UI.Linux.csproj" />
<entry key="Artemis.UI/Screens/ProfileEditor/Panels/StatusBar/StatusBarView.axaml" value="Artemis.UI.Linux/Artemis.UI.Linux.csproj" /> <entry key="Artemis.UI/Screens/ProfileEditor/Panels/StatusBar/StatusBarView.axaml" value="Artemis.UI.Linux/Artemis.UI.Linux.csproj" />
<entry key="Artemis.UI/Screens/ProfileEditor/Panels/VisualEditor/Tools/SelectionAddToolView.axaml" value="Artemis.UI.Linux/Artemis.UI.Linux.csproj" />
<entry key="Artemis.UI/Screens/ProfileEditor/Panels/VisualEditor/Tools/SelectionRemoveToolView.axaml" value="Artemis.UI.Linux/Artemis.UI.Linux.csproj" />
<entry key="Artemis.UI/Screens/ProfileEditor/Panels/VisualEditor/Tools/TransformToolView.axaml" value="Artemis.UI.Linux/Artemis.UI.Linux.csproj" /> <entry key="Artemis.UI/Screens/ProfileEditor/Panels/VisualEditor/Tools/TransformToolView.axaml" value="Artemis.UI.Linux/Artemis.UI.Linux.csproj" />
<entry key="Artemis.UI/Screens/ProfileEditor/Panels/VisualEditor/VisualEditorView.axaml" value="Artemis.UI.Windows/Artemis.UI.Windows.csproj" /> <entry key="Artemis.UI/Screens/ProfileEditor/Panels/VisualEditor/VisualEditorView.axaml" value="Artemis.UI.Windows/Artemis.UI.Windows.csproj" />
<entry key="Artemis.UI/Screens/ProfileEditor/ProfileEditorTitleBarView.axaml" value="Artemis.UI.Linux/Artemis.UI.Linux.csproj" /> <entry key="Artemis.UI/Screens/ProfileEditor/ProfileEditorTitleBarView.axaml" value="Artemis.UI.Linux/Artemis.UI.Linux.csproj" />

View File

@ -30,13 +30,13 @@ namespace Artemis.Core
/// <summary> /// <summary>
/// The rotation of the shape in degree /// The rotation of the shape in degree
/// </summary> /// </summary>
[PropertyDescription(Description = "The rotation of the shape in degrees", InputAffix = "°")] [PropertyDescription(Description = "The rotation of the shape in degrees", InputAffix = "°", InputStepSize = 0.5f)]
public FloatLayerProperty Rotation { get; set; } public FloatLayerProperty Rotation { get; set; }
/// <summary> /// <summary>
/// The opacity of the shape /// The opacity of the shape
/// </summary> /// </summary>
[PropertyDescription(Description = "The opacity of the shape", InputAffix = "%", MinInputValue = 0f, MaxInputValue = 100f)] [PropertyDescription(Description = "The opacity of the shape", InputAffix = "%", MinInputValue = 0f, MaxInputValue = 100f, InputStepSize = 0.1f)]
public FloatLayerProperty Opacity { get; set; } public FloatLayerProperty Opacity { get; set; }
/// <inheritdoc /> /// <inheritdoc />

View File

@ -60,7 +60,7 @@ namespace Artemis.Core.LayerBrushes
continue; continue;
// Let the brush determine the color // Let the brush determine the color
paint.Color = GetColor(artemisLed, renderPoint); paint.Color = GetColor(artemisLed, renderPoint).WithAlpha(paint.Color.Alpha);
SKRect ledRectangle = SKRect.Create( SKRect ledRectangle = SKRect.Create(
artemisLed.AbsoluteRectangle.Left - Layer.Bounds.Left, artemisLed.AbsoluteRectangle.Left - Layer.Bounds.Left,

View File

@ -134,13 +134,17 @@ public partial class DraggableNumberBox : UserControl
_inputTextBox = _numberBox.FindDescendantOfType<TextBox>(); _inputTextBox = _numberBox.FindDescendantOfType<TextBox>();
_moved = false; _moved = false;
_startX = point.Position.X; _startX = point.Position.X;
_lastX = point.Position.X;
e.Handled = true; e.Handled = true;
} }
private void OnPointerMoved(object? sender, PointerEventArgs e) private void OnPointerMoved(object? sender, PointerEventArgs e)
{ {
PointerPoint point = e.GetCurrentPoint(this); PointerPoint point = e.GetCurrentPoint(this);
if (!_moved && Math.Abs(point.Position.X - _startX) < 2 || !point.Properties.IsLeftButtonPressed || _inputTextBox == null || _inputTextBox.IsFocused) if (!point.Properties.IsLeftButtonPressed || _inputTextBox == null || _inputTextBox.IsFocused)
return;
if (!_moved && Math.Abs(point.Position.X - _startX) < 2)
{ {
_lastX = point.Position.X; _lastX = point.Position.X;
return; return;
@ -155,11 +159,24 @@ public partial class DraggableNumberBox : UserControl
DragStarted?.Invoke(this, EventArgs.Empty); DragStarted?.Invoke(this, EventArgs.Empty);
} }
double smallChange = SmallChange != 0 ? SmallChange : 0.1; double smallChange;
double largeChange = LargeChange != 0 ? LargeChange : smallChange * 10; if (SmallChange != 0)
double changeMultiplier = e.KeyModifiers.HasFlag(KeyModifiers.Shift) ? smallChange : largeChange; smallChange = SmallChange;
else if (LargeChange != 0)
smallChange = LargeChange / 10;
else
smallChange = 0.1;
Value += (point.Position.X - _lastX) * changeMultiplier; double largeChange;
if (LargeChange != 0)
largeChange = LargeChange;
else if (LargeChange != 0)
largeChange = LargeChange * 10;
else
largeChange = 1;
double changeMultiplier = e.KeyModifiers.HasFlag(KeyModifiers.Shift) ? smallChange : largeChange;
Value = Math.Clamp(Value + (point.Position.X - _lastX) * changeMultiplier, Minimum, Maximum);
_lastX = point.Position.X; _lastX = point.Position.X;
e.Handled = true; e.Handled = true;
} }

View File

@ -7,19 +7,19 @@
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450" mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
x:Class="Artemis.UI.DefaultTypes.PropertyInput.FloatPropertyInputView" x:Class="Artemis.UI.DefaultTypes.PropertyInput.FloatPropertyInputView"
x:DataType="propertyInput:FloatPropertyInputViewModel"> x:DataType="propertyInput:FloatPropertyInputViewModel">
<UserControl.Styles> <UserControl.Styles>
<StyleInclude Source="/DefaultTypes/PropertyInput/PropertyInputStyles.axaml" /> <StyleInclude Source="/DefaultTypes/PropertyInput/PropertyInputStyles.axaml" />
</UserControl.Styles> </UserControl.Styles>
<controls:DraggableNumberBox Classes="condensed tooltip-validation-left" <controls:DraggableNumberBox Classes="condensed tooltip-validation-left"
MinWidth="80" MinWidth="80"
Value="{CompiledBinding InputValue}" Value="{CompiledBinding InputValue}"
Prefix="{CompiledBinding Prefix}" Prefix="{CompiledBinding Prefix}"
Suffix="{CompiledBinding Affix}" Suffix="{CompiledBinding Affix}"
Minimum="{CompiledBinding MinInputValue}" Minimum="{CompiledBinding MinInputValue}"
Maximum="{CompiledBinding MaxInputValue}" Maximum="{CompiledBinding MaxInputValue}"
SmallChange="{Binding LayerProperty.PropertyDescription.InputStepSize}" LargeChange="{Binding LayerProperty.PropertyDescription.InputStepSize}"
SimpleNumberFormat="F3" SimpleNumberFormat="F3"
VerticalAlignment="Center" VerticalAlignment="Center"
DragStarted="DraggableNumberBox_OnDragStarted" DragStarted="DraggableNumberBox_OnDragStarted"
DragFinished="DraggableNumberBox_OnDragFinished"/> DragFinished="DraggableNumberBox_OnDragFinished" />
</UserControl> </UserControl>

View File

@ -17,9 +17,9 @@
Suffix="{CompiledBinding Affix}" Suffix="{CompiledBinding Affix}"
Minimum="{CompiledBinding MinInputValue}" Minimum="{CompiledBinding MinInputValue}"
Maximum="{CompiledBinding MaxInputValue}" Maximum="{CompiledBinding MaxInputValue}"
SmallChange="{Binding LayerProperty.PropertyDescription.InputStepSize}" LargeChange="{Binding LayerProperty.PropertyDescription.InputStepSize}"
SimpleNumberFormat="F1" SimpleNumberFormat="F1"
VerticalAlignment="Center" VerticalAlignment="Center"
DragStarted="DraggableNumberBox_OnDragStarted" DragStarted="DraggableNumberBox_OnDragStarted"
DragFinished="DraggableNumberBox_OnDragFinished"/> DragFinished="DraggableNumberBox_OnDragFinished" />
</UserControl> </UserControl>

View File

@ -7,30 +7,29 @@
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450" mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
x:Class="Artemis.UI.DefaultTypes.PropertyInput.SKPointPropertyInputView" x:Class="Artemis.UI.DefaultTypes.PropertyInput.SKPointPropertyInputView"
x:DataType="propertyInput:SKPointPropertyInputViewModel"> x:DataType="propertyInput:SKPointPropertyInputViewModel">
<StackPanel Orientation="Horizontal" Spacing="5"> <StackPanel Orientation="Horizontal" Spacing="5">
<controls:DraggableNumberBox Classes="condensed tooltip-validation-left" <controls:DraggableNumberBox Classes="condensed tooltip-validation-left"
MinWidth="80" MinWidth="80"
Value="{CompiledBinding X}" Value="{CompiledBinding X}"
Prefix="{CompiledBinding Prefix}" Prefix="{CompiledBinding Prefix}"
Suffix="{CompiledBinding Affix}" Suffix="{CompiledBinding Affix}"
SmallChange="{Binding LayerProperty.PropertyDescription.InputStepSize}" LargeChange="{Binding LayerProperty.PropertyDescription.InputStepSize}"
SimpleNumberFormat="F3" SimpleNumberFormat="F3"
VerticalAlignment="Center" VerticalAlignment="Center"
ToolTip.Tip="X-coordinate (horizontal)" ToolTip.Tip="X-coordinate (horizontal)"
DragStarted="DraggableNumberBox_OnDragStarted" DragStarted="DraggableNumberBox_OnDragStarted"
DragFinished="DraggableNumberBox_OnDragFinished"/> DragFinished="DraggableNumberBox_OnDragFinished" />
<TextBlock VerticalAlignment="Center">,</TextBlock> <TextBlock VerticalAlignment="Center">,</TextBlock>
<controls:DraggableNumberBox Classes="condensed tooltip-validation-left" <controls:DraggableNumberBox Classes="condensed tooltip-validation-left"
MinWidth="80" MinWidth="80"
Value="{CompiledBinding Y}" Value="{CompiledBinding Y}"
Prefix="{CompiledBinding Prefix}" Prefix="{CompiledBinding Prefix}"
Suffix="{CompiledBinding Affix}" Suffix="{CompiledBinding Affix}"
SmallChange="{Binding LayerProperty.PropertyDescription.InputStepSize}" LargeChange="{Binding LayerProperty.PropertyDescription.InputStepSize}"
SimpleNumberFormat="F3" SimpleNumberFormat="F3"
VerticalAlignment="Center" VerticalAlignment="Center"
ToolTip.Tip="Y-coordinate (vertical)" ToolTip.Tip="Y-coordinate (vertical)"
DragStarted="DraggableNumberBox_OnDragStarted" DragStarted="DraggableNumberBox_OnDragStarted"
DragFinished="DraggableNumberBox_OnDragFinished"/> DragFinished="DraggableNumberBox_OnDragFinished" />
</StackPanel> </StackPanel>
</UserControl> </UserControl>

View File

@ -9,27 +9,27 @@
x:DataType="propertyInput:SKSizePropertyInputViewModel"> x:DataType="propertyInput:SKSizePropertyInputViewModel">
<StackPanel Orientation="Horizontal" Spacing="5"> <StackPanel Orientation="Horizontal" Spacing="5">
<controls:DraggableNumberBox Classes="condensed tooltip-validation-left" <controls:DraggableNumberBox Classes="condensed tooltip-validation-left"
MinWidth="80" MinWidth="80"
Value="{CompiledBinding Height}" Value="{CompiledBinding Height}"
Prefix="{CompiledBinding Prefix}" Prefix="{CompiledBinding Prefix}"
Suffix="{CompiledBinding Affix}" Suffix="{CompiledBinding Affix}"
SmallChange="{Binding LayerProperty.PropertyDescription.InputStepSize}" LargeChange="{Binding LayerProperty.PropertyDescription.InputStepSize}"
SimpleNumberFormat="F3" SimpleNumberFormat="F3"
VerticalAlignment="Center" VerticalAlignment="Center"
ToolTip.Tip="Height" ToolTip.Tip="Height"
DragStarted="DraggableNumberBox_OnDragStarted" DragStarted="DraggableNumberBox_OnDragStarted"
DragFinished="DraggableNumberBox_OnDragFinished"/> DragFinished="DraggableNumberBox_OnDragFinished" />
<TextBlock VerticalAlignment="Center">,</TextBlock> <TextBlock VerticalAlignment="Center">,</TextBlock>
<controls:DraggableNumberBox Classes="condensed tooltip-validation-left" <controls:DraggableNumberBox Classes="condensed tooltip-validation-left"
MinWidth="80" MinWidth="80"
Value="{CompiledBinding Width}" Value="{CompiledBinding Width}"
Prefix="{CompiledBinding Prefix}" Prefix="{CompiledBinding Prefix}"
Suffix="{CompiledBinding Affix}" Suffix="{CompiledBinding Affix}"
SmallChange="{Binding LayerProperty.PropertyDescription.InputStepSize}" LargeChange="{Binding LayerProperty.PropertyDescription.InputStepSize}"
SimpleNumberFormat="F3" SimpleNumberFormat="F3"
VerticalAlignment="Center" VerticalAlignment="Center"
ToolTip.Tip="Width" ToolTip.Tip="Width"
DragStarted="DraggableNumberBox_OnDragStarted" DragStarted="DraggableNumberBox_OnDragStarted"
DragFinished="DraggableNumberBox_OnDragFinished"/> DragFinished="DraggableNumberBox_OnDragFinished" />
</StackPanel> </StackPanel>
</UserControl> </UserControl>

View File

@ -24,7 +24,16 @@
</TreeDataTemplate> </TreeDataTemplate>
</ItemsControl.ItemTemplate> </ItemsControl.ItemTemplate>
</ItemsControl> </ItemsControl>
<shared:SelectionRectangle Name="SelectionRectangle" InputElement="{CompiledBinding $parent}" SelectionFinished="SelectionRectangle_OnSelectionFinished" /> <shared:SelectionRectangle Name="SelectionRectangle"
InputElement="{CompiledBinding $parent}"
BorderBrush="{DynamicResource SystemAccentColor}"
BorderRadius="8"
BorderThickness="1"
SelectionFinished="SelectionRectangle_OnSelectionFinished">
<shared:SelectionRectangle.Background>
<SolidColorBrush Color="{DynamicResource SystemAccentColorLight1}" Opacity="0.2" />
</shared:SelectionRectangle.Background>
</shared:SelectionRectangle>
</Grid> </Grid>

View File

@ -9,7 +9,7 @@
<shared:SelectionRectangle InputElement="{Binding $parent[ZoomBorder]}" <shared:SelectionRectangle InputElement="{Binding $parent[ZoomBorder]}"
BorderBrush="{DynamicResource SystemAccentColor}" BorderBrush="{DynamicResource SystemAccentColor}"
BorderRadius="8" BorderRadius="8"
BorderThickness="2" BorderThickness="1"
SelectionFinished="SelectionRectangle_OnSelectionFinished" SelectionFinished="SelectionRectangle_OnSelectionFinished"
ZoomRatio="{Binding $parent[ZoomBorder].ZoomX}"> ZoomRatio="{Binding $parent[ZoomBorder].ZoomX}">
<shared:SelectionRectangle.Background> <shared:SelectionRectangle.Background>

View File

@ -11,7 +11,7 @@
<shared:SelectionRectangle InputElement="{Binding $parent[paz:ZoomBorder]}" <shared:SelectionRectangle InputElement="{Binding $parent[paz:ZoomBorder]}"
BorderBrush="{DynamicResource SystemAccentColor}" BorderBrush="{DynamicResource SystemAccentColor}"
BorderRadius="8" BorderRadius="8"
BorderThickness="2" BorderThickness="1"
SelectionFinished="SelectionRectangle_OnSelectionFinished" SelectionFinished="SelectionRectangle_OnSelectionFinished"
ZoomRatio="{Binding $parent[ZoomBorder].ZoomX}"> ZoomRatio="{Binding $parent[ZoomBorder].ZoomX}">
<shared:SelectionRectangle.Background> <shared:SelectionRectangle.Background>

View File

@ -30,8 +30,7 @@
HorizontalAlignment="Stretch" HorizontalAlignment="Stretch"
Background="{StaticResource LargeCheckerboardBrush}" Background="{StaticResource LargeCheckerboardBrush}"
ZoomChanged="ZoomBorder_OnZoomChanged"> ZoomChanged="ZoomBorder_OnZoomChanged">
<Grid Name="ContainerGrid" <Grid Name="ContainerGrid" Background="Transparent">
Background="Transparent">
<Grid.Transitions> <Grid.Transitions>
<Transitions> <Transitions>
<TransformOperationsTransition Property="RenderTransform" Duration="0:0:0.2" Easing="CubicEaseOut" /> <TransformOperationsTransition Property="RenderTransform" Duration="0:0:0.2" Easing="CubicEaseOut" />

View File

@ -103,7 +103,9 @@
InputElement="{Binding #ZoomBorder}" InputElement="{Binding #ZoomBorder}"
SelectionUpdated="SelectionRectangle_OnSelectionUpdated" SelectionUpdated="SelectionRectangle_OnSelectionUpdated"
BorderBrush="{DynamicResource SystemAccentColor}" BorderBrush="{DynamicResource SystemAccentColor}"
BorderRadius="8"> BorderRadius="8"
BorderThickness="1"
ZoomRatio="{Binding $parent[ZoomBorder].ZoomX}">
<shared:SelectionRectangle.Background> <shared:SelectionRectangle.Background>
<SolidColorBrush Color="{DynamicResource SystemAccentColorLight1}" Opacity="0.2" /> <SolidColorBrush Color="{DynamicResource SystemAccentColorLight1}" Opacity="0.2" />
</shared:SelectionRectangle.Background> </shared:SelectionRectangle.Background>

View File

@ -47,7 +47,6 @@ public class SurfaceEditorView : ReactiveUserControl<SurfaceEditorViewModel>
private void ZoomBorder_OnZoomChanged(object sender, ZoomChangedEventArgs e) private void ZoomBorder_OnZoomChanged(object sender, ZoomChangedEventArgs e)
{ {
UpdateZoomBorderBackground(); UpdateZoomBorderBackground();
_selectionRectangle.BorderThickness = 1 / _zoomBorder.ZoomX;
_surfaceBounds.BorderThickness = new Thickness(2 / _zoomBorder.ZoomX); _surfaceBounds.BorderThickness = new Thickness(2 / _zoomBorder.ZoomX);
} }