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/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/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/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" />
@ -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/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/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/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" />

View File

@ -30,13 +30,13 @@ namespace Artemis.Core
/// <summary>
/// The rotation of the shape in degree
/// </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; }
/// <summary>
/// The opacity of the shape
/// </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; }
/// <inheritdoc />

View File

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

View File

@ -134,13 +134,17 @@ public partial class DraggableNumberBox : UserControl
_inputTextBox = _numberBox.FindDescendantOfType<TextBox>();
_moved = false;
_startX = point.Position.X;
_lastX = point.Position.X;
e.Handled = true;
}
private void OnPointerMoved(object? sender, PointerEventArgs e)
{
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;
return;
@ -155,11 +159,24 @@ public partial class DraggableNumberBox : UserControl
DragStarted?.Invoke(this, EventArgs.Empty);
}
double smallChange = SmallChange != 0 ? SmallChange : 0.1;
double largeChange = LargeChange != 0 ? LargeChange : smallChange * 10;
double changeMultiplier = e.KeyModifiers.HasFlag(KeyModifiers.Shift) ? smallChange : largeChange;
double smallChange;
if (SmallChange != 0)
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;
e.Handled = true;
}

View File

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

View File

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

View File

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

View File

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

View File

@ -24,7 +24,16 @@
</TreeDataTemplate>
</ItemsControl.ItemTemplate>
</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>

View File

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

View File

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

View File

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

View File

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

View File

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