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

Surface editor - Selection improvements

This commit is contained in:
Robert 2022-01-08 11:14:58 +01:00
parent c168edd9fc
commit 9bbab5f9f8
22 changed files with 351 additions and 212 deletions

View File

@ -54,7 +54,7 @@
<PackageReference Include="Serilog.Sinks.Console" Version="4.0.0" />
<PackageReference Include="Serilog.Sinks.Debug" Version="2.0.0" />
<PackageReference Include="Serilog.Sinks.File" Version="5.0.0" />
<PackageReference Include="SkiaSharp" Version="2.80.3" />
<PackageReference Include="SkiaSharp" Version="2.88.0-preview.178" />
<PackageReference Include="System.Buffers" Version="4.5.1" />
<PackageReference Include="System.IO.FileSystem.AccessControl" Version="5.0.0" />
<PackageReference Include="System.Numerics.Vectors" Version="4.5.0" />

View File

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

View File

@ -209,16 +209,6 @@
Defines the <see cref="P:Artemis.UI.Shared.Controls.SelectionRectangle.InputElement" /> property.
</summary>
</member>
<member name="F:Artemis.UI.Shared.Controls.SelectionRectangle.SelectionUpdatedProperty">
<summary>
Defines the <see cref="P:Artemis.UI.Shared.Controls.SelectionRectangle.SelectionUpdated" /> property.
</summary>
</member>
<member name="F:Artemis.UI.Shared.Controls.SelectionRectangle.SelectionFinishedProperty">
<summary>
Defines the <see cref="P:Artemis.UI.Shared.Controls.SelectionRectangle.SelectionFinished" /> property.
</summary>
</member>
<member name="M:Artemis.UI.Shared.Controls.SelectionRectangle.#ctor">
<inheritdoc />
</member>
@ -239,19 +229,31 @@
</member>
<member name="P:Artemis.UI.Shared.Controls.SelectionRectangle.InputElement">
<summary>
Gets or sets the element that captures input for the selection rectangle.
Gets or sets the element that captures input for the selection rectangle.
</summary>
</member>
<member name="P:Artemis.UI.Shared.Controls.SelectionRectangle.SelectionUpdated">
<member name="E:Artemis.UI.Shared.Controls.SelectionRectangle.SelectionUpdated">
<summary>
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.
</summary>
</member>
<member name="P:Artemis.UI.Shared.Controls.SelectionRectangle.SelectionFinished">
<member name="E:Artemis.UI.Shared.Controls.SelectionRectangle.SelectionFinished">
<summary>
Gets or sets the command to execute when the selection has finished.
Occurs when the selection has finished, indicating the user stopped dragging.
</summary>
</member>
<member name="M:Artemis.UI.Shared.Controls.SelectionRectangle.OnSelectionUpdated(Artemis.UI.Shared.Events.SelectionRectangleEventArgs)">
<summary>
Invokes the <see cref="E:Artemis.UI.Shared.Controls.SelectionRectangle.SelectionUpdated" /> event
</summary>
<param name="e"></param>
</member>
<member name="M:Artemis.UI.Shared.Controls.SelectionRectangle.OnSelectionFinished(Artemis.UI.Shared.Events.SelectionRectangleEventArgs)">
<summary>
Invokes the <see cref="E:Artemis.UI.Shared.Controls.SelectionRectangle.SelectionFinished" /> event
</summary>
<param name="e"></param>
</member>
<member name="M:Artemis.UI.Shared.Controls.SelectionRectangle.Render(Avalonia.Media.DrawingContext)">
<inheritdoc />
</member>
@ -783,6 +785,26 @@
If applicable, the previous active profile element before the event was raised
</summary>
</member>
<member name="T:Artemis.UI.Shared.Events.SelectionRectangleEventArgs">
<summary>
Provides data on selection events raised by the <see cref="T:Artemis.UI.Shared.Controls.SelectionRectangle" />.
</summary>
</member>
<member name="M:Artemis.UI.Shared.Events.SelectionRectangleEventArgs.#ctor(Avalonia.Rect,Avalonia.Input.KeyModifiers)">
<summary>
Creates a new instance of the <see cref="T:Artemis.UI.Shared.Events.SelectionRectangleEventArgs" /> class.
</summary>
</member>
<member name="P:Artemis.UI.Shared.Events.SelectionRectangleEventArgs.Rectangle">
<summary>
Gets the rectangle that was selected when the event occurred.
</summary>
</member>
<member name="P:Artemis.UI.Shared.Events.SelectionRectangleEventArgs.KeyModifiers">
<summary>
Gets the key modifiers that where pressed when the event occurred.
</summary>
</member>
<member name="T:Artemis.UI.Shared.ArtemisSharedUIException">
<summary>
Represents errors that occur within the Artemis Shared UI library

View File

@ -41,7 +41,7 @@
<PackageReference Include="Ninject.Extensions.Conventions" Version="3.3.0" />
<PackageReference Include="RGB.NET.Core" Version="1.0.0-prerelease7" />
<PackageReference Include="SharpVectors.Reloaded" Version="1.7.5" />
<PackageReference Include="SkiaSharp" Version="2.80.3" />
<PackageReference Include="SkiaSharp" Version="2.88.0-preview.178" />
<PackageReference Include="SkiaSharp.Views.WPF" Version="2.80.3" />
<PackageReference Include="Stylet" Version="1.3.6" />
<PackageReference Include="System.Buffers" Version="4.5.1" />

View File

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

View File

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

View File

@ -48,7 +48,7 @@
<PackageReference Include="MaterialDesignThemes" Version="4.1.0" />
<PackageReference Include="Ninject" Version="3.3.4" />
<PackageReference Include="NoStringEvaluating" Version="2.2.2" />
<PackageReference Include="SkiaSharp" Version="2.80.3" />
<PackageReference Include="SkiaSharp" Version="2.88.0-preview.178" />
<PackageReference Include="Stylet" Version="1.3.6" />
</ItemGroup>

View File

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

View File

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

View File

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

View File

@ -27,7 +27,8 @@
<PackageReference Include="Material.Icons.Avalonia" Version="1.0.2" />
<PackageReference Include="ReactiveUI" Version="16.3.10" />
<PackageReference Include="ReactiveUI.Validation" Version="2.2.1" />
<PackageReference Include="RGB.NET.Core" Version="1.0.0-prerelease1" />
<PackageReference Include="RGB.NET.Core" Version="1.0.0-prerelease7" />
<PackageReference Include="SkiaSharp" Version="2.88.0-preview.178" />
</ItemGroup>
<ItemGroup>
<Page Include="DefaultTypes\DataModel\Display\DefaultDataModelDisplayView.xaml">

View File

@ -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 <see cref="Background" /> property.
/// </summary>
public static readonly StyledProperty<IBrush> BackgroundProperty =
AvaloniaProperty.Register<SelectionRectangle, IBrush>(nameof(Background),
new SolidColorBrush(AvaloniaLocator.Current.GetService<FluentAvaloniaTheme>()?.CustomAccentColor ?? Colors.Transparent, 0.25));
AvaloniaProperty.Register<SelectionRectangle, IBrush>(nameof(Background), new SolidColorBrush(Colors.CadetBlue, 0.25));
/// <summary>
/// Defines the <see cref="BorderBrush" /> property.
/// </summary>
public static readonly StyledProperty<IBrush> BorderBrushProperty =
AvaloniaProperty.Register<SelectionRectangle, IBrush>(nameof(BorderBrush),
new SolidColorBrush(AvaloniaLocator.Current.GetService<FluentAvaloniaTheme>()?.CustomAccentColor ?? Colors.Transparent));
AvaloniaProperty.Register<SelectionRectangle, IBrush>(nameof(BorderBrush), new SolidColorBrush(Colors.CadetBlue));
/// <summary>
/// Defines the <see cref="BorderBrush" /> property.
@ -40,18 +37,6 @@ namespace Artemis.UI.Shared.Controls
public static readonly StyledProperty<IControl?> InputElementProperty =
AvaloniaProperty.Register<SelectionRectangle, IControl?>(nameof(InputElement), notifying: OnInputElementChanged);
/// <summary>
/// Defines the <see cref="SelectionUpdated" /> property.
/// </summary>
public static readonly StyledProperty<ICommand?> SelectionUpdatedProperty
= AvaloniaProperty.Register<SelectionRectangle, ICommand?>(nameof(SelectionUpdated));
/// <summary>
/// Defines the <see cref="SelectionFinished" /> property.
/// </summary>
public static readonly StyledProperty<ICommand?> SelectionFinishedProperty
= AvaloniaProperty.Register<SelectionRectangle, ICommand?>(nameof(SelectionUpdated));
private Rect? _displayRect;
private IControl? _oldInputElement;
private Point _startPosition;
@ -91,7 +76,7 @@ namespace Artemis.UI.Shared.Controls
}
/// <summary>
/// Gets or sets the element that captures input for the selection rectangle.
/// Gets or sets the element that captures input for the selection rectangle.
/// </summary>
public IControl? InputElement
{
@ -100,21 +85,31 @@ namespace Artemis.UI.Shared.Controls
}
/// <summary>
/// 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.
/// </summary>
public ICommand? SelectionUpdated
public event EventHandler<SelectionRectangleEventArgs>? SelectionUpdated;
/// <summary>
/// Occurs when the selection has finished, indicating the user stopped dragging.
/// </summary>
public event EventHandler<SelectionRectangleEventArgs>? SelectionFinished;
/// <summary>
/// Invokes the <see cref="SelectionUpdated" /> event
/// </summary>
/// <param name="e"></param>
protected virtual void OnSelectionUpdated(SelectionRectangleEventArgs e)
{
get => GetValue(SelectionUpdatedProperty);
set => SetValue(SelectionUpdatedProperty, value);
SelectionUpdated?.Invoke(this, e);
}
/// <summary>
/// Gets or sets the command to execute when the selection has finished.
/// Invokes the <see cref="SelectionFinished" /> event
/// </summary>
public ICommand? SelectionFinished
/// <param name="e"></param>
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);
}
/// <inheritdoc />

View File

@ -0,0 +1,32 @@
using System;
using Artemis.UI.Shared.Controls;
using Avalonia;
using Avalonia.Input;
namespace Artemis.UI.Shared.Events
{
/// <summary>
/// Provides data on selection events raised by the <see cref="SelectionRectangle" />.
/// </summary>
public class SelectionRectangleEventArgs : EventArgs
{
/// <summary>
/// Creates a new instance of the <see cref="SelectionRectangleEventArgs" /> class.
/// </summary>
public SelectionRectangleEventArgs(Rect rectangle, KeyModifiers keyModifiers)
{
KeyModifiers = keyModifiers;
Rectangle = rectangle;
}
/// <summary>
/// Gets the rectangle that was selected when the event occurred.
/// </summary>
public Rect Rectangle { get; }
/// <summary>
/// Gets the key modifiers that where pressed when the event occurred.
/// </summary>
public KeyModifiers KeyModifiers { get; }
}
}

View File

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

View File

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

View File

@ -26,8 +26,9 @@
<PackageReference Include="Material.Icons.Avalonia" Version="1.0.2" />
<PackageReference Include="ReactiveUI" Version="16.3.10" />
<PackageReference Include="ReactiveUI.Validation" Version="2.2.1" />
<PackageReference Include="RGB.NET.Core" Version="1.0.0-prerelease1" />
<PackageReference Include="RGB.NET.Layout" Version="1.0.0-prerelease1" />
<PackageReference Include="RGB.NET.Core" Version="1.0.0-prerelease7" />
<PackageReference Include="RGB.NET.Layout" Version="1.0.0-prerelease7" />
<PackageReference Include="SkiaSharp" Version="2.88.0-preview.178" />
<PackageReference Include="Splat.Ninject" Version="14.1.17" />
</ItemGroup>
<ItemGroup>

View File

@ -11,13 +11,6 @@ namespace Artemis.UI.Screens.SurfaceEditor
InitializeComponent();
}
private void InitializeComponent()
{
AvaloniaXamlLoader.Load(this);
}
#region Overrides of InputElement
/// <inheritdoc />
protected override void OnPointerEnter(PointerEventArgs e)
{
@ -42,15 +35,9 @@ namespace Artemis.UI.Screens.SurfaceEditor
base.OnPointerLeave(e);
}
/// <inheritdoc />
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
}
}

View File

@ -99,7 +99,7 @@ namespace Artemis.UI.Screens.SurfaceEditor
Device.Y = roundedY;
}
}
private void ExecuteIdentifyDevice(ArtemisDevice device)
{
_deviceService.IdentifyDevice(device);

View File

@ -88,7 +88,12 @@
<controls:SelectionRectangle Name="SelectionRectangle"
InputElement="{Binding #ZoomBorder}"
SelectionUpdated="{Binding UpdateSelection}" />
SelectionUpdated="SelectionRectangle_OnSelectionUpdated"
BorderBrush="{DynamicResource SystemAccentColor}">
<controls:SelectionRectangle.Background>
<SolidColorBrush Color="{DynamicResource SystemAccentColor}" Opacity="0.2"></SolidColorBrush>
</controls:SelectionRectangle.Background>
</controls:SelectionRectangle>
<Border Name="SurfaceBounds"
VerticalAlignment="Top"

View File

@ -1,4 +1,6 @@
using System.Reactive;
using Artemis.UI.Shared.Controls;
using Artemis.UI.Shared.Events;
using Avalonia;
using Avalonia.Controls;
using Avalonia.Controls.PanAndZoom;
@ -15,6 +17,7 @@ namespace Artemis.UI.Screens.SurfaceEditor
private readonly SelectionRectangle _selectionRectangle;
private readonly Border _surfaceBounds;
private readonly ZoomBorder _zoomBorder;
private bool _dragging;
public SurfaceEditorView()
{
@ -52,15 +55,12 @@ namespace Artemis.UI.Screens.SurfaceEditor
if (!e.GetCurrentPoint(this).Properties.IsLeftButtonPressed)
return;
_dragging = false;
if (e.Source is Border {Name: "SurfaceDeviceBorder"})
{
e.Pointer.Capture(_zoomBorder);
e.Handled = true;
ViewModel?.StartMouseDrag(e.GetPosition(_containerGrid));
}
else
{
ViewModel?.ClearSelection();
}
}
@ -70,7 +70,13 @@ namespace Artemis.UI.Screens.SurfaceEditor
return;
if (ReferenceEquals(e.Pointer.Captured, sender))
{
if (!_dragging)
ViewModel?.StartMouseDrag(e.GetPosition(_containerGrid));
ViewModel?.UpdateMouseDrag(e.GetPosition(_containerGrid));
}
_dragging = true;
}
private void ZoomBorder_OnPointerReleased(object? sender, PointerReleasedEventArgs e)
@ -78,6 +84,13 @@ namespace Artemis.UI.Screens.SurfaceEditor
if (e.InitialPressMouseButton != MouseButton.Left)
return;
// If the mouse didn't move, apply selection
if (!_dragging)
{
ViewModel?.SelectFirstDeviceAtPoint(e.GetPosition(_containerGrid), e.KeyModifiers.HasFlag(KeyModifiers.Shift));
return;
}
if (ReferenceEquals(e.Pointer.Captured, sender))
{
ViewModel?.StopMouseDrag(e.GetPosition(_containerGrid));
@ -85,6 +98,11 @@ namespace Artemis.UI.Screens.SurfaceEditor
}
}
private void SelectionRectangle_OnSelectionUpdated(object? sender, SelectionRectangleEventArgs e)
{
ViewModel?.UpdateSelection(e.Rectangle, e.KeyModifiers.HasFlag(KeyModifiers.Shift));
}
private void UpdateZoomBorderBackground()
{
if (_zoomBorder.Background is VisualBrush visualBrush)

View File

@ -16,7 +16,6 @@ namespace Artemis.UI.Screens.SurfaceEditor
{
public class SurfaceEditorViewModel : MainScreenViewModel
{
private readonly IInputService _inputService;
private readonly IRgbService _rgbService;
private readonly ISettingsService _settingsService;
private bool _saving;
@ -24,22 +23,18 @@ namespace Artemis.UI.Screens.SurfaceEditor
public SurfaceEditorViewModel(IScreen hostScreen,
IRgbService rgbService,
SurfaceVmFactory surfaceVmFactory,
IInputService inputService,
ISettingsService settingsService) : base(hostScreen, "surface-editor")
{
_rgbService = rgbService;
_inputService = inputService;
_settingsService = settingsService;
DisplayName = "Surface Editor";
SurfaceDeviceViewModels = new ObservableCollection<SurfaceDeviceViewModel>(rgbService.Devices.Select(surfaceVmFactory.SurfaceDeviceViewModel));
ListDeviceViewModels = new ObservableCollection<ListDeviceViewModel>(rgbService.Devices.Select(surfaceVmFactory.ListDeviceViewModel));
SurfaceDeviceViewModels = new ObservableCollection<SurfaceDeviceViewModel>(rgbService.Devices.OrderBy(d => d.ZIndex).Select(surfaceVmFactory.SurfaceDeviceViewModel));
ListDeviceViewModels = new ObservableCollection<ListDeviceViewModel>(rgbService.Devices.OrderBy(d => d.ZIndex).Select(surfaceVmFactory.ListDeviceViewModel));
BringToFront = ReactiveCommand.Create<ArtemisDevice>(ExecuteBringToFront);
BringForward = ReactiveCommand.Create<ArtemisDevice>(ExecuteBringForward);
SendToBack = ReactiveCommand.Create<ArtemisDevice>(ExecuteSendToBack);
SendBackward = ReactiveCommand.Create<ArtemisDevice>(ExecuteSendBackward);
UpdateSelection = ReactiveCommand.Create<Rect>(ExecuteUpdateSelection);
}
public ObservableCollection<SurfaceDeviceViewModel> SurfaceDeviceViewModels { get; }
@ -50,8 +45,6 @@ namespace Artemis.UI.Screens.SurfaceEditor
public ReactiveCommand<ArtemisDevice, Unit> SendToBack { get; }
public ReactiveCommand<ArtemisDevice, Unit> SendBackward { get; }
public ReactiveCommand<Rect, Unit> 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;
}

View File

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