From 9bbab5f9f813eb305971689399823eb8d8bd746a Mon Sep 17 00:00:00 2001 From: Robert Date: Sat, 8 Jan 2022 11:14:58 +0100 Subject: [PATCH] Surface editor - Selection improvements --- src/Artemis.Core/Artemis.Core.csproj | 2 +- src/Artemis.Core/packages.lock.json | 18 +++++- .../Artemis.UI.Avalonia.Shared.xml | 52 ++++++++++++----- .../Artemis.UI.Shared.csproj | 2 +- src/Artemis.UI.Shared/packages.lock.json | 20 +++++-- src/Artemis.UI/packages.lock.json | 22 ++++++-- .../Artemis.VisualScripting.csproj | 2 +- .../packages.lock.json | 46 +++++++++------ .../Artemis.UI.Linux/packages.lock.json | 34 +++++------ .../Artemis.UI.MacOS/packages.lock.json | 34 +++++------ .../Artemis.UI.Shared.csproj | 3 +- .../Controls/SelectionRectangle.cs | 56 +++++++++---------- .../Events/SelectionRectangleEventArgs.cs | 32 +++++++++++ .../Artemis.UI.Shared/packages.lock.json | 47 ++++++++-------- .../Artemis.UI.Windows/packages.lock.json | 34 +++++------ src/Avalonia/Artemis.UI/Artemis.UI.csproj | 5 +- .../SurfaceEditor/SurfaceDeviceView.axaml.cs | 17 +----- .../SurfaceEditor/SurfaceDeviceViewModel.cs | 2 +- .../SurfaceEditor/SurfaceEditorView.axaml | 7 ++- .../SurfaceEditor/SurfaceEditorView.axaml.cs | 28 ++++++++-- .../SurfaceEditor/SurfaceEditorViewModel.cs | 46 +++++++++++---- src/Avalonia/Artemis.UI/packages.lock.json | 54 +++++++++--------- 22 files changed, 351 insertions(+), 212 deletions(-) create mode 100644 src/Avalonia/Artemis.UI.Shared/Events/SelectionRectangleEventArgs.cs diff --git a/src/Artemis.Core/Artemis.Core.csproj b/src/Artemis.Core/Artemis.Core.csproj index 8dae54df3..669f4f352 100644 --- a/src/Artemis.Core/Artemis.Core.csproj +++ b/src/Artemis.Core/Artemis.Core.csproj @@ -54,7 +54,7 @@ - + diff --git a/src/Artemis.Core/packages.lock.json b/src/Artemis.Core/packages.lock.json index 5a7965ee7..d26c26b75 100644 --- a/src/Artemis.Core/packages.lock.json +++ b/src/Artemis.Core/packages.lock.json @@ -132,10 +132,12 @@ }, "SkiaSharp": { "type": "Direct", - "requested": "[2.80.3, )", - "resolved": "2.80.3", - "contentHash": "qX6tGNP3+MXNYe2pKm0PCRiJ/cx+LTeLaggwZifB7sUMXhECfKKKHJq45VqZKt37xQegnCCdf1jHXwmHeJQs5Q==", + "requested": "[2.88.0-preview.178, )", + "resolved": "2.88.0-preview.178", + "contentHash": "arzd/44ykiBPqGWUuQqNTuJ49rhsXOg4Zw1p2Mm3B/5PZzV1wcTH4V+J+4ra8RS0KbIoy4KWeNF+zHAifNsiRg==", "dependencies": { + "SkiaSharp.NativeAssets.Win32": "2.88.0-preview.178", + "SkiaSharp.NativeAssets.macOS": "2.88.0-preview.178", "System.Memory": "4.5.3" } }, @@ -393,6 +395,16 @@ "resolved": "4.3.0", "contentHash": "VB5cn/7OzUfzdnC8tqAIMQciVLiq2epm2NrAm1E9OjNRyG4lVhfR61SMcLizejzQP8R8Uf/0l5qOIbUEi+RdEg==" }, + "SkiaSharp.NativeAssets.macOS": { + "type": "Transitive", + "resolved": "2.88.0-preview.178", + "contentHash": "+Hs3ku4buimzBHuc8FoyjOcE6eU5r98zcG7WH/s+doYQ1bFIjk+dKfqthgZ2o0NRAv8D3esq9rWrZTj12q+m1w==" + }, + "SkiaSharp.NativeAssets.Win32": { + "type": "Transitive", + "resolved": "2.88.0-preview.178", + "contentHash": "9og9GCkdZc/NYrmbsRzohmIBRlS1oFegJiBMsoG93qYjhh2o6q5QBYxd61zw5Mgeytl3qj4YM+6BNIF4tcF+6w==" + }, "System.AppContext": { "type": "Transitive", "resolved": "4.3.0", diff --git a/src/Artemis.UI.Avalonia.Shared/Artemis.UI.Avalonia.Shared.xml b/src/Artemis.UI.Avalonia.Shared/Artemis.UI.Avalonia.Shared.xml index dd63d4ca4..0a46a2c7c 100644 --- a/src/Artemis.UI.Avalonia.Shared/Artemis.UI.Avalonia.Shared.xml +++ b/src/Artemis.UI.Avalonia.Shared/Artemis.UI.Avalonia.Shared.xml @@ -209,16 +209,6 @@ Defines the property. - - - Defines the property. - - - - - Defines the property. - - @@ -239,19 +229,31 @@ - Gets or sets the element that captures input for the selection rectangle. + Gets or sets the element that captures input for the selection rectangle. - + - Gets or sets the command to execute when the selection has been updated. + Occurs when the selection rect is being updated, indicating the user is dragging. - + - Gets or sets the command to execute when the selection has finished. + Occurs when the selection has finished, indicating the user stopped dragging. + + + Invokes the event + + + + + + Invokes the event + + + @@ -783,6 +785,26 @@ If applicable, the previous active profile element before the event was raised + + + Provides data on selection events raised by the . + + + + + Creates a new instance of the class. + + + + + Gets the rectangle that was selected when the event occurred. + + + + + Gets the key modifiers that where pressed when the event occurred. + + Represents errors that occur within the Artemis Shared UI library diff --git a/src/Artemis.UI.Shared/Artemis.UI.Shared.csproj b/src/Artemis.UI.Shared/Artemis.UI.Shared.csproj index 6296c1e13..fd2e58c98 100644 --- a/src/Artemis.UI.Shared/Artemis.UI.Shared.csproj +++ b/src/Artemis.UI.Shared/Artemis.UI.Shared.csproj @@ -41,7 +41,7 @@ - + diff --git a/src/Artemis.UI.Shared/packages.lock.json b/src/Artemis.UI.Shared/packages.lock.json index dd8462ae7..5f0bb3e94 100644 --- a/src/Artemis.UI.Shared/packages.lock.json +++ b/src/Artemis.UI.Shared/packages.lock.json @@ -66,10 +66,12 @@ }, "SkiaSharp": { "type": "Direct", - "requested": "[2.80.3, )", - "resolved": "2.80.3", - "contentHash": "qX6tGNP3+MXNYe2pKm0PCRiJ/cx+LTeLaggwZifB7sUMXhECfKKKHJq45VqZKt37xQegnCCdf1jHXwmHeJQs5Q==", + "requested": "[2.88.0-preview.178, )", + "resolved": "2.88.0-preview.178", + "contentHash": "arzd/44ykiBPqGWUuQqNTuJ49rhsXOg4Zw1p2Mm3B/5PZzV1wcTH4V+J+4ra8RS0KbIoy4KWeNF+zHAifNsiRg==", "dependencies": { + "SkiaSharp.NativeAssets.Win32": "2.88.0-preview.178", + "SkiaSharp.NativeAssets.macOS": "2.88.0-preview.178", "System.Memory": "4.5.3" } }, @@ -422,6 +424,16 @@ "Serilog": "2.10.0" } }, + "SkiaSharp.NativeAssets.macOS": { + "type": "Transitive", + "resolved": "2.88.0-preview.178", + "contentHash": "+Hs3ku4buimzBHuc8FoyjOcE6eU5r98zcG7WH/s+doYQ1bFIjk+dKfqthgZ2o0NRAv8D3esq9rWrZTj12q+m1w==" + }, + "SkiaSharp.NativeAssets.Win32": { + "type": "Transitive", + "resolved": "2.88.0-preview.178", + "contentHash": "9og9GCkdZc/NYrmbsRzohmIBRlS1oFegJiBMsoG93qYjhh2o6q5QBYxd61zw5Mgeytl3qj4YM+6BNIF4tcF+6w==" + }, "SkiaSharp.Views.Desktop.Common": { "type": "Transitive", "resolved": "2.80.3", @@ -1332,7 +1344,7 @@ "Serilog.Sinks.Console": "4.0.0", "Serilog.Sinks.Debug": "2.0.0", "Serilog.Sinks.File": "5.0.0", - "SkiaSharp": "2.80.3", + "SkiaSharp": "2.88.0-preview.178", "System.Buffers": "4.5.1", "System.IO.FileSystem.AccessControl": "5.0.0", "System.Numerics.Vectors": "4.5.0", diff --git a/src/Artemis.UI/packages.lock.json b/src/Artemis.UI/packages.lock.json index 5e9f3bdac..30b18815f 100644 --- a/src/Artemis.UI/packages.lock.json +++ b/src/Artemis.UI/packages.lock.json @@ -565,12 +565,24 @@ }, "SkiaSharp": { "type": "Transitive", - "resolved": "2.80.3", - "contentHash": "qX6tGNP3+MXNYe2pKm0PCRiJ/cx+LTeLaggwZifB7sUMXhECfKKKHJq45VqZKt37xQegnCCdf1jHXwmHeJQs5Q==", + "resolved": "2.88.0-preview.178", + "contentHash": "arzd/44ykiBPqGWUuQqNTuJ49rhsXOg4Zw1p2Mm3B/5PZzV1wcTH4V+J+4ra8RS0KbIoy4KWeNF+zHAifNsiRg==", "dependencies": { + "SkiaSharp.NativeAssets.Win32": "2.88.0-preview.178", + "SkiaSharp.NativeAssets.macOS": "2.88.0-preview.178", "System.Memory": "4.5.3" } }, + "SkiaSharp.NativeAssets.macOS": { + "type": "Transitive", + "resolved": "2.88.0-preview.178", + "contentHash": "+Hs3ku4buimzBHuc8FoyjOcE6eU5r98zcG7WH/s+doYQ1bFIjk+dKfqthgZ2o0NRAv8D3esq9rWrZTj12q+m1w==" + }, + "SkiaSharp.NativeAssets.Win32": { + "type": "Transitive", + "resolved": "2.88.0-preview.178", + "contentHash": "9og9GCkdZc/NYrmbsRzohmIBRlS1oFegJiBMsoG93qYjhh2o6q5QBYxd61zw5Mgeytl3qj4YM+6BNIF4tcF+6w==" + }, "SkiaSharp.Views.Desktop.Common": { "type": "Transitive", "resolved": "2.80.3", @@ -1479,7 +1491,7 @@ "Serilog.Sinks.Console": "4.0.0", "Serilog.Sinks.Debug": "2.0.0", "Serilog.Sinks.File": "5.0.0", - "SkiaSharp": "2.80.3", + "SkiaSharp": "2.88.0-preview.178", "System.Buffers": "4.5.1", "System.IO.FileSystem.AccessControl": "5.0.0", "System.Numerics.Vectors": "4.5.0", @@ -1506,7 +1518,7 @@ "Ninject.Extensions.Conventions": "3.3.0", "RGB.NET.Core": "1.0.0-prerelease7", "SharpVectors.Reloaded": "1.7.5", - "SkiaSharp": "2.80.3", + "SkiaSharp": "2.88.0-preview.178", "SkiaSharp.Views.WPF": "2.80.3", "Stylet": "1.3.6", "System.Buffers": "4.5.1", @@ -1522,7 +1534,7 @@ "MaterialDesignThemes": "4.1.0", "Ninject": "3.3.4", "NoStringEvaluating": "2.2.2", - "SkiaSharp": "2.80.3", + "SkiaSharp": "2.88.0-preview.178", "Stylet": "1.3.6" } } diff --git a/src/Artemis.VisualScripting/Artemis.VisualScripting.csproj b/src/Artemis.VisualScripting/Artemis.VisualScripting.csproj index 47a179dcc..8d4ac1b0a 100644 --- a/src/Artemis.VisualScripting/Artemis.VisualScripting.csproj +++ b/src/Artemis.VisualScripting/Artemis.VisualScripting.csproj @@ -48,7 +48,7 @@ - + diff --git a/src/Artemis.VisualScripting/packages.lock.json b/src/Artemis.VisualScripting/packages.lock.json index a0c2a9431..b70d8a466 100644 --- a/src/Artemis.VisualScripting/packages.lock.json +++ b/src/Artemis.VisualScripting/packages.lock.json @@ -38,10 +38,12 @@ }, "SkiaSharp": { "type": "Direct", - "requested": "[2.80.3, )", - "resolved": "2.80.3", - "contentHash": "qX6tGNP3+MXNYe2pKm0PCRiJ/cx+LTeLaggwZifB7sUMXhECfKKKHJq45VqZKt37xQegnCCdf1jHXwmHeJQs5Q==", + "requested": "[2.88.0-preview.178, )", + "resolved": "2.88.0-preview.178", + "contentHash": "arzd/44ykiBPqGWUuQqNTuJ49rhsXOg4Zw1p2Mm3B/5PZzV1wcTH4V+J+4ra8RS0KbIoy4KWeNF+zHAifNsiRg==", "dependencies": { + "SkiaSharp.NativeAssets.Win32": "2.88.0-preview.178", + "SkiaSharp.NativeAssets.macOS": "2.88.0-preview.178", "System.Memory": "4.5.3" } }, @@ -248,23 +250,23 @@ }, "RGB.NET.Core": { "type": "Transitive", - "resolved": "1.0.0-prerelease1", - "contentHash": "aaCPk++kr1TaV/qWYeol5975IN3XifDuuQ9wrCD+nw1cy05BMdGVhuQ72ITb0YRBedssd/btkM51ZABsBd8CEQ==" + "resolved": "1.0.0-prerelease7", + "contentHash": "IIja5sC4QZ5pbSNckRCG7TlY4U6j/dRbrl4e2FZqsTGgsevaVB3IqonUQLFY1GGst4xNSl2oh0A23coXQxXGbQ==" }, "RGB.NET.Layout": { "type": "Transitive", - "resolved": "1.0.0-prerelease1", - "contentHash": "nbaHbcY59tzFSeTDbImhrcR1ZyJpoC0x6WawXdtGXO7x3F91ajM7kM5SJwi/5jHdD61vGV0ARuznmR8ErAWegQ==", + "resolved": "1.0.0-prerelease7", + "contentHash": "S0kfWVa8EfMOAl2WPHsq98dwaO+SNz9TWr1AtMkdo8aZuYIVhaJ1c+mSAMMnH1V+mSbxDWPHWkNzi9ITszJucA==", "dependencies": { - "RGB.NET.Core": "1.0.0-prerelease1" + "RGB.NET.Core": "1.0.0-prerelease7" } }, "RGB.NET.Presets": { "type": "Transitive", - "resolved": "1.0.0-prerelease1", - "contentHash": "XU8XeI0fQF26fd0pQHgoe9RaROuvENmZlX/1QyyaN9P3j0LtYmy6ycWZbsXp8byLT0UcGbS+odMiQQAnK+kxgg==", + "resolved": "1.0.0-prerelease7", + "contentHash": "NgShvOPQM0miOsdqMKjkNunngJUZMwr8KR8ME2/Ksir7wgIQfgJj1YwZy8aIj+ar7fDo6VZJZenAshs/Ul+04A==", "dependencies": { - "RGB.NET.Core": "1.0.0-prerelease1" + "RGB.NET.Core": "1.0.0-prerelease7" } }, "runtime.debian.8-x64.runtime.native.System.Security.Cryptography.OpenSsl": { @@ -408,6 +410,16 @@ "resolved": "1.7.5", "contentHash": "v9U5sSMGFE2zCMbh42BYHkaRYkmwwhsKMGcNRdHAKqD1ryOf4mhqnJR0o07hwg5KIEmCI9bDdrgYSmiZWlL+eA==" }, + "SkiaSharp.NativeAssets.macOS": { + "type": "Transitive", + "resolved": "2.88.0-preview.178", + "contentHash": "+Hs3ku4buimzBHuc8FoyjOcE6eU5r98zcG7WH/s+doYQ1bFIjk+dKfqthgZ2o0NRAv8D3esq9rWrZTj12q+m1w==" + }, + "SkiaSharp.NativeAssets.Win32": { + "type": "Transitive", + "resolved": "2.88.0-preview.178", + "contentHash": "9og9GCkdZc/NYrmbsRzohmIBRlS1oFegJiBMsoG93qYjhh2o6q5QBYxd61zw5Mgeytl3qj4YM+6BNIF4tcF+6w==" + }, "SkiaSharp.Views.Desktop.Common": { "type": "Transitive", "resolved": "2.80.3", @@ -1330,14 +1342,14 @@ "Ninject": "3.3.4", "Ninject.Extensions.ChildKernel": "3.3.0", "Ninject.Extensions.Conventions": "3.3.0", - "RGB.NET.Core": "1.0.0-prerelease1", - "RGB.NET.Layout": "1.0.0-prerelease1", - "RGB.NET.Presets": "1.0.0-prerelease1", + "RGB.NET.Core": "1.0.0-prerelease7", + "RGB.NET.Layout": "1.0.0-prerelease7", + "RGB.NET.Presets": "1.0.0-prerelease7", "Serilog": "2.10.0", "Serilog.Sinks.Console": "4.0.0", "Serilog.Sinks.Debug": "2.0.0", "Serilog.Sinks.File": "5.0.0", - "SkiaSharp": "2.80.3", + "SkiaSharp": "2.88.0-preview.178", "System.Buffers": "4.5.1", "System.IO.FileSystem.AccessControl": "5.0.0", "System.Numerics.Vectors": "4.5.0", @@ -1362,9 +1374,9 @@ "Microsoft.Xaml.Behaviors.Wpf": "1.1.31", "Ninject": "3.3.4", "Ninject.Extensions.Conventions": "3.3.0", - "RGB.NET.Core": "1.0.0-prerelease1", + "RGB.NET.Core": "1.0.0-prerelease7", "SharpVectors.Reloaded": "1.7.5", - "SkiaSharp": "2.80.3", + "SkiaSharp": "2.88.0-preview.178", "SkiaSharp.Views.WPF": "2.80.3", "Stylet": "1.3.6", "System.Buffers": "4.5.1", diff --git a/src/Avalonia/Artemis.UI.Linux/packages.lock.json b/src/Avalonia/Artemis.UI.Linux/packages.lock.json index 29e42c221..7ff439353 100644 --- a/src/Avalonia/Artemis.UI.Linux/packages.lock.json +++ b/src/Avalonia/Artemis.UI.Linux/packages.lock.json @@ -542,23 +542,23 @@ }, "RGB.NET.Core": { "type": "Transitive", - "resolved": "1.0.0-prerelease1", - "contentHash": "aaCPk++kr1TaV/qWYeol5975IN3XifDuuQ9wrCD+nw1cy05BMdGVhuQ72ITb0YRBedssd/btkM51ZABsBd8CEQ==" + "resolved": "1.0.0-prerelease7", + "contentHash": "IIja5sC4QZ5pbSNckRCG7TlY4U6j/dRbrl4e2FZqsTGgsevaVB3IqonUQLFY1GGst4xNSl2oh0A23coXQxXGbQ==" }, "RGB.NET.Layout": { "type": "Transitive", - "resolved": "1.0.0-prerelease1", - "contentHash": "nbaHbcY59tzFSeTDbImhrcR1ZyJpoC0x6WawXdtGXO7x3F91ajM7kM5SJwi/5jHdD61vGV0ARuznmR8ErAWegQ==", + "resolved": "1.0.0-prerelease7", + "contentHash": "S0kfWVa8EfMOAl2WPHsq98dwaO+SNz9TWr1AtMkdo8aZuYIVhaJ1c+mSAMMnH1V+mSbxDWPHWkNzi9ITszJucA==", "dependencies": { - "RGB.NET.Core": "1.0.0-prerelease1" + "RGB.NET.Core": "1.0.0-prerelease7" } }, "RGB.NET.Presets": { "type": "Transitive", - "resolved": "1.0.0-prerelease1", - "contentHash": "XU8XeI0fQF26fd0pQHgoe9RaROuvENmZlX/1QyyaN9P3j0LtYmy6ycWZbsXp8byLT0UcGbS+odMiQQAnK+kxgg==", + "resolved": "1.0.0-prerelease7", + "contentHash": "NgShvOPQM0miOsdqMKjkNunngJUZMwr8KR8ME2/Ksir7wgIQfgJj1YwZy8aIj+ar7fDo6VZJZenAshs/Ul+04A==", "dependencies": { - "RGB.NET.Core": "1.0.0-prerelease1" + "RGB.NET.Core": "1.0.0-prerelease7" } }, "runtime.debian.8-x64.runtime.native.System.Security.Cryptography.OpenSsl": { @@ -1719,14 +1719,14 @@ "Ninject": "3.3.4", "Ninject.Extensions.ChildKernel": "3.3.0", "Ninject.Extensions.Conventions": "3.3.0", - "RGB.NET.Core": "1.0.0-prerelease1", - "RGB.NET.Layout": "1.0.0-prerelease1", - "RGB.NET.Presets": "1.0.0-prerelease1", + "RGB.NET.Core": "1.0.0-prerelease7", + "RGB.NET.Layout": "1.0.0-prerelease7", + "RGB.NET.Presets": "1.0.0-prerelease7", "Serilog": "2.10.0", "Serilog.Sinks.Console": "4.0.0", "Serilog.Sinks.Debug": "2.0.0", "Serilog.Sinks.File": "5.0.0", - "SkiaSharp": "2.80.3", + "SkiaSharp": "2.88.0-preview.178", "System.Buffers": "4.5.1", "System.IO.FileSystem.AccessControl": "5.0.0", "System.Numerics.Vectors": "4.5.0", @@ -1756,10 +1756,11 @@ "Flurl.Http": "3.2.0", "Live.Avalonia": "1.3.1", "Material.Icons.Avalonia": "1.0.2", - "RGB.NET.Core": "1.0.0-prerelease1", - "RGB.NET.Layout": "1.0.0-prerelease1", + "RGB.NET.Core": "1.0.0-prerelease7", + "RGB.NET.Layout": "1.0.0-prerelease7", "ReactiveUI": "16.3.10", "ReactiveUI.Validation": "2.2.1", + "SkiaSharp": "2.88.0-preview.178", "Splat.Ninject": "14.1.17" } }, @@ -1775,9 +1776,10 @@ "Avalonia.Xaml.Interactivity": "0.10.11.5", "FluentAvaloniaUI": "1.1.8", "Material.Icons.Avalonia": "1.0.2", - "RGB.NET.Core": "1.0.0-prerelease1", + "RGB.NET.Core": "1.0.0-prerelease7", "ReactiveUI": "16.3.10", - "ReactiveUI.Validation": "2.2.1" + "ReactiveUI.Validation": "2.2.1", + "SkiaSharp": "2.88.0-preview.178" } } } diff --git a/src/Avalonia/Artemis.UI.MacOS/packages.lock.json b/src/Avalonia/Artemis.UI.MacOS/packages.lock.json index 29e42c221..7ff439353 100644 --- a/src/Avalonia/Artemis.UI.MacOS/packages.lock.json +++ b/src/Avalonia/Artemis.UI.MacOS/packages.lock.json @@ -542,23 +542,23 @@ }, "RGB.NET.Core": { "type": "Transitive", - "resolved": "1.0.0-prerelease1", - "contentHash": "aaCPk++kr1TaV/qWYeol5975IN3XifDuuQ9wrCD+nw1cy05BMdGVhuQ72ITb0YRBedssd/btkM51ZABsBd8CEQ==" + "resolved": "1.0.0-prerelease7", + "contentHash": "IIja5sC4QZ5pbSNckRCG7TlY4U6j/dRbrl4e2FZqsTGgsevaVB3IqonUQLFY1GGst4xNSl2oh0A23coXQxXGbQ==" }, "RGB.NET.Layout": { "type": "Transitive", - "resolved": "1.0.0-prerelease1", - "contentHash": "nbaHbcY59tzFSeTDbImhrcR1ZyJpoC0x6WawXdtGXO7x3F91ajM7kM5SJwi/5jHdD61vGV0ARuznmR8ErAWegQ==", + "resolved": "1.0.0-prerelease7", + "contentHash": "S0kfWVa8EfMOAl2WPHsq98dwaO+SNz9TWr1AtMkdo8aZuYIVhaJ1c+mSAMMnH1V+mSbxDWPHWkNzi9ITszJucA==", "dependencies": { - "RGB.NET.Core": "1.0.0-prerelease1" + "RGB.NET.Core": "1.0.0-prerelease7" } }, "RGB.NET.Presets": { "type": "Transitive", - "resolved": "1.0.0-prerelease1", - "contentHash": "XU8XeI0fQF26fd0pQHgoe9RaROuvENmZlX/1QyyaN9P3j0LtYmy6ycWZbsXp8byLT0UcGbS+odMiQQAnK+kxgg==", + "resolved": "1.0.0-prerelease7", + "contentHash": "NgShvOPQM0miOsdqMKjkNunngJUZMwr8KR8ME2/Ksir7wgIQfgJj1YwZy8aIj+ar7fDo6VZJZenAshs/Ul+04A==", "dependencies": { - "RGB.NET.Core": "1.0.0-prerelease1" + "RGB.NET.Core": "1.0.0-prerelease7" } }, "runtime.debian.8-x64.runtime.native.System.Security.Cryptography.OpenSsl": { @@ -1719,14 +1719,14 @@ "Ninject": "3.3.4", "Ninject.Extensions.ChildKernel": "3.3.0", "Ninject.Extensions.Conventions": "3.3.0", - "RGB.NET.Core": "1.0.0-prerelease1", - "RGB.NET.Layout": "1.0.0-prerelease1", - "RGB.NET.Presets": "1.0.0-prerelease1", + "RGB.NET.Core": "1.0.0-prerelease7", + "RGB.NET.Layout": "1.0.0-prerelease7", + "RGB.NET.Presets": "1.0.0-prerelease7", "Serilog": "2.10.0", "Serilog.Sinks.Console": "4.0.0", "Serilog.Sinks.Debug": "2.0.0", "Serilog.Sinks.File": "5.0.0", - "SkiaSharp": "2.80.3", + "SkiaSharp": "2.88.0-preview.178", "System.Buffers": "4.5.1", "System.IO.FileSystem.AccessControl": "5.0.0", "System.Numerics.Vectors": "4.5.0", @@ -1756,10 +1756,11 @@ "Flurl.Http": "3.2.0", "Live.Avalonia": "1.3.1", "Material.Icons.Avalonia": "1.0.2", - "RGB.NET.Core": "1.0.0-prerelease1", - "RGB.NET.Layout": "1.0.0-prerelease1", + "RGB.NET.Core": "1.0.0-prerelease7", + "RGB.NET.Layout": "1.0.0-prerelease7", "ReactiveUI": "16.3.10", "ReactiveUI.Validation": "2.2.1", + "SkiaSharp": "2.88.0-preview.178", "Splat.Ninject": "14.1.17" } }, @@ -1775,9 +1776,10 @@ "Avalonia.Xaml.Interactivity": "0.10.11.5", "FluentAvaloniaUI": "1.1.8", "Material.Icons.Avalonia": "1.0.2", - "RGB.NET.Core": "1.0.0-prerelease1", + "RGB.NET.Core": "1.0.0-prerelease7", "ReactiveUI": "16.3.10", - "ReactiveUI.Validation": "2.2.1" + "ReactiveUI.Validation": "2.2.1", + "SkiaSharp": "2.88.0-preview.178" } } } diff --git a/src/Avalonia/Artemis.UI.Shared/Artemis.UI.Shared.csproj b/src/Avalonia/Artemis.UI.Shared/Artemis.UI.Shared.csproj index c6c81a462..42c40c799 100644 --- a/src/Avalonia/Artemis.UI.Shared/Artemis.UI.Shared.csproj +++ b/src/Avalonia/Artemis.UI.Shared/Artemis.UI.Shared.csproj @@ -27,7 +27,8 @@ - + + diff --git a/src/Avalonia/Artemis.UI.Shared/Controls/SelectionRectangle.cs b/src/Avalonia/Artemis.UI.Shared/Controls/SelectionRectangle.cs index 72ec5f1f0..37ee08bde 100644 --- a/src/Avalonia/Artemis.UI.Shared/Controls/SelectionRectangle.cs +++ b/src/Avalonia/Artemis.UI.Shared/Controls/SelectionRectangle.cs @@ -1,11 +1,10 @@ using System; -using System.Windows.Input; using Artemis.Core; +using Artemis.UI.Shared.Events; using Avalonia; using Avalonia.Controls; using Avalonia.Input; using Avalonia.Media; -using FluentAvalonia.Styling; namespace Artemis.UI.Shared.Controls { @@ -18,15 +17,13 @@ namespace Artemis.UI.Shared.Controls /// Defines the property. /// public static readonly StyledProperty BackgroundProperty = - AvaloniaProperty.Register(nameof(Background), - new SolidColorBrush(AvaloniaLocator.Current.GetService()?.CustomAccentColor ?? Colors.Transparent, 0.25)); + AvaloniaProperty.Register(nameof(Background), new SolidColorBrush(Colors.CadetBlue, 0.25)); /// /// Defines the property. /// public static readonly StyledProperty BorderBrushProperty = - AvaloniaProperty.Register(nameof(BorderBrush), - new SolidColorBrush(AvaloniaLocator.Current.GetService()?.CustomAccentColor ?? Colors.Transparent)); + AvaloniaProperty.Register(nameof(BorderBrush), new SolidColorBrush(Colors.CadetBlue)); /// /// Defines the property. @@ -40,18 +37,6 @@ namespace Artemis.UI.Shared.Controls public static readonly StyledProperty InputElementProperty = AvaloniaProperty.Register(nameof(InputElement), notifying: OnInputElementChanged); - /// - /// Defines the property. - /// - public static readonly StyledProperty SelectionUpdatedProperty - = AvaloniaProperty.Register(nameof(SelectionUpdated)); - - /// - /// Defines the property. - /// - public static readonly StyledProperty SelectionFinishedProperty - = AvaloniaProperty.Register(nameof(SelectionUpdated)); - private Rect? _displayRect; private IControl? _oldInputElement; private Point _startPosition; @@ -91,7 +76,7 @@ namespace Artemis.UI.Shared.Controls } /// - /// Gets or sets the element that captures input for the selection rectangle. + /// Gets or sets the element that captures input for the selection rectangle. /// public IControl? InputElement { @@ -100,21 +85,31 @@ namespace Artemis.UI.Shared.Controls } /// - /// Gets or sets the command to execute when the selection has been updated. + /// Occurs when the selection rect is being updated, indicating the user is dragging. /// - public ICommand? SelectionUpdated + public event EventHandler? SelectionUpdated; + + /// + /// Occurs when the selection has finished, indicating the user stopped dragging. + /// + public event EventHandler? SelectionFinished; + + /// + /// Invokes the event + /// + /// + protected virtual void OnSelectionUpdated(SelectionRectangleEventArgs e) { - get => GetValue(SelectionUpdatedProperty); - set => SetValue(SelectionUpdatedProperty, value); + SelectionUpdated?.Invoke(this, e); } /// - /// Gets or sets the command to execute when the selection has finished. + /// Invokes the event /// - public ICommand? SelectionFinished + /// + protected virtual void OnSelectionFinished(SelectionRectangleEventArgs e) { - get => GetValue(SelectionFinishedProperty); - set => SetValue(SelectionFinishedProperty, value); + SelectionFinished?.Invoke(this, e); } private static void OnInputElementChanged(IAvaloniaObject sender, bool before) @@ -143,8 +138,7 @@ namespace Artemis.UI.Shared.Controls new Point(Math.Min(_startPosition.X, currentPosition.X), Math.Min(_startPosition.Y, currentPosition.Y)), new Point(Math.Max(_startPosition.X, currentPosition.X), Math.Max(_startPosition.Y, currentPosition.Y)) ); - SelectionUpdated?.Execute(_displayRect.Value); - + OnSelectionUpdated(new SelectionRectangleEventArgs(_displayRect.Value, e.KeyModifiers)); InvalidateVisual(); } @@ -156,7 +150,7 @@ namespace Artemis.UI.Shared.Controls e.Pointer.Capture(null); if (_displayRect != null) - SelectionFinished?.Execute(_displayRect.Value); + OnSelectionFinished(new SelectionRectangleEventArgs(_displayRect.Value, e.KeyModifiers)); _displayRect = null; InvalidateVisual(); @@ -187,7 +181,7 @@ namespace Artemis.UI.Shared.Controls public override void Render(DrawingContext drawingContext) { if (_displayRect != null) - drawingContext.DrawRectangle(Background, new Pen(BorderBrush, BorderThickness), _displayRect.Value); + drawingContext.DrawRectangle(Background, new Pen(BorderBrush, BorderThickness), _displayRect.Value, 4, 4); } /// diff --git a/src/Avalonia/Artemis.UI.Shared/Events/SelectionRectangleEventArgs.cs b/src/Avalonia/Artemis.UI.Shared/Events/SelectionRectangleEventArgs.cs new file mode 100644 index 000000000..67b33b39a --- /dev/null +++ b/src/Avalonia/Artemis.UI.Shared/Events/SelectionRectangleEventArgs.cs @@ -0,0 +1,32 @@ +using System; +using Artemis.UI.Shared.Controls; +using Avalonia; +using Avalonia.Input; + +namespace Artemis.UI.Shared.Events +{ + /// + /// Provides data on selection events raised by the . + /// + public class SelectionRectangleEventArgs : EventArgs + { + /// + /// Creates a new instance of the class. + /// + public SelectionRectangleEventArgs(Rect rectangle, KeyModifiers keyModifiers) + { + KeyModifiers = keyModifiers; + Rectangle = rectangle; + } + + /// + /// Gets the rectangle that was selected when the event occurred. + /// + public Rect Rectangle { get; } + + /// + /// Gets the key modifiers that where pressed when the event occurred. + /// + public KeyModifiers KeyModifiers { get; } + } +} \ No newline at end of file diff --git a/src/Avalonia/Artemis.UI.Shared/packages.lock.json b/src/Avalonia/Artemis.UI.Shared/packages.lock.json index 754b4bc3c..6deb8e4f5 100644 --- a/src/Avalonia/Artemis.UI.Shared/packages.lock.json +++ b/src/Avalonia/Artemis.UI.Shared/packages.lock.json @@ -112,9 +112,20 @@ }, "RGB.NET.Core": { "type": "Direct", - "requested": "[1.0.0-prerelease1, )", - "resolved": "1.0.0-prerelease1", - "contentHash": "aaCPk++kr1TaV/qWYeol5975IN3XifDuuQ9wrCD+nw1cy05BMdGVhuQ72ITb0YRBedssd/btkM51ZABsBd8CEQ==" + "requested": "[1.0.0-prerelease7, )", + "resolved": "1.0.0-prerelease7", + "contentHash": "IIja5sC4QZ5pbSNckRCG7TlY4U6j/dRbrl4e2FZqsTGgsevaVB3IqonUQLFY1GGst4xNSl2oh0A23coXQxXGbQ==" + }, + "SkiaSharp": { + "type": "Direct", + "requested": "[2.88.0-preview.178, )", + "resolved": "2.88.0-preview.178", + "contentHash": "arzd/44ykiBPqGWUuQqNTuJ49rhsXOg4Zw1p2Mm3B/5PZzV1wcTH4V+J+4ra8RS0KbIoy4KWeNF+zHAifNsiRg==", + "dependencies": { + "SkiaSharp.NativeAssets.Win32": "2.88.0-preview.178", + "SkiaSharp.NativeAssets.macOS": "2.88.0-preview.178", + "System.Memory": "4.5.3" + } }, "Avalonia.Angle.Windows.Natives": { "type": "Transitive", @@ -522,18 +533,18 @@ }, "RGB.NET.Layout": { "type": "Transitive", - "resolved": "1.0.0-prerelease1", - "contentHash": "nbaHbcY59tzFSeTDbImhrcR1ZyJpoC0x6WawXdtGXO7x3F91ajM7kM5SJwi/5jHdD61vGV0ARuznmR8ErAWegQ==", + "resolved": "1.0.0-prerelease7", + "contentHash": "S0kfWVa8EfMOAl2WPHsq98dwaO+SNz9TWr1AtMkdo8aZuYIVhaJ1c+mSAMMnH1V+mSbxDWPHWkNzi9ITszJucA==", "dependencies": { - "RGB.NET.Core": "1.0.0-prerelease1" + "RGB.NET.Core": "1.0.0-prerelease7" } }, "RGB.NET.Presets": { "type": "Transitive", - "resolved": "1.0.0-prerelease1", - "contentHash": "XU8XeI0fQF26fd0pQHgoe9RaROuvENmZlX/1QyyaN9P3j0LtYmy6ycWZbsXp8byLT0UcGbS+odMiQQAnK+kxgg==", + "resolved": "1.0.0-prerelease7", + "contentHash": "NgShvOPQM0miOsdqMKjkNunngJUZMwr8KR8ME2/Ksir7wgIQfgJj1YwZy8aIj+ar7fDo6VZJZenAshs/Ul+04A==", "dependencies": { - "RGB.NET.Core": "1.0.0-prerelease1" + "RGB.NET.Core": "1.0.0-prerelease7" } }, "runtime.debian.8-x64.runtime.native.System.Security.Cryptography.OpenSsl": { @@ -677,16 +688,6 @@ "resolved": "0.5.11", "contentHash": "a04YHHKRK1xY8ccSgpa6HOmOw9Kuivo2b2qejp9CK00ykdCBK3Mmc+ekBx954+zPQBksN6aLhvn1SEL7QG2s8Q==" }, - "SkiaSharp": { - "type": "Transitive", - "resolved": "2.88.0-preview.178", - "contentHash": "arzd/44ykiBPqGWUuQqNTuJ49rhsXOg4Zw1p2Mm3B/5PZzV1wcTH4V+J+4ra8RS0KbIoy4KWeNF+zHAifNsiRg==", - "dependencies": { - "SkiaSharp.NativeAssets.Win32": "2.88.0-preview.178", - "SkiaSharp.NativeAssets.macOS": "2.88.0-preview.178", - "System.Memory": "4.5.3" - } - }, "SkiaSharp.HarfBuzz": { "type": "Transitive", "resolved": "2.88.0-preview.178", @@ -1685,14 +1686,14 @@ "Ninject": "3.3.4", "Ninject.Extensions.ChildKernel": "3.3.0", "Ninject.Extensions.Conventions": "3.3.0", - "RGB.NET.Core": "1.0.0-prerelease1", - "RGB.NET.Layout": "1.0.0-prerelease1", - "RGB.NET.Presets": "1.0.0-prerelease1", + "RGB.NET.Core": "1.0.0-prerelease7", + "RGB.NET.Layout": "1.0.0-prerelease7", + "RGB.NET.Presets": "1.0.0-prerelease7", "Serilog": "2.10.0", "Serilog.Sinks.Console": "4.0.0", "Serilog.Sinks.Debug": "2.0.0", "Serilog.Sinks.File": "5.0.0", - "SkiaSharp": "2.80.3", + "SkiaSharp": "2.88.0-preview.178", "System.Buffers": "4.5.1", "System.IO.FileSystem.AccessControl": "5.0.0", "System.Numerics.Vectors": "4.5.0", diff --git a/src/Avalonia/Artemis.UI.Windows/packages.lock.json b/src/Avalonia/Artemis.UI.Windows/packages.lock.json index b8ac67813..63ff119eb 100644 --- a/src/Avalonia/Artemis.UI.Windows/packages.lock.json +++ b/src/Avalonia/Artemis.UI.Windows/packages.lock.json @@ -558,23 +558,23 @@ }, "RGB.NET.Core": { "type": "Transitive", - "resolved": "1.0.0-prerelease1", - "contentHash": "aaCPk++kr1TaV/qWYeol5975IN3XifDuuQ9wrCD+nw1cy05BMdGVhuQ72ITb0YRBedssd/btkM51ZABsBd8CEQ==" + "resolved": "1.0.0-prerelease7", + "contentHash": "IIja5sC4QZ5pbSNckRCG7TlY4U6j/dRbrl4e2FZqsTGgsevaVB3IqonUQLFY1GGst4xNSl2oh0A23coXQxXGbQ==" }, "RGB.NET.Layout": { "type": "Transitive", - "resolved": "1.0.0-prerelease1", - "contentHash": "nbaHbcY59tzFSeTDbImhrcR1ZyJpoC0x6WawXdtGXO7x3F91ajM7kM5SJwi/5jHdD61vGV0ARuznmR8ErAWegQ==", + "resolved": "1.0.0-prerelease7", + "contentHash": "S0kfWVa8EfMOAl2WPHsq98dwaO+SNz9TWr1AtMkdo8aZuYIVhaJ1c+mSAMMnH1V+mSbxDWPHWkNzi9ITszJucA==", "dependencies": { - "RGB.NET.Core": "1.0.0-prerelease1" + "RGB.NET.Core": "1.0.0-prerelease7" } }, "RGB.NET.Presets": { "type": "Transitive", - "resolved": "1.0.0-prerelease1", - "contentHash": "XU8XeI0fQF26fd0pQHgoe9RaROuvENmZlX/1QyyaN9P3j0LtYmy6ycWZbsXp8byLT0UcGbS+odMiQQAnK+kxgg==", + "resolved": "1.0.0-prerelease7", + "contentHash": "NgShvOPQM0miOsdqMKjkNunngJUZMwr8KR8ME2/Ksir7wgIQfgJj1YwZy8aIj+ar7fDo6VZJZenAshs/Ul+04A==", "dependencies": { - "RGB.NET.Core": "1.0.0-prerelease1" + "RGB.NET.Core": "1.0.0-prerelease7" } }, "runtime.debian.8-x64.runtime.native.System.Security.Cryptography.OpenSsl": { @@ -1735,14 +1735,14 @@ "Ninject": "3.3.4", "Ninject.Extensions.ChildKernel": "3.3.0", "Ninject.Extensions.Conventions": "3.3.0", - "RGB.NET.Core": "1.0.0-prerelease1", - "RGB.NET.Layout": "1.0.0-prerelease1", - "RGB.NET.Presets": "1.0.0-prerelease1", + "RGB.NET.Core": "1.0.0-prerelease7", + "RGB.NET.Layout": "1.0.0-prerelease7", + "RGB.NET.Presets": "1.0.0-prerelease7", "Serilog": "2.10.0", "Serilog.Sinks.Console": "4.0.0", "Serilog.Sinks.Debug": "2.0.0", "Serilog.Sinks.File": "5.0.0", - "SkiaSharp": "2.80.3", + "SkiaSharp": "2.88.0-preview.178", "System.Buffers": "4.5.1", "System.IO.FileSystem.AccessControl": "5.0.0", "System.Numerics.Vectors": "4.5.0", @@ -1772,10 +1772,11 @@ "Flurl.Http": "3.2.0", "Live.Avalonia": "1.3.1", "Material.Icons.Avalonia": "1.0.2", - "RGB.NET.Core": "1.0.0-prerelease1", - "RGB.NET.Layout": "1.0.0-prerelease1", + "RGB.NET.Core": "1.0.0-prerelease7", + "RGB.NET.Layout": "1.0.0-prerelease7", "ReactiveUI": "16.3.10", "ReactiveUI.Validation": "2.2.1", + "SkiaSharp": "2.88.0-preview.178", "Splat.Ninject": "14.1.17" } }, @@ -1791,9 +1792,10 @@ "Avalonia.Xaml.Interactivity": "0.10.11.5", "FluentAvaloniaUI": "1.1.8", "Material.Icons.Avalonia": "1.0.2", - "RGB.NET.Core": "1.0.0-prerelease1", + "RGB.NET.Core": "1.0.0-prerelease7", "ReactiveUI": "16.3.10", - "ReactiveUI.Validation": "2.2.1" + "ReactiveUI.Validation": "2.2.1", + "SkiaSharp": "2.88.0-preview.178" } } } diff --git a/src/Avalonia/Artemis.UI/Artemis.UI.csproj b/src/Avalonia/Artemis.UI/Artemis.UI.csproj index b3f745f09..def881af2 100644 --- a/src/Avalonia/Artemis.UI/Artemis.UI.csproj +++ b/src/Avalonia/Artemis.UI/Artemis.UI.csproj @@ -26,8 +26,9 @@ - - + + + diff --git a/src/Avalonia/Artemis.UI/Screens/SurfaceEditor/SurfaceDeviceView.axaml.cs b/src/Avalonia/Artemis.UI/Screens/SurfaceEditor/SurfaceDeviceView.axaml.cs index 31652dc1c..27674f033 100644 --- a/src/Avalonia/Artemis.UI/Screens/SurfaceEditor/SurfaceDeviceView.axaml.cs +++ b/src/Avalonia/Artemis.UI/Screens/SurfaceEditor/SurfaceDeviceView.axaml.cs @@ -11,13 +11,6 @@ namespace Artemis.UI.Screens.SurfaceEditor InitializeComponent(); } - private void InitializeComponent() - { - AvaloniaXamlLoader.Load(this); - } - - #region Overrides of InputElement - /// protected override void OnPointerEnter(PointerEventArgs e) { @@ -42,15 +35,9 @@ namespace Artemis.UI.Screens.SurfaceEditor base.OnPointerLeave(e); } - /// - protected override void OnPointerPressed(PointerPressedEventArgs e) + private void InitializeComponent() { - if (e.GetCurrentPoint(this).Properties.IsLeftButtonPressed && ViewModel != null) - ViewModel.SelectionStatus = SelectionStatus.Selected; - - base.OnPointerPressed(e); + AvaloniaXamlLoader.Load(this); } - - #endregion } } \ No newline at end of file diff --git a/src/Avalonia/Artemis.UI/Screens/SurfaceEditor/SurfaceDeviceViewModel.cs b/src/Avalonia/Artemis.UI/Screens/SurfaceEditor/SurfaceDeviceViewModel.cs index 2e45e3e97..7800ebf5c 100644 --- a/src/Avalonia/Artemis.UI/Screens/SurfaceEditor/SurfaceDeviceViewModel.cs +++ b/src/Avalonia/Artemis.UI/Screens/SurfaceEditor/SurfaceDeviceViewModel.cs @@ -99,7 +99,7 @@ namespace Artemis.UI.Screens.SurfaceEditor Device.Y = roundedY; } } - + private void ExecuteIdentifyDevice(ArtemisDevice device) { _deviceService.IdentifyDevice(device); diff --git a/src/Avalonia/Artemis.UI/Screens/SurfaceEditor/SurfaceEditorView.axaml b/src/Avalonia/Artemis.UI/Screens/SurfaceEditor/SurfaceEditorView.axaml index b22986738..a9535db87 100644 --- a/src/Avalonia/Artemis.UI/Screens/SurfaceEditor/SurfaceEditorView.axaml +++ b/src/Avalonia/Artemis.UI/Screens/SurfaceEditor/SurfaceEditorView.axaml @@ -88,7 +88,12 @@ + SelectionUpdated="SelectionRectangle_OnSelectionUpdated" + BorderBrush="{DynamicResource SystemAccentColor}"> + + + + (rgbService.Devices.Select(surfaceVmFactory.SurfaceDeviceViewModel)); - ListDeviceViewModels = new ObservableCollection(rgbService.Devices.Select(surfaceVmFactory.ListDeviceViewModel)); + SurfaceDeviceViewModels = new ObservableCollection(rgbService.Devices.OrderBy(d => d.ZIndex).Select(surfaceVmFactory.SurfaceDeviceViewModel)); + ListDeviceViewModels = new ObservableCollection(rgbService.Devices.OrderBy(d => d.ZIndex).Select(surfaceVmFactory.ListDeviceViewModel)); BringToFront = ReactiveCommand.Create(ExecuteBringToFront); BringForward = ReactiveCommand.Create(ExecuteBringForward); SendToBack = ReactiveCommand.Create(ExecuteSendToBack); SendBackward = ReactiveCommand.Create(ExecuteSendBackward); - - UpdateSelection = ReactiveCommand.Create(ExecuteUpdateSelection); } public ObservableCollection SurfaceDeviceViewModels { get; } @@ -50,8 +45,6 @@ namespace Artemis.UI.Screens.SurfaceEditor public ReactiveCommand SendToBack { get; } public ReactiveCommand SendBackward { get; } - public ReactiveCommand UpdateSelection { get; } - public double MaxTextureSize => 4096 / _settingsService.GetSetting("Core.RenderScale", 0.25).Value; public void ClearSelection() @@ -62,6 +55,15 @@ namespace Artemis.UI.Screens.SurfaceEditor public void StartMouseDrag(Point mousePosition) { + SurfaceDeviceViewModel? startedOn = GetViewModelAtPoint(mousePosition); + if (startedOn != null && startedOn.SelectionStatus != SelectionStatus.Selected) + { + startedOn.SelectionStatus = SelectionStatus.Selected; + foreach (SurfaceDeviceViewModel device in SurfaceDeviceViewModels.Where(vm => vm != startedOn)) + device.SelectionStatus = SelectionStatus.None; + + } + foreach (SurfaceDeviceViewModel surfaceDeviceViewModel in SurfaceDeviceViewModels) surfaceDeviceViewModel.StartMouseDrag(mousePosition); } @@ -80,7 +82,6 @@ namespace Artemis.UI.Screens.SurfaceEditor if (_saving) return; - // TODO: Figure out why the UI still locks up here Task.Run(() => { try @@ -95,14 +96,35 @@ namespace Artemis.UI.Screens.SurfaceEditor }); } - private void ExecuteUpdateSelection(Rect rect) + public void SelectFirstDeviceAtPoint(Point point, bool expand) + { + SurfaceDeviceViewModel? toSelect = GetViewModelAtPoint(point); + if (toSelect != null) + toSelect.SelectionStatus = SelectionStatus.Selected; + + if (!expand) + { + foreach (SurfaceDeviceViewModel device in SurfaceDeviceViewModels.Where(vm => vm != toSelect)) + device.SelectionStatus = SelectionStatus.None; + } + + ApplySurfaceSelection(); + } + + private SurfaceDeviceViewModel? GetViewModelAtPoint(Point point) + { + SKPoint hitTestPoint = point.ToSKPoint(); + return SurfaceDeviceViewModels.OrderByDescending(vm => vm.Device.ZIndex).FirstOrDefault(d => d.Device.Rectangle.Contains(hitTestPoint)); + } + + public void UpdateSelection(Rect rect, bool expand) { SKRect hitTestRect = rect.ToSKRect(); foreach (SurfaceDeviceViewModel device in SurfaceDeviceViewModels) { if (device.Device.Rectangle.IntersectsWith(hitTestRect)) device.SelectionStatus = SelectionStatus.Selected; - else if (!_inputService.IsKeyDown(KeyboardKey.LeftShift) && !_inputService.IsKeyDown(KeyboardKey.RightShift)) + else if (!expand) device.SelectionStatus = SelectionStatus.None; } diff --git a/src/Avalonia/Artemis.UI/packages.lock.json b/src/Avalonia/Artemis.UI/packages.lock.json index 89b7c2801..293dcafa4 100644 --- a/src/Avalonia/Artemis.UI/packages.lock.json +++ b/src/Avalonia/Artemis.UI/packages.lock.json @@ -136,17 +136,28 @@ }, "RGB.NET.Core": { "type": "Direct", - "requested": "[1.0.0-prerelease1, )", - "resolved": "1.0.0-prerelease1", - "contentHash": "aaCPk++kr1TaV/qWYeol5975IN3XifDuuQ9wrCD+nw1cy05BMdGVhuQ72ITb0YRBedssd/btkM51ZABsBd8CEQ==" + "requested": "[1.0.0-prerelease7, )", + "resolved": "1.0.0-prerelease7", + "contentHash": "IIja5sC4QZ5pbSNckRCG7TlY4U6j/dRbrl4e2FZqsTGgsevaVB3IqonUQLFY1GGst4xNSl2oh0A23coXQxXGbQ==" }, "RGB.NET.Layout": { "type": "Direct", - "requested": "[1.0.0-prerelease1, )", - "resolved": "1.0.0-prerelease1", - "contentHash": "nbaHbcY59tzFSeTDbImhrcR1ZyJpoC0x6WawXdtGXO7x3F91ajM7kM5SJwi/5jHdD61vGV0ARuznmR8ErAWegQ==", + "requested": "[1.0.0-prerelease7, )", + "resolved": "1.0.0-prerelease7", + "contentHash": "S0kfWVa8EfMOAl2WPHsq98dwaO+SNz9TWr1AtMkdo8aZuYIVhaJ1c+mSAMMnH1V+mSbxDWPHWkNzi9ITszJucA==", "dependencies": { - "RGB.NET.Core": "1.0.0-prerelease1" + "RGB.NET.Core": "1.0.0-prerelease7" + } + }, + "SkiaSharp": { + "type": "Direct", + "requested": "[2.88.0-preview.178, )", + "resolved": "2.88.0-preview.178", + "contentHash": "arzd/44ykiBPqGWUuQqNTuJ49rhsXOg4Zw1p2Mm3B/5PZzV1wcTH4V+J+4ra8RS0KbIoy4KWeNF+zHAifNsiRg==", + "dependencies": { + "SkiaSharp.NativeAssets.Win32": "2.88.0-preview.178", + "SkiaSharp.NativeAssets.macOS": "2.88.0-preview.178", + "System.Memory": "4.5.3" } }, "Splat.Ninject": { @@ -574,10 +585,10 @@ }, "RGB.NET.Presets": { "type": "Transitive", - "resolved": "1.0.0-prerelease1", - "contentHash": "XU8XeI0fQF26fd0pQHgoe9RaROuvENmZlX/1QyyaN9P3j0LtYmy6ycWZbsXp8byLT0UcGbS+odMiQQAnK+kxgg==", + "resolved": "1.0.0-prerelease7", + "contentHash": "NgShvOPQM0miOsdqMKjkNunngJUZMwr8KR8ME2/Ksir7wgIQfgJj1YwZy8aIj+ar7fDo6VZJZenAshs/Ul+04A==", "dependencies": { - "RGB.NET.Core": "1.0.0-prerelease1" + "RGB.NET.Core": "1.0.0-prerelease7" } }, "runtime.debian.8-x64.runtime.native.System.Security.Cryptography.OpenSsl": { @@ -721,16 +732,6 @@ "resolved": "0.5.11", "contentHash": "a04YHHKRK1xY8ccSgpa6HOmOw9Kuivo2b2qejp9CK00ykdCBK3Mmc+ekBx954+zPQBksN6aLhvn1SEL7QG2s8Q==" }, - "SkiaSharp": { - "type": "Transitive", - "resolved": "2.88.0-preview.178", - "contentHash": "arzd/44ykiBPqGWUuQqNTuJ49rhsXOg4Zw1p2Mm3B/5PZzV1wcTH4V+J+4ra8RS0KbIoy4KWeNF+zHAifNsiRg==", - "dependencies": { - "SkiaSharp.NativeAssets.Win32": "2.88.0-preview.178", - "SkiaSharp.NativeAssets.macOS": "2.88.0-preview.178", - "System.Memory": "4.5.3" - } - }, "SkiaSharp.HarfBuzz": { "type": "Transitive", "resolved": "2.88.0-preview.178", @@ -1729,14 +1730,14 @@ "Ninject": "3.3.4", "Ninject.Extensions.ChildKernel": "3.3.0", "Ninject.Extensions.Conventions": "3.3.0", - "RGB.NET.Core": "1.0.0-prerelease1", - "RGB.NET.Layout": "1.0.0-prerelease1", - "RGB.NET.Presets": "1.0.0-prerelease1", + "RGB.NET.Core": "1.0.0-prerelease7", + "RGB.NET.Layout": "1.0.0-prerelease7", + "RGB.NET.Presets": "1.0.0-prerelease7", "Serilog": "2.10.0", "Serilog.Sinks.Console": "4.0.0", "Serilog.Sinks.Debug": "2.0.0", "Serilog.Sinks.File": "5.0.0", - "SkiaSharp": "2.80.3", + "SkiaSharp": "2.88.0-preview.178", "System.Buffers": "4.5.1", "System.IO.FileSystem.AccessControl": "5.0.0", "System.Numerics.Vectors": "4.5.0", @@ -1763,9 +1764,10 @@ "Avalonia.Xaml.Interactivity": "0.10.11.5", "FluentAvaloniaUI": "1.1.8", "Material.Icons.Avalonia": "1.0.2", - "RGB.NET.Core": "1.0.0-prerelease1", + "RGB.NET.Core": "1.0.0-prerelease7", "ReactiveUI": "16.3.10", - "ReactiveUI.Validation": "2.2.1" + "ReactiveUI.Validation": "2.2.1", + "SkiaSharp": "2.88.0-preview.178" } } }