mirror of
https://github.com/Artemis-RGB/Artemis
synced 2025-12-13 05:48:35 +00:00
Layer properties - Added drag-editing for number-based properties
Layer properties - Added min and max values Nuget - Updated Stylet to 1.3.1
This commit is contained in:
parent
33756a228d
commit
05cc032271
@ -96,8 +96,8 @@
|
|||||||
<Reference Include="SkiaSharp, Version=1.68.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756, processorArchitecture=MSIL">
|
<Reference Include="SkiaSharp, Version=1.68.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\SkiaSharp.1.68.2-preview.29\lib\net45\SkiaSharp.dll</HintPath>
|
<HintPath>..\packages\SkiaSharp.1.68.2-preview.29\lib\net45\SkiaSharp.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="Stylet, Version=1.3.0.0, Culture=neutral, processorArchitecture=MSIL">
|
<Reference Include="Stylet, Version=1.3.1.0, Culture=neutral, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\Stylet.1.3.0\lib\net45\Stylet.dll</HintPath>
|
<HintPath>..\packages\Stylet.1.3.1\lib\net45\Stylet.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="System" />
|
<Reference Include="System" />
|
||||||
<Reference Include="System.Buffers, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
<Reference Include="System.Buffers, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||||
|
|||||||
@ -522,11 +522,11 @@ namespace Artemis.Core.Models.Profile
|
|||||||
|
|
||||||
// Transform
|
// Transform
|
||||||
var transform = new LayerProperty<object>(this, "Core.Transform", "Transform", "A collection of transformation properties.") {ExpandByDefault = true};
|
var transform = new LayerProperty<object>(this, "Core.Transform", "Transform", "A collection of transformation properties.") {ExpandByDefault = true};
|
||||||
AnchorPointProperty = new LayerProperty<SKPoint>(this, transform, "Core.AnchorPoint", "Anchor Point", "The point at which the shape is attached to its position.");
|
AnchorPointProperty = new LayerProperty<SKPoint>(this, transform, "Core.AnchorPoint", "Anchor Point", "The point at which the shape is attached to its position.") {InputStepSize = 0.001f};
|
||||||
PositionProperty = new LayerProperty<SKPoint>(this, transform, "Core.Position", "Position", "The position of the shape.");
|
PositionProperty = new LayerProperty<SKPoint>(this, transform, "Core.Position", "Position", "The position of the shape.") {InputStepSize = 0.001f};
|
||||||
ScaleProperty = new LayerProperty<SKSize>(this, transform, "Core.Scale", "Scale", "The scale of the shape.") {InputAffix = "%"};
|
ScaleProperty = new LayerProperty<SKSize>(this, transform, "Core.Scale", "Scale", "The scale of the shape.") {InputAffix = "%", MinInputValue = 0f};
|
||||||
RotationProperty = new LayerProperty<float>(this, transform, "Core.Rotation", "Rotation", "The rotation of the shape in degrees.") {InputAffix = "°"};
|
RotationProperty = new LayerProperty<float>(this, transform, "Core.Rotation", "Rotation", "The rotation of the shape in degrees.") {InputAffix = "°"};
|
||||||
OpacityProperty = new LayerProperty<float>(this, transform, "Core.Opacity", "Opacity", "The opacity of the shape.") {InputAffix = "%"};
|
OpacityProperty = new LayerProperty<float>(this, transform, "Core.Opacity", "Opacity", "The opacity of the shape.") {InputAffix = "%", MinInputValue = 0f, MaxInputValue = 100f};
|
||||||
ScaleProperty.Value = new SKSize(100, 100);
|
ScaleProperty.Value = new SKSize(100, 100);
|
||||||
OpacityProperty.Value = 100;
|
OpacityProperty.Value = 100;
|
||||||
|
|
||||||
|
|||||||
@ -24,6 +24,7 @@ namespace Artemis.Core.Models.Profile.LayerProperties
|
|||||||
Description = description;
|
Description = description;
|
||||||
Type = type;
|
Type = type;
|
||||||
CanUseKeyframes = true;
|
CanUseKeyframes = true;
|
||||||
|
InputStepSize = 1;
|
||||||
|
|
||||||
// This can only be null if accessed internally
|
// This can only be null if accessed internally
|
||||||
if (PluginInfo == null)
|
if (PluginInfo == null)
|
||||||
@ -32,6 +33,7 @@ namespace Artemis.Core.Models.Profile.LayerProperties
|
|||||||
Children = new List<BaseLayerProperty>();
|
Children = new List<BaseLayerProperty>();
|
||||||
BaseKeyframes = new List<BaseKeyframe>();
|
BaseKeyframes = new List<BaseKeyframe>();
|
||||||
|
|
||||||
|
|
||||||
parent?.Children.Add(this);
|
parent?.Children.Add(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -86,6 +88,21 @@ namespace Artemis.Core.Models.Profile.LayerProperties
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public string InputAffix { get; set; }
|
public string InputAffix { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets an optional maximum input value, only enforced in the UI.
|
||||||
|
/// </summary>
|
||||||
|
public object MaxInputValue { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the input drag step size, used in the UI.
|
||||||
|
/// </summary>
|
||||||
|
public float InputStepSize { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets an optional minimum input value, only enforced in the UI.
|
||||||
|
/// </summary>
|
||||||
|
public object MinInputValue { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets whether this property can use keyframes, True by default.
|
/// Gets or sets whether this property can use keyframes, True by default.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@ -1,6 +1,5 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
|
||||||
using Artemis.Core.Extensions;
|
using Artemis.Core.Extensions;
|
||||||
using Artemis.Core.Plugins.Models;
|
using Artemis.Core.Plugins.Models;
|
||||||
using RGB.NET.Core;
|
using RGB.NET.Core;
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
|
||||||
<packages>
|
<packages>
|
||||||
<package id="AppDomainToolkit" version="1.0.4.3" targetFramework="net461" />
|
<package id="AppDomainToolkit" version="1.0.4.3" targetFramework="net461" />
|
||||||
<package id="Ben.Demystifier" version="0.1.4" targetFramework="net472" />
|
<package id="Ben.Demystifier" version="0.1.4" targetFramework="net472" />
|
||||||
@ -15,7 +16,7 @@
|
|||||||
<package id="Serilog.Enrichers.Demystify" version="1.0.0-dev-00019" targetFramework="net472" />
|
<package id="Serilog.Enrichers.Demystify" version="1.0.0-dev-00019" targetFramework="net472" />
|
||||||
<package id="Serilog.Sinks.File" version="4.0.0" targetFramework="net472" />
|
<package id="Serilog.Sinks.File" version="4.0.0" targetFramework="net472" />
|
||||||
<package id="SkiaSharp" version="1.68.2-preview.29" targetFramework="net472" />
|
<package id="SkiaSharp" version="1.68.2-preview.29" targetFramework="net472" />
|
||||||
<package id="Stylet" version="1.3.0" targetFramework="net472" />
|
<package id="Stylet" version="1.3.1" targetFramework="net472" />
|
||||||
<package id="System.Buffers" version="4.5.0" targetFramework="net472" />
|
<package id="System.Buffers" version="4.5.0" targetFramework="net472" />
|
||||||
<package id="System.Collections.Immutable" version="1.6.0-preview8.19405.3" targetFramework="net472" />
|
<package id="System.Collections.Immutable" version="1.6.0-preview8.19405.3" targetFramework="net472" />
|
||||||
<package id="System.Diagnostics.DiagnosticSource" version="4.5.1" targetFramework="net472" />
|
<package id="System.Diagnostics.DiagnosticSource" version="4.5.1" targetFramework="net472" />
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
|
||||||
<configuration>
|
<configuration>
|
||||||
<runtime>
|
<runtime>
|
||||||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||||
|
|||||||
@ -56,8 +56,8 @@
|
|||||||
<Reference Include="SkiaSharp, Version=1.68.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756, processorArchitecture=MSIL">
|
<Reference Include="SkiaSharp, Version=1.68.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\SkiaSharp.1.68.2-preview.29\lib\net45\SkiaSharp.dll</HintPath>
|
<HintPath>..\packages\SkiaSharp.1.68.2-preview.29\lib\net45\SkiaSharp.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="Stylet, Version=1.3.0.0, Culture=neutral, processorArchitecture=MSIL">
|
<Reference Include="Stylet, Version=1.3.1.0, Culture=neutral, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\Stylet.1.3.0\lib\net45\Stylet.dll</HintPath>
|
<HintPath>..\packages\Stylet.1.3.1\lib\net45\Stylet.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="System" />
|
<Reference Include="System" />
|
||||||
<Reference Include="System.Buffers, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
<Reference Include="System.Buffers, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||||
|
|||||||
@ -53,7 +53,7 @@ namespace Artemis.Plugins.LayerBrushes.Color
|
|||||||
|
|
||||||
public override void Render(SKCanvas canvas, SKImageInfo canvasInfo, SKPath path, SKPaint paint)
|
public override void Render(SKCanvas canvas, SKImageInfo canvasInfo, SKPath path, SKPaint paint)
|
||||||
{
|
{
|
||||||
if (path.Bounds != _shaderBounds)
|
if (path.Bounds != _shaderBounds)
|
||||||
CreateShader(path.Bounds);
|
CreateShader(path.Bounds);
|
||||||
|
|
||||||
paint.Shader = _shader;
|
paint.Shader = _shader;
|
||||||
|
|||||||
@ -1,8 +1,9 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
|
||||||
<packages>
|
<packages>
|
||||||
<package id="MaterialDesignColors" version="1.2.0" targetFramework="net472" />
|
<package id="MaterialDesignColors" version="1.2.0" targetFramework="net472" />
|
||||||
<package id="SkiaSharp" version="1.68.2-preview.29" targetFramework="net472" />
|
<package id="SkiaSharp" version="1.68.2-preview.29" targetFramework="net472" />
|
||||||
<package id="Stylet" version="1.3.0" targetFramework="net472" />
|
<package id="Stylet" version="1.3.1" targetFramework="net472" />
|
||||||
<package id="System.Buffers" version="4.5.0" targetFramework="net472" />
|
<package id="System.Buffers" version="4.5.0" targetFramework="net472" />
|
||||||
<package id="System.Memory" version="4.5.3" targetFramework="net472" />
|
<package id="System.Memory" version="4.5.3" targetFramework="net472" />
|
||||||
<package id="System.Numerics.Vectors" version="4.5.0" targetFramework="net472" />
|
<package id="System.Numerics.Vectors" version="4.5.0" targetFramework="net472" />
|
||||||
|
|||||||
@ -56,8 +56,8 @@
|
|||||||
<Reference Include="SkiaSharp, Version=1.68.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756, processorArchitecture=MSIL">
|
<Reference Include="SkiaSharp, Version=1.68.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\SkiaSharp.1.68.2-preview.29\lib\net45\SkiaSharp.dll</HintPath>
|
<HintPath>..\packages\SkiaSharp.1.68.2-preview.29\lib\net45\SkiaSharp.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="Stylet, Version=1.3.0.0, Culture=neutral, processorArchitecture=MSIL">
|
<Reference Include="Stylet, Version=1.3.1.0, Culture=neutral, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\Stylet.1.3.0\lib\net45\Stylet.dll</HintPath>
|
<HintPath>..\packages\Stylet.1.3.1\lib\net45\Stylet.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="System" />
|
<Reference Include="System" />
|
||||||
<Reference Include="System.Buffers, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
<Reference Include="System.Buffers, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||||
|
|||||||
@ -31,9 +31,16 @@ namespace Artemis.Plugins.LayerBrushes.Noise
|
|||||||
MainColorProperty = RegisterLayerProperty<SKColor>("Brush.MainColor", "Main color", "The main color of the noise.");
|
MainColorProperty = RegisterLayerProperty<SKColor>("Brush.MainColor", "Main color", "The main color of the noise.");
|
||||||
SecondaryColorProperty = RegisterLayerProperty<SKColor>("Brush.SecondaryColor", "Secondary color", "The secondary color of the noise.");
|
SecondaryColorProperty = RegisterLayerProperty<SKColor>("Brush.SecondaryColor", "Secondary color", "The secondary color of the noise.");
|
||||||
ScaleProperty = RegisterLayerProperty<SKSize>("Brush.Scale", "Scale", "The scale of the noise.");
|
ScaleProperty = RegisterLayerProperty<SKSize>("Brush.Scale", "Scale", "The scale of the noise.");
|
||||||
|
ScaleProperty.MinInputValue = 0f;
|
||||||
HardnessProperty = RegisterLayerProperty<float>("Brush.Hardness", "Hardness", "The hardness of the noise, lower means there are gradients in the noise, higher means hard lines..");
|
HardnessProperty = RegisterLayerProperty<float>("Brush.Hardness", "Hardness", "The hardness of the noise, lower means there are gradients in the noise, higher means hard lines..");
|
||||||
|
HardnessProperty.MinInputValue = 0f;
|
||||||
|
HardnessProperty.MaxInputValue = 2048f;
|
||||||
ScrollSpeedProperty = RegisterLayerProperty<SKPoint>("Brush.ScrollSpeed", "Movement speed", "The speed at which the noise moves vertically and horizontally.");
|
ScrollSpeedProperty = RegisterLayerProperty<SKPoint>("Brush.ScrollSpeed", "Movement speed", "The speed at which the noise moves vertically and horizontally.");
|
||||||
|
ScrollSpeedProperty.MinInputValue = -64f;
|
||||||
|
ScrollSpeedProperty.MaxInputValue = 64f;
|
||||||
AnimationSpeedProperty = RegisterLayerProperty<float>("Brush.AnimationSpeed", "Animation speed", "The speed at which the noise moves.");
|
AnimationSpeedProperty = RegisterLayerProperty<float>("Brush.AnimationSpeed", "Animation speed", "The speed at which the noise moves.");
|
||||||
|
AnimationSpeedProperty.MinInputValue = 0f;
|
||||||
|
AnimationSpeedProperty.MaxInputValue = 64f;
|
||||||
ScaleProperty.InputAffix = "%";
|
ScaleProperty.InputAffix = "%";
|
||||||
|
|
||||||
DetermineRenderScale();
|
DetermineRenderScale();
|
||||||
|
|||||||
@ -1,7 +1,8 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
|
||||||
<packages>
|
<packages>
|
||||||
<package id="SkiaSharp" version="1.68.2-preview.29" targetFramework="net472" />
|
<package id="SkiaSharp" version="1.68.2-preview.29" targetFramework="net472" />
|
||||||
<package id="Stylet" version="1.3.0" targetFramework="net472" />
|
<package id="Stylet" version="1.3.1" targetFramework="net472" />
|
||||||
<package id="System.Buffers" version="4.5.0" targetFramework="net472" />
|
<package id="System.Buffers" version="4.5.0" targetFramework="net472" />
|
||||||
<package id="System.Memory" version="4.5.3" targetFramework="net472" />
|
<package id="System.Memory" version="4.5.3" targetFramework="net472" />
|
||||||
<package id="System.Numerics.Vectors" version="4.5.0" targetFramework="net472" />
|
<package id="System.Numerics.Vectors" version="4.5.0" targetFramework="net472" />
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
|
||||||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
@ -50,8 +51,8 @@
|
|||||||
<Reference Include="SkiaSharp, Version=1.68.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756, processorArchitecture=MSIL">
|
<Reference Include="SkiaSharp, Version=1.68.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\SkiaSharp.1.68.2-preview.29\lib\net45\SkiaSharp.dll</HintPath>
|
<HintPath>..\packages\SkiaSharp.1.68.2-preview.29\lib\net45\SkiaSharp.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="Stylet, Version=1.3.0.0, Culture=neutral, processorArchitecture=MSIL">
|
<Reference Include="Stylet, Version=1.3.1.0, Culture=neutral, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\Stylet.1.3.0\lib\net45\Stylet.dll</HintPath>
|
<HintPath>..\packages\Stylet.1.3.1\lib\net45\Stylet.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="System" />
|
<Reference Include="System" />
|
||||||
<Reference Include="System.Buffers, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
<Reference Include="System.Buffers, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||||
@ -109,14 +110,17 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<PostBuildEvent>echo Copying plugin to Artemis.UI output directory
|
<PostBuildEvent>
|
||||||
XCOPY "$(TargetDir.TrimEnd('\'))" "$(SolutionDir)\Artemis.UI\$(OutDir)Plugins\$(ProjectName)" /s /q /i /y</PostBuildEvent>
|
echo Copying plugin to Artemis.UI output directory
|
||||||
|
XCOPY "$(TargetDir.TrimEnd('\'))" "$(SolutionDir)\Artemis.UI\$(OutDir)Plugins\$(ProjectName)" /s /q /i /y
|
||||||
|
</PostBuildEvent>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<Import Project="..\packages\SkiaSharp.1.68.2-preview.29\build\net45\SkiaSharp.targets" Condition="Exists('..\packages\SkiaSharp.1.68.2-preview.29\build\net45\SkiaSharp.targets')" />
|
<Import Project="..\packages\SkiaSharp.1.68.2-preview.29\build\net45\SkiaSharp.targets" Condition="Exists('..\packages\SkiaSharp.1.68.2-preview.29\build\net45\SkiaSharp.targets')" />
|
||||||
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
|
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<Error Condition="!Exists('..\packages\SkiaSharp.1.68.2-preview.29\build\net45\SkiaSharp.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\SkiaSharp.1.68.2-preview.29\build\net45\SkiaSharp.targets'))" />
|
<Error Condition="!Exists('..\packages\SkiaSharp.1.68.2-preview.29\build\net45\SkiaSharp.targets')"
|
||||||
|
Text="$([System.String]::Format('$(ErrorText)', '..\packages\SkiaSharp.1.68.2-preview.29\build\net45\SkiaSharp.targets'))" />
|
||||||
</Target>
|
</Target>
|
||||||
</Project>
|
</Project>
|
||||||
@ -1,8 +1,9 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
|
||||||
<packages>
|
<packages>
|
||||||
<package id="QRCoder" version="1.3.5" targetFramework="net461" />
|
<package id="QRCoder" version="1.3.5" targetFramework="net461" />
|
||||||
<package id="SkiaSharp" version="1.68.2-preview.29" targetFramework="net472" />
|
<package id="SkiaSharp" version="1.68.2-preview.29" targetFramework="net472" />
|
||||||
<package id="Stylet" version="1.3.0" targetFramework="net472" />
|
<package id="Stylet" version="1.3.1" targetFramework="net472" />
|
||||||
<package id="System.Buffers" version="4.5.0" targetFramework="net472" />
|
<package id="System.Buffers" version="4.5.0" targetFramework="net472" />
|
||||||
<package id="System.Drawing.Common" version="4.5.0" targetFramework="net461" />
|
<package id="System.Drawing.Common" version="4.5.0" targetFramework="net461" />
|
||||||
<package id="System.Memory" version="4.5.3" targetFramework="net472" />
|
<package id="System.Memory" version="4.5.3" targetFramework="net472" />
|
||||||
|
|||||||
@ -79,11 +79,18 @@
|
|||||||
<Reference Include="PresentationFramework" />
|
<Reference Include="PresentationFramework" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<Compile Include="DraggableFloat.xaml.cs">
|
||||||
|
<DependentUpon>DraggableFloat.xaml</DependentUpon>
|
||||||
|
</Compile>
|
||||||
<Compile Include="Utilities\EnumUtilities.cs" />
|
<Compile Include="Utilities\EnumUtilities.cs" />
|
||||||
<Page Include="ColorPicker.xaml">
|
<Page Include="ColorPicker.xaml">
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
</Page>
|
</Page>
|
||||||
|
<Page Include="DraggableFloat.xaml">
|
||||||
|
<SubType>Designer</SubType>
|
||||||
|
<Generator>MSBuild:Compile</Generator>
|
||||||
|
</Page>
|
||||||
<Page Include="UserControl1.xaml">
|
<Page Include="UserControl1.xaml">
|
||||||
<Generator>MSBuild:Compile</Generator>
|
<Generator>MSBuild:Compile</Generator>
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
|
|||||||
@ -18,7 +18,6 @@ namespace Artemis.UI.Shared
|
|||||||
public static readonly DependencyProperty PopupOpenProperty = DependencyProperty.Register(nameof(PopupOpen), typeof(bool), typeof(ColorPicker),
|
public static readonly DependencyProperty PopupOpenProperty = DependencyProperty.Register(nameof(PopupOpen), typeof(bool), typeof(ColorPicker),
|
||||||
new FrameworkPropertyMetadata(false, FrameworkPropertyMetadataOptions.BindsTwoWayByDefault, PopupOpenPropertyChangedCallback));
|
new FrameworkPropertyMetadata(false, FrameworkPropertyMetadataOptions.BindsTwoWayByDefault, PopupOpenPropertyChangedCallback));
|
||||||
|
|
||||||
|
|
||||||
internal static readonly DependencyProperty ColorOpacityProperty = DependencyProperty.Register(nameof(ColorOpacity), typeof(byte), typeof(ColorPicker),
|
internal static readonly DependencyProperty ColorOpacityProperty = DependencyProperty.Register(nameof(ColorOpacity), typeof(byte), typeof(ColorPicker),
|
||||||
new FrameworkPropertyMetadata((byte) 255, FrameworkPropertyMetadataOptions.AffectsArrange | FrameworkPropertyMetadataOptions.BindsTwoWayByDefault, ColorOpacityPropertyChangedCallback));
|
new FrameworkPropertyMetadata((byte) 255, FrameworkPropertyMetadataOptions.AffectsArrange | FrameworkPropertyMetadataOptions.BindsTwoWayByDefault, ColorOpacityPropertyChangedCallback));
|
||||||
|
|
||||||
|
|||||||
44
src/Artemis.UI.Shared/DraggableFloat.xaml
Normal file
44
src/Artemis.UI.Shared/DraggableFloat.xaml
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
<UserControl x:Class="Artemis.UI.Shared.DraggableFloat"
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
|
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
|
||||||
|
mc:Ignorable="d"
|
||||||
|
d:DesignHeight="450" d:DesignWidth="800">
|
||||||
|
<StackPanel>
|
||||||
|
<!-- Drag handle -->
|
||||||
|
<Border x:Name="DragHandle" BorderThickness="0,0,0,1" Height="19">
|
||||||
|
<Border.BorderBrush>
|
||||||
|
<VisualBrush>
|
||||||
|
<VisualBrush.Visual>
|
||||||
|
<Rectangle StrokeDashArray="2 2" Stroke="{DynamicResource SecondaryAccentBrush}" StrokeThickness="1"
|
||||||
|
Width="{Binding RelativeSource={RelativeSource AncestorType={x:Type Border}}, Path=ActualWidth}"
|
||||||
|
Height="{Binding RelativeSource={RelativeSource AncestorType={x:Type Border}}, Path=ActualHeight}" />
|
||||||
|
</VisualBrush.Visual>
|
||||||
|
</VisualBrush>
|
||||||
|
</Border.BorderBrush>
|
||||||
|
<TextBlock Width="60"
|
||||||
|
Height="17"
|
||||||
|
Padding="1 0"
|
||||||
|
Margin="0 4 0 0"
|
||||||
|
Text="{Binding Value, RelativeSource={RelativeSource AncestorType={x:Type UserControl}}}"
|
||||||
|
Cursor="/Resources/aero_drag_ew.cur"
|
||||||
|
Foreground="{DynamicResource SecondaryAccentBrush}"
|
||||||
|
MouseDown="InputMouseDown"
|
||||||
|
MouseUp="InputMouseUp"
|
||||||
|
MouseMove="InputMouseMove" />
|
||||||
|
</Border>
|
||||||
|
|
||||||
|
<!-- Input -->
|
||||||
|
<TextBox x:Name="Input"
|
||||||
|
Width="60"
|
||||||
|
Height="20"
|
||||||
|
materialDesign:ValidationAssist.UsePopup="True"
|
||||||
|
HorizontalAlignment="Left"
|
||||||
|
Text="{Binding Value, RelativeSource={RelativeSource AncestorType={x:Type UserControl}}}"
|
||||||
|
LostFocus="InputLostFocus"
|
||||||
|
KeyDown="InputKeyDown"
|
||||||
|
RequestBringIntoView="Input_OnRequestBringIntoView" />
|
||||||
|
</StackPanel>
|
||||||
|
</UserControl>
|
||||||
131
src/Artemis.UI.Shared/DraggableFloat.xaml.cs
Normal file
131
src/Artemis.UI.Shared/DraggableFloat.xaml.cs
Normal file
@ -0,0 +1,131 @@
|
|||||||
|
using System;
|
||||||
|
using System.ComponentModel;
|
||||||
|
using System.Runtime.CompilerServices;
|
||||||
|
using System.Windows;
|
||||||
|
using System.Windows.Controls;
|
||||||
|
using System.Windows.Input;
|
||||||
|
|
||||||
|
namespace Artemis.UI.Shared
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Interaction logic for DraggableFloat.xaml
|
||||||
|
/// </summary>
|
||||||
|
public partial class DraggableFloat : UserControl, INotifyPropertyChanged
|
||||||
|
{
|
||||||
|
public static readonly DependencyProperty ValueProperty = DependencyProperty.Register(nameof(Value), typeof(float), typeof(DraggableFloat),
|
||||||
|
new FrameworkPropertyMetadata(default(float), FrameworkPropertyMetadataOptions.BindsTwoWayByDefault, FloatPropertyChangedCallback));
|
||||||
|
|
||||||
|
public static readonly DependencyProperty StepSizeProperty = DependencyProperty.Register(nameof(StepSize), typeof(float), typeof(DraggableFloat));
|
||||||
|
|
||||||
|
public static readonly RoutedEvent ValueChangedEvent =
|
||||||
|
EventManager.RegisterRoutedEvent(
|
||||||
|
nameof(Value),
|
||||||
|
RoutingStrategy.Bubble,
|
||||||
|
typeof(RoutedPropertyChangedEventHandler<float>),
|
||||||
|
typeof(DraggableFloat));
|
||||||
|
|
||||||
|
private bool _inCallback;
|
||||||
|
private Point _mouseDragStartPoint;
|
||||||
|
private float _startValue;
|
||||||
|
|
||||||
|
public DraggableFloat()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
}
|
||||||
|
|
||||||
|
public float Value
|
||||||
|
{
|
||||||
|
get => (float) GetValue(ValueProperty);
|
||||||
|
set => SetValue(ValueProperty, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public float StepSize
|
||||||
|
{
|
||||||
|
get => (float) GetValue(StepSizeProperty);
|
||||||
|
set => SetValue(StepSizeProperty, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public event PropertyChangedEventHandler PropertyChanged;
|
||||||
|
|
||||||
|
protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null)
|
||||||
|
{
|
||||||
|
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void FloatPropertyChangedCallback(DependencyObject d, DependencyPropertyChangedEventArgs e)
|
||||||
|
{
|
||||||
|
var draggableFloat = (DraggableFloat) d;
|
||||||
|
if (draggableFloat._inCallback)
|
||||||
|
return;
|
||||||
|
|
||||||
|
draggableFloat._inCallback = true;
|
||||||
|
draggableFloat.OnPropertyChanged(nameof(Value));
|
||||||
|
draggableFloat._inCallback = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void InputMouseDown(object sender, MouseButtonEventArgs e)
|
||||||
|
{
|
||||||
|
_startValue = Value;
|
||||||
|
((IInputElement) sender).CaptureMouse();
|
||||||
|
_mouseDragStartPoint = e.GetPosition((IInputElement) sender);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void InputMouseUp(object sender, MouseButtonEventArgs e)
|
||||||
|
{
|
||||||
|
var position = e.GetPosition((IInputElement) sender);
|
||||||
|
if (position == _mouseDragStartPoint)
|
||||||
|
DisplayInput();
|
||||||
|
|
||||||
|
((IInputElement) sender).ReleaseMouseCapture();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void InputMouseMove(object sender, MouseEventArgs e)
|
||||||
|
{
|
||||||
|
if (e.LeftButton == MouseButtonState.Pressed)
|
||||||
|
{
|
||||||
|
// Use decimals for everything to avoid floating point errors
|
||||||
|
var startValue = new decimal(_startValue);
|
||||||
|
var startX = new decimal(_mouseDragStartPoint.X);
|
||||||
|
var x = new decimal(e.GetPosition((IInputElement) sender).X);
|
||||||
|
var stepSize = new decimal(StepSize);
|
||||||
|
|
||||||
|
Value = (float) (Math.Round(startValue + stepSize * (x - startX) / stepSize) * stepSize);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void InputLostFocus(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
DisplayDragHandle();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void InputKeyDown(object sender, KeyEventArgs e)
|
||||||
|
{
|
||||||
|
if (e.Key == Key.Enter)
|
||||||
|
DisplayDragHandle();
|
||||||
|
else if (e.Key == Key.Escape)
|
||||||
|
{
|
||||||
|
Input.Text = _startValue.ToString();
|
||||||
|
DisplayDragHandle();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void DisplayInput()
|
||||||
|
{
|
||||||
|
DragHandle.Visibility = Visibility.Collapsed;
|
||||||
|
Input.Visibility = Visibility.Visible;
|
||||||
|
Input.Focus();
|
||||||
|
Input.SelectAll();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void DisplayDragHandle()
|
||||||
|
{
|
||||||
|
Input.Visibility = Visibility.Collapsed;
|
||||||
|
DragHandle.Visibility = Visibility.Visible;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Input_OnRequestBringIntoView(object sender, RequestBringIntoViewEventArgs e)
|
||||||
|
{
|
||||||
|
e.Handled = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,4 +1,5 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
|
||||||
<packages>
|
<packages>
|
||||||
<package id="Humanizer.Core" version="2.7.9" targetFramework="net472" />
|
<package id="Humanizer.Core" version="2.7.9" targetFramework="net472" />
|
||||||
<package id="MaterialDesignColors" version="1.2.0" targetFramework="net472" />
|
<package id="MaterialDesignColors" version="1.2.0" targetFramework="net472" />
|
||||||
|
|||||||
@ -100,8 +100,8 @@
|
|||||||
<Reference Include="SkiaSharp.Views.WPF, Version=1.68.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756, processorArchitecture=MSIL">
|
<Reference Include="SkiaSharp.Views.WPF, Version=1.68.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\SkiaSharp.Views.WPF.1.68.2-preview.29\lib\net45\SkiaSharp.Views.WPF.dll</HintPath>
|
<HintPath>..\packages\SkiaSharp.Views.WPF.1.68.2-preview.29\lib\net45\SkiaSharp.Views.WPF.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="Stylet, Version=1.3.0.0, Culture=neutral, processorArchitecture=MSIL">
|
<Reference Include="Stylet, Version=1.3.1.0, Culture=neutral, processorArchitecture=MSIL">
|
||||||
<HintPath>..\packages\Stylet.1.3.0\lib\net45\Stylet.dll</HintPath>
|
<HintPath>..\packages\Stylet.1.3.1\lib\net45\Stylet.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="System" />
|
<Reference Include="System" />
|
||||||
<Reference Include="System.Buffers, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
<Reference Include="System.Buffers, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||||
|
|||||||
@ -59,11 +59,6 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.LayerProperties.PropertyTree.P
|
|||||||
NotifyOfPropertyChange(() => BrushInputValue);
|
NotifyOfPropertyChange(() => BrushInputValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void ApplyInputDrag(object startValue, double dragDistance)
|
|
||||||
{
|
|
||||||
throw new NotImplementedException();
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void OnInitialized()
|
protected override void OnInitialized()
|
||||||
{
|
{
|
||||||
UpdateEnumValues();
|
UpdateEnumValues();
|
||||||
|
|||||||
@ -27,11 +27,6 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.LayerProperties.PropertyTree.P
|
|||||||
NotifyOfPropertyChange(() => EnumInputValue);
|
NotifyOfPropertyChange(() => EnumInputValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void ApplyInputDrag(object startValue, double dragDistance)
|
|
||||||
{
|
|
||||||
throw new NotImplementedException();
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void OnInitialized()
|
protected override void OnInitialized()
|
||||||
{
|
{
|
||||||
EnumValues = EnumUtilities.GetAllValuesAndDescriptions(LayerPropertyViewModel.LayerProperty.Type);
|
EnumValues = EnumUtilities.GetAllValuesAndDescriptions(LayerPropertyViewModel.LayerProperty.Type);
|
||||||
|
|||||||
@ -4,47 +4,14 @@
|
|||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
xmlns:local="clr-namespace:Artemis.UI.Screens.Module.ProfileEditor.LayerProperties.PropertyTree.PropertyInput"
|
xmlns:local="clr-namespace:Artemis.UI.Screens.Module.ProfileEditor.LayerProperties.PropertyTree.PropertyInput"
|
||||||
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
|
|
||||||
xmlns:s="https://github.com/canton7/Stylet"
|
xmlns:s="https://github.com/canton7/Stylet"
|
||||||
|
xmlns:shared="clr-namespace:Artemis.UI.Shared;assembly=Artemis.UI.Shared"
|
||||||
mc:Ignorable="d"
|
mc:Ignorable="d"
|
||||||
d:DesignHeight="450" d:DesignWidth="800"
|
d:DesignHeight="450" d:DesignWidth="800"
|
||||||
d:DataContext="{d:DesignInstance local:FloatPropertyInputViewModel}">
|
d:DataContext="{d:DesignInstance local:FloatPropertyInputViewModel}">
|
||||||
<StackPanel Orientation="Horizontal">
|
<StackPanel Orientation="Horizontal">
|
||||||
<TextBlock Margin="0 0 5 4" Width="10" VerticalAlignment="Bottom" Text="{Binding LayerPropertyViewModel.LayerProperty.InputPrefix}" />
|
<TextBlock Margin="0 0 5 4" Width="10" VerticalAlignment="Bottom" Text="{Binding LayerPropertyViewModel.LayerProperty.InputPrefix}" />
|
||||||
<!-- Drag handle -->
|
<shared:DraggableFloat Value="{Binding FloatInputValue}" StepSize="{Binding LayerPropertyViewModel.LayerProperty.InputStepSize}" />
|
||||||
<Border BorderThickness="0,0,0,1" Margin="0 2">
|
|
||||||
<Border.BorderBrush>
|
|
||||||
<VisualBrush>
|
|
||||||
<VisualBrush.Visual>
|
|
||||||
<Rectangle StrokeDashArray="2 2" Stroke="{DynamicResource SecondaryAccentBrush}" StrokeThickness="1"
|
|
||||||
Width="{Binding RelativeSource={RelativeSource AncestorType={x:Type Border}}, Path=ActualWidth}"
|
|
||||||
Height="{Binding RelativeSource={RelativeSource AncestorType={x:Type Border}}, Path=ActualHeight}"/>
|
|
||||||
</VisualBrush.Visual>
|
|
||||||
</VisualBrush>
|
|
||||||
</Border.BorderBrush>
|
|
||||||
<TextBlock Width="60"
|
|
||||||
Padding="2 0"
|
|
||||||
Margin="0 2 0 0"
|
|
||||||
Text="{Binding FloatInputValue}"
|
|
||||||
Cursor="/Resources/aero_drag_ew.cur"
|
|
||||||
Foreground="{DynamicResource SecondaryAccentBrush}"
|
|
||||||
Visibility="{Binding InputFieldEnabled, Converter={x:Static s:BoolToVisibilityConverter.InverseInstance}, Mode=OneWay}"
|
|
||||||
MouseDown="{s:Action InputMouseDown}"
|
|
||||||
MouseUp="{s:Action InputMouseUp}"
|
|
||||||
MouseMove="{s:Action InputMouseMove}" />
|
|
||||||
</Border>
|
|
||||||
|
|
||||||
<!-- Input -->
|
|
||||||
<TextBox Width="60"
|
|
||||||
Margin="0 2"
|
|
||||||
Padding="0 -1"
|
|
||||||
materialDesign:ValidationAssist.UsePopup="True"
|
|
||||||
HorizontalAlignment="Left"
|
|
||||||
Text="{Binding FloatInputValue}"
|
|
||||||
Visibility="{Binding InputFieldEnabled, Converter={StaticResource BoolToVisibilityConverter}, Mode=OneWay}"
|
|
||||||
LostFocus="{s:Action InputLostFocus}"
|
|
||||||
KeyDown="{s:Action InputKeyDown}"
|
|
||||||
IsVisibleChanged="{s:Action InputIsVisibleChanged}" />
|
|
||||||
<TextBlock Margin="5 0 0 4" Width="10" VerticalAlignment="Bottom" Text="{Binding LayerPropertyViewModel.LayerProperty.InputAffix}" />
|
<TextBlock Margin="5 0 0 4" Width="10" VerticalAlignment="Bottom" Text="{Binding LayerPropertyViewModel.LayerProperty.InputAffix}" />
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</UserControl>
|
</UserControl>
|
||||||
@ -16,7 +16,7 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.LayerProperties.PropertyTree.P
|
|||||||
public float FloatInputValue
|
public float FloatInputValue
|
||||||
{
|
{
|
||||||
get => (float?) InputValue ?? 0f;
|
get => (float?) InputValue ?? 0f;
|
||||||
set => InputValue = value;
|
set => InputValue = ApplyInputValue(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Update()
|
public override void Update()
|
||||||
@ -24,10 +24,16 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.LayerProperties.PropertyTree.P
|
|||||||
NotifyOfPropertyChange(() => FloatInputValue);
|
NotifyOfPropertyChange(() => FloatInputValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void ApplyInputDrag(object startValue, double dragDistance)
|
private float ApplyInputValue(float value)
|
||||||
{
|
{
|
||||||
var floatStartValue = (float) startValue;
|
if (LayerPropertyViewModel.LayerProperty.MaxInputValue != null &&
|
||||||
FloatInputValue = (float) (floatStartValue + dragDistance);
|
LayerPropertyViewModel.LayerProperty.MaxInputValue is float maxFloat)
|
||||||
|
value = Math.Min(value, maxFloat);
|
||||||
|
if (LayerPropertyViewModel.LayerProperty.MinInputValue != null &&
|
||||||
|
LayerPropertyViewModel.LayerProperty.MinInputValue is float minFloat)
|
||||||
|
value = Math.Max(value, minFloat);
|
||||||
|
|
||||||
|
return value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -6,17 +6,13 @@
|
|||||||
xmlns:local="clr-namespace:Artemis.UI.Screens.Module.ProfileEditor.LayerProperties.PropertyTree.PropertyInput"
|
xmlns:local="clr-namespace:Artemis.UI.Screens.Module.ProfileEditor.LayerProperties.PropertyTree.PropertyInput"
|
||||||
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
|
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
|
||||||
xmlns:s="https://github.com/canton7/Stylet"
|
xmlns:s="https://github.com/canton7/Stylet"
|
||||||
|
xmlns:shared="clr-namespace:Artemis.UI.Shared;assembly=Artemis.UI.Shared"
|
||||||
mc:Ignorable="d"
|
mc:Ignorable="d"
|
||||||
d:DesignHeight="450" d:DesignWidth="800"
|
d:DesignHeight="450" d:DesignWidth="800"
|
||||||
d:DataContext="{d:DesignInstance local:IntPropertyInputViewModel}">
|
d:DataContext="{d:DesignInstance local:IntPropertyInputViewModel}">
|
||||||
<StackPanel Orientation="Horizontal">
|
<StackPanel Orientation="Horizontal">
|
||||||
<TextBlock Margin="0 0 5 4" Width="10" VerticalAlignment="Bottom" Text="{Binding LayerPropertyViewModel.LayerProperty.InputPrefix}" />
|
<TextBlock Margin="0 0 5 4" Width="10" VerticalAlignment="Bottom" Text="{Binding LayerPropertyViewModel.LayerProperty.InputPrefix}" />
|
||||||
<TextBox Width="60"
|
<shared:DraggableFloat Value="{Binding IntInputValue}" StepSize="{Binding LayerPropertyViewModel.LayerProperty.InputStepSize}" />
|
||||||
Margin="0 2"
|
|
||||||
Padding="0 -1"
|
|
||||||
materialDesign:ValidationAssist.UsePopup="True"
|
|
||||||
HorizontalAlignment="Left"
|
|
||||||
Text="{Binding IntInputValue}" />
|
|
||||||
<TextBlock Margin="5 0 0 4" Width="10" VerticalAlignment="Bottom" Text="{Binding LayerPropertyViewModel.LayerProperty.InputAffix}" />
|
<TextBlock Margin="5 0 0 4" Width="10" VerticalAlignment="Bottom" Text="{Binding LayerPropertyViewModel.LayerProperty.InputAffix}" />
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</UserControl>
|
</UserControl>
|
||||||
@ -15,7 +15,7 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.LayerProperties.PropertyTree.P
|
|||||||
public int IntInputValue
|
public int IntInputValue
|
||||||
{
|
{
|
||||||
get => (int?) InputValue ?? 0;
|
get => (int?) InputValue ?? 0;
|
||||||
set => InputValue = value;
|
set => InputValue = ApplyInputValue(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Update()
|
public override void Update()
|
||||||
@ -23,9 +23,16 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.LayerProperties.PropertyTree.P
|
|||||||
NotifyOfPropertyChange(() => IntInputValue);
|
NotifyOfPropertyChange(() => IntInputValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void ApplyInputDrag(object startValue, double dragDistance)
|
private int ApplyInputValue(int value)
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
if (LayerPropertyViewModel.LayerProperty.MaxInputValue != null &&
|
||||||
|
LayerPropertyViewModel.LayerProperty.MaxInputValue is int maxInt)
|
||||||
|
value = Math.Min(value, maxInt);
|
||||||
|
if (LayerPropertyViewModel.LayerProperty.MinInputValue != null &&
|
||||||
|
LayerPropertyViewModel.LayerProperty.MinInputValue is int minInt)
|
||||||
|
value = Math.Max(value, minInt);
|
||||||
|
|
||||||
|
return value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1,8 +1,5 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Windows;
|
|
||||||
using System.Windows.Controls;
|
|
||||||
using System.Windows.Input;
|
|
||||||
using Artemis.UI.Exceptions;
|
using Artemis.UI.Exceptions;
|
||||||
using Artemis.UI.Services.Interfaces;
|
using Artemis.UI.Services.Interfaces;
|
||||||
using Stylet;
|
using Stylet;
|
||||||
@ -21,7 +18,6 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.LayerProperties.PropertyTree.P
|
|||||||
|
|
||||||
public bool Initialized { get; private set; }
|
public bool Initialized { get; private set; }
|
||||||
public LayerPropertyViewModel LayerPropertyViewModel { get; private set; }
|
public LayerPropertyViewModel LayerPropertyViewModel { get; private set; }
|
||||||
public bool InputFieldEnabled { get; set; }
|
|
||||||
|
|
||||||
protected object InputValue
|
protected object InputValue
|
||||||
{
|
{
|
||||||
@ -50,8 +46,6 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.LayerProperties.PropertyTree.P
|
|||||||
|
|
||||||
public abstract void Update();
|
public abstract void Update();
|
||||||
|
|
||||||
public abstract void ApplyInputDrag(object startValue, double dragDistance);
|
|
||||||
|
|
||||||
protected virtual void OnInitialized()
|
protected virtual void OnInitialized()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@ -64,70 +58,5 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.LayerProperties.PropertyTree.P
|
|||||||
|
|
||||||
ProfileEditorService.UpdateSelectedProfileElement();
|
ProfileEditorService.UpdateSelectedProfileElement();
|
||||||
}
|
}
|
||||||
|
|
||||||
#region Mouse-based mutations
|
|
||||||
|
|
||||||
private Point _mouseDragStartPoint;
|
|
||||||
private object _startValue;
|
|
||||||
|
|
||||||
// ReSharper disable once UnusedMember.Global - Called from view
|
|
||||||
public void InputMouseDown(object sender, MouseButtonEventArgs e)
|
|
||||||
{
|
|
||||||
_startValue = InputValue;
|
|
||||||
((IInputElement) sender).CaptureMouse();
|
|
||||||
_mouseDragStartPoint = e.GetPosition((IInputElement) sender);
|
|
||||||
}
|
|
||||||
|
|
||||||
// ReSharper disable once UnusedMember.Global - Called from view
|
|
||||||
public void InputMouseUp(object sender, MouseEventArgs e)
|
|
||||||
{
|
|
||||||
var position = e.GetPosition((IInputElement) sender);
|
|
||||||
if (position == _mouseDragStartPoint)
|
|
||||||
InputFieldEnabled = true;
|
|
||||||
|
|
||||||
((IInputElement) sender).ReleaseMouseCapture();
|
|
||||||
}
|
|
||||||
|
|
||||||
// ReSharper disable once UnusedMember.Global - Called from view
|
|
||||||
public void InputMouseMove(object sender, MouseEventArgs e)
|
|
||||||
{
|
|
||||||
if (e.LeftButton == MouseButtonState.Pressed)
|
|
||||||
{
|
|
||||||
var position = e.GetPosition((IInputElement) sender);
|
|
||||||
ApplyInputDrag(_startValue, position.X - _mouseDragStartPoint.X);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// ReSharper disable once UnusedMember.Global - Called from view
|
|
||||||
public void InputIsVisibleChanged(object sender, DependencyPropertyChangedEventArgs e)
|
|
||||||
{
|
|
||||||
if (InputFieldEnabled)
|
|
||||||
{
|
|
||||||
((UIElement) sender).Focus();
|
|
||||||
if (sender is TextBox textBox)
|
|
||||||
textBox.SelectAll();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// ReSharper disable once UnusedMember.Global - Called from view
|
|
||||||
public void InputLostFocus(object sender, RoutedEventArgs e)
|
|
||||||
{
|
|
||||||
InputFieldEnabled = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// ReSharper disable once UnusedMember.Global - Called from view
|
|
||||||
public void InputKeyDown(object sender, KeyEventArgs e)
|
|
||||||
{
|
|
||||||
if (e.Key == Key.Enter)
|
|
||||||
InputFieldEnabled = false;
|
|
||||||
else if (e.Key == Key.Escape)
|
|
||||||
{
|
|
||||||
if (sender is TextBox textBox)
|
|
||||||
textBox.Text = _startValue.ToString();
|
|
||||||
InputFieldEnabled = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -23,10 +23,5 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.LayerProperties.PropertyTree.P
|
|||||||
{
|
{
|
||||||
NotifyOfPropertyChange(() => SKColorInputValue);
|
NotifyOfPropertyChange(() => SKColorInputValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void ApplyInputDrag(object startValue, double dragDistance)
|
|
||||||
{
|
|
||||||
throw new NotImplementedException();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -6,26 +6,19 @@
|
|||||||
xmlns:local="clr-namespace:Artemis.UI.Screens.Module.ProfileEditor.LayerProperties.PropertyTree.PropertyInput"
|
xmlns:local="clr-namespace:Artemis.UI.Screens.Module.ProfileEditor.LayerProperties.PropertyTree.PropertyInput"
|
||||||
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
|
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
|
||||||
xmlns:s="https://github.com/canton7/Stylet"
|
xmlns:s="https://github.com/canton7/Stylet"
|
||||||
|
xmlns:shared="clr-namespace:Artemis.UI.Shared;assembly=Artemis.UI.Shared"
|
||||||
mc:Ignorable="d"
|
mc:Ignorable="d"
|
||||||
d:DesignHeight="25" d:DesignWidth="800"
|
d:DesignHeight="25" d:DesignWidth="800"
|
||||||
d:DataContext="{d:DesignInstance local:SKPointPropertyInputViewModel}">
|
d:DataContext="{d:DesignInstance local:SKPointPropertyInputViewModel}">
|
||||||
<StackPanel Orientation="Horizontal" KeyboardNavigation.IsTabStop="True">
|
<StackPanel Orientation="Horizontal" KeyboardNavigation.IsTabStop="True">
|
||||||
<TextBlock Margin="0 0 5 4" Width="10" VerticalAlignment="Bottom" Text="{Binding LayerPropertyViewModel.LayerProperty.InputPrefix}" />
|
<TextBlock Margin="0 0 5 4" Width="10" VerticalAlignment="Bottom" Text="{Binding LayerPropertyViewModel.LayerProperty.InputPrefix}" />
|
||||||
<TextBox Width="60"
|
<shared:DraggableFloat ToolTip="X-coordinate (horizontal)"
|
||||||
Margin="0 2"
|
Value="{Binding X}"
|
||||||
Padding="0 -1"
|
StepSize="{Binding LayerPropertyViewModel.LayerProperty.InputStepSize}" />
|
||||||
materialDesign:ValidationAssist.UsePopup="True"
|
|
||||||
HorizontalAlignment="Left"
|
|
||||||
ToolTip="X-coordinate (horizontal)"
|
|
||||||
Text="{Binding X}" />
|
|
||||||
<TextBlock Margin="5 0" VerticalAlignment="Bottom">,</TextBlock>
|
<TextBlock Margin="5 0" VerticalAlignment="Bottom">,</TextBlock>
|
||||||
<TextBox Width="60"
|
<shared:DraggableFloat ToolTip="Y-coordinate (vertical)"
|
||||||
Margin="0 2"
|
Value="{Binding Y}"
|
||||||
Padding="0 -1"
|
StepSize="{Binding LayerPropertyViewModel.LayerProperty.InputStepSize}" />
|
||||||
materialDesign:ValidationAssist.UsePopup="True"
|
|
||||||
HorizontalAlignment="Left"
|
|
||||||
ToolTip="Y-coordinate (vertical)"
|
|
||||||
Text="{Binding Y}" />
|
|
||||||
<TextBlock Margin="5 0 0 4" Width="10" VerticalAlignment="Bottom" Text="{Binding LayerPropertyViewModel.LayerProperty.InputAffix}" />
|
<TextBlock Margin="5 0 0 4" Width="10" VerticalAlignment="Bottom" Text="{Binding LayerPropertyViewModel.LayerProperty.InputAffix}" />
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</UserControl>
|
</UserControl>
|
||||||
@ -19,14 +19,14 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.LayerProperties.PropertyTree.P
|
|||||||
public float X
|
public float X
|
||||||
{
|
{
|
||||||
get => ((SKPoint?) InputValue)?.X ?? 0;
|
get => ((SKPoint?) InputValue)?.X ?? 0;
|
||||||
set => InputValue = new SKPoint(value, Y);
|
set => InputValue = new SKPoint(ApplyInputValue(value), Y);
|
||||||
}
|
}
|
||||||
|
|
||||||
[DependsOn(nameof(InputValue))]
|
[DependsOn(nameof(InputValue))]
|
||||||
public float Y
|
public float Y
|
||||||
{
|
{
|
||||||
get => ((SKPoint?) InputValue)?.Y ?? 0;
|
get => ((SKPoint?) InputValue)?.Y ?? 0;
|
||||||
set => InputValue = new SKPoint(X, value);
|
set => InputValue = new SKPoint(X, ApplyInputValue(value));
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Update()
|
public override void Update()
|
||||||
@ -35,9 +35,16 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.LayerProperties.PropertyTree.P
|
|||||||
NotifyOfPropertyChange(() => Y);
|
NotifyOfPropertyChange(() => Y);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void ApplyInputDrag(object startValue, double dragDistance)
|
private float ApplyInputValue(float value)
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
if (LayerPropertyViewModel.LayerProperty.MaxInputValue != null &&
|
||||||
|
LayerPropertyViewModel.LayerProperty.MaxInputValue is float maxFloat)
|
||||||
|
value = Math.Min(value, maxFloat);
|
||||||
|
if (LayerPropertyViewModel.LayerProperty.MinInputValue != null &&
|
||||||
|
LayerPropertyViewModel.LayerProperty.MinInputValue is float minFloat)
|
||||||
|
value = Math.Max(value, minFloat);
|
||||||
|
|
||||||
|
return value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -6,26 +6,15 @@
|
|||||||
xmlns:local="clr-namespace:Artemis.UI.Screens.Module.ProfileEditor.LayerProperties.PropertyTree.PropertyInput"
|
xmlns:local="clr-namespace:Artemis.UI.Screens.Module.ProfileEditor.LayerProperties.PropertyTree.PropertyInput"
|
||||||
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
|
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
|
||||||
xmlns:s="https://github.com/canton7/Stylet"
|
xmlns:s="https://github.com/canton7/Stylet"
|
||||||
|
xmlns:shared="clr-namespace:Artemis.UI.Shared;assembly=Artemis.UI.Shared"
|
||||||
mc:Ignorable="d"
|
mc:Ignorable="d"
|
||||||
d:DesignHeight="450" d:DesignWidth="800"
|
d:DesignHeight="450" d:DesignWidth="800"
|
||||||
d:DataContext="{d:DesignInstance local:SKSizePropertyInputViewModel}">
|
d:DataContext="{d:DesignInstance local:SKSizePropertyInputViewModel}">
|
||||||
<StackPanel Orientation="Horizontal">
|
<StackPanel Orientation="Horizontal">
|
||||||
<TextBlock Margin="0 0 5 4" Width="10" VerticalAlignment="Bottom" Text="{Binding LayerPropertyViewModel.LayerProperty.InputPrefix}" />
|
<TextBlock Margin="0 0 5 4" Width="10" VerticalAlignment="Bottom" Text="{Binding LayerPropertyViewModel.LayerProperty.InputPrefix}" />
|
||||||
<TextBox Width="60"
|
<shared:DraggableFloat ToolTip="Height" Value="{Binding Height}" StepSize="{Binding LayerPropertyViewModel.LayerProperty.InputStepSize}" />
|
||||||
Margin="0 2"
|
|
||||||
Padding="0 -1"
|
|
||||||
materialDesign:ValidationAssist.UsePopup="True"
|
|
||||||
HorizontalAlignment="Left"
|
|
||||||
ToolTip="Height"
|
|
||||||
Text="{Binding Height}" />
|
|
||||||
<TextBlock Margin="5 0" VerticalAlignment="Bottom">,</TextBlock>
|
<TextBlock Margin="5 0" VerticalAlignment="Bottom">,</TextBlock>
|
||||||
<TextBox Width="60"
|
<shared:DraggableFloat ToolTip="Width" Value="{Binding Width}" StepSize="{Binding LayerPropertyViewModel.LayerProperty.InputStepSize}" />
|
||||||
Margin="0 2"
|
|
||||||
Padding="0 -1"
|
|
||||||
materialDesign:ValidationAssist.UsePopup="True"
|
|
||||||
HorizontalAlignment="Left"
|
|
||||||
ToolTip="Width"
|
|
||||||
Text="{Binding Width}" />
|
|
||||||
<TextBlock Margin="5 0 0 4" Width="10" VerticalAlignment="Bottom" Text="{Binding LayerPropertyViewModel.LayerProperty.InputAffix}" />
|
<TextBlock Margin="5 0 0 4" Width="10" VerticalAlignment="Bottom" Text="{Binding LayerPropertyViewModel.LayerProperty.InputAffix}" />
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</UserControl>
|
</UserControl>
|
||||||
@ -19,14 +19,14 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.LayerProperties.PropertyTree.P
|
|||||||
public float Width
|
public float Width
|
||||||
{
|
{
|
||||||
get => ((SKSize?) InputValue)?.Width ?? 0;
|
get => ((SKSize?) InputValue)?.Width ?? 0;
|
||||||
set => InputValue = new SKSize(value, Height);
|
set => InputValue = new SKSize(ApplyInputValue(value), Height);
|
||||||
}
|
}
|
||||||
|
|
||||||
[DependsOn(nameof(InputValue))]
|
[DependsOn(nameof(InputValue))]
|
||||||
public float Height
|
public float Height
|
||||||
{
|
{
|
||||||
get => ((SKSize?) InputValue)?.Height ?? 0;
|
get => ((SKSize?) InputValue)?.Height ?? 0;
|
||||||
set => InputValue = new SKSize(Width, value);
|
set => InputValue = new SKSize(Width, ApplyInputValue(value));
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Update()
|
public override void Update()
|
||||||
@ -35,9 +35,16 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.LayerProperties.PropertyTree.P
|
|||||||
NotifyOfPropertyChange(() => Height);
|
NotifyOfPropertyChange(() => Height);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void ApplyInputDrag(object startValue, double dragDistance)
|
private float ApplyInputValue(float value)
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
if (LayerPropertyViewModel.LayerProperty.MaxInputValue != null &&
|
||||||
|
LayerPropertyViewModel.LayerProperty.MaxInputValue is float maxFloat)
|
||||||
|
value = Math.Min(value, maxFloat);
|
||||||
|
if (LayerPropertyViewModel.LayerProperty.MinInputValue != null &&
|
||||||
|
LayerPropertyViewModel.LayerProperty.MinInputValue is float minFloat)
|
||||||
|
value = Math.Max(value, minFloat);
|
||||||
|
|
||||||
|
return value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2,14 +2,10 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
using System.Windows.Controls;
|
|
||||||
using System.Windows.Input;
|
using System.Windows.Input;
|
||||||
using System.Windows.Media;
|
using System.Windows.Media;
|
||||||
using System.Windows.Shapes;
|
using System.Windows.Shapes;
|
||||||
using Artemis.Core.Models.Surface;
|
|
||||||
using Artemis.UI.Ninject.Factories;
|
using Artemis.UI.Ninject.Factories;
|
||||||
using Artemis.UI.Screens.SurfaceEditor;
|
|
||||||
using Artemis.UI.Screens.SurfaceEditor.Visualization;
|
|
||||||
using Artemis.UI.Services.Interfaces;
|
using Artemis.UI.Services.Interfaces;
|
||||||
using Stylet;
|
using Stylet;
|
||||||
|
|
||||||
@ -99,9 +95,37 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.LayerProperties.Timeline
|
|||||||
UpdateEndTime();
|
UpdateEndTime();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#region Keyframe movement
|
||||||
|
|
||||||
|
public void MoveSelectedKeyframes(TimeSpan offset)
|
||||||
|
{
|
||||||
|
var keyframeViewModels = PropertyTrackViewModels.SelectMany(t => t.KeyframeViewModels.OrderBy(k => k.Keyframe.Position)).ToList();
|
||||||
|
foreach (var keyframeViewModel in keyframeViewModels.Where(k => k.IsSelected))
|
||||||
|
{
|
||||||
|
// TODO: Not ideal as this stacks them all if they get to 0, oh well
|
||||||
|
if (keyframeViewModel.Keyframe.Position + offset > TimeSpan.Zero)
|
||||||
|
{
|
||||||
|
keyframeViewModel.Keyframe.Position += offset;
|
||||||
|
keyframeViewModel.Update(LayerPropertiesViewModel.PixelsPerSecond);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
_profileEditorService.UpdateProfilePreview();
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
private void CreateViewModels(LayerPropertyViewModel property)
|
||||||
|
{
|
||||||
|
PropertyTrackViewModels.Add(_propertyTrackVmFactory.Create(this, property));
|
||||||
|
foreach (var child in property.Children)
|
||||||
|
CreateViewModels(child);
|
||||||
|
}
|
||||||
|
|
||||||
#region Keyframe selection
|
#region Keyframe selection
|
||||||
|
|
||||||
private Point _mouseDragStartPoint;
|
private Point _mouseDragStartPoint;
|
||||||
|
private bool _mouseDragging;
|
||||||
|
|
||||||
// ReSharper disable once UnusedMember.Global - Called from view
|
// ReSharper disable once UnusedMember.Global - Called from view
|
||||||
public void TimelineCanvasMouseDown(object sender, MouseButtonEventArgs e)
|
public void TimelineCanvasMouseDown(object sender, MouseButtonEventArgs e)
|
||||||
@ -110,12 +134,17 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.LayerProperties.Timeline
|
|||||||
|
|
||||||
SelectionRectangle.Rect = new Rect();
|
SelectionRectangle.Rect = new Rect();
|
||||||
_mouseDragStartPoint = e.GetPosition((IInputElement) sender);
|
_mouseDragStartPoint = e.GetPosition((IInputElement) sender);
|
||||||
|
_mouseDragging = true;
|
||||||
|
e.Handled = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ReSharper disable once UnusedMember.Global - Called from view
|
// ReSharper disable once UnusedMember.Global - Called from view
|
||||||
public void TimelineCanvasMouseUp(object sender, MouseEventArgs e)
|
public void TimelineCanvasMouseUp(object sender, MouseEventArgs e)
|
||||||
{
|
{
|
||||||
var position = e.GetPosition((IInputElement)sender);
|
if (!_mouseDragging)
|
||||||
|
return;
|
||||||
|
|
||||||
|
var position = e.GetPosition((IInputElement) sender);
|
||||||
var selectedRect = new Rect(_mouseDragStartPoint, position);
|
var selectedRect = new Rect(_mouseDragStartPoint, position);
|
||||||
SelectionRectangle.Rect = selectedRect;
|
SelectionRectangle.Rect = selectedRect;
|
||||||
|
|
||||||
@ -130,21 +159,24 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.LayerProperties.Timeline
|
|||||||
return HitTestFilterBehavior.Continue;
|
return HitTestFilterBehavior.Continue;
|
||||||
});
|
});
|
||||||
VisualTreeHelper.HitTest((Visual) sender, filterCallback, resultCallback, hitTestParams);
|
VisualTreeHelper.HitTest((Visual) sender, filterCallback, resultCallback, hitTestParams);
|
||||||
|
|
||||||
var keyframeViewModels = PropertyTrackViewModels.SelectMany(t => t.KeyframeViewModels.OrderBy(k => k.Keyframe.Position)).ToList();
|
var keyframeViewModels = PropertyTrackViewModels.SelectMany(t => t.KeyframeViewModels.OrderBy(k => k.Keyframe.Position)).ToList();
|
||||||
foreach (var keyframeViewModel in keyframeViewModels)
|
foreach (var keyframeViewModel in keyframeViewModels)
|
||||||
keyframeViewModel.IsSelected = selectedKeyframes.Contains(keyframeViewModel);
|
keyframeViewModel.IsSelected = selectedKeyframes.Contains(keyframeViewModel);
|
||||||
|
|
||||||
|
_mouseDragging = false;
|
||||||
|
e.Handled = true;
|
||||||
((IInputElement) sender).ReleaseMouseCapture();
|
((IInputElement) sender).ReleaseMouseCapture();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void TimelineCanvasMouseMove(object sender, MouseEventArgs e)
|
public void TimelineCanvasMouseMove(object sender, MouseEventArgs e)
|
||||||
{
|
{
|
||||||
if (e.LeftButton == MouseButtonState.Pressed)
|
if (_mouseDragging && e.LeftButton == MouseButtonState.Pressed)
|
||||||
{
|
{
|
||||||
var position = e.GetPosition((IInputElement) sender);
|
var position = e.GetPosition((IInputElement) sender);
|
||||||
var selectedRect = new Rect(_mouseDragStartPoint, position);
|
var selectedRect = new Rect(_mouseDragStartPoint, position);
|
||||||
SelectionRectangle.Rect = selectedRect;
|
SelectionRectangle.Rect = selectedRect;
|
||||||
|
e.Handled = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -191,32 +223,5 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.LayerProperties.Timeline
|
|||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Keyframe movement
|
|
||||||
|
|
||||||
public void MoveSelectedKeyframes(TimeSpan offset)
|
|
||||||
{
|
|
||||||
var keyframeViewModels = PropertyTrackViewModels.SelectMany(t => t.KeyframeViewModels.OrderBy(k => k.Keyframe.Position)).ToList();
|
|
||||||
foreach (var keyframeViewModel in keyframeViewModels.Where(k => k.IsSelected))
|
|
||||||
{
|
|
||||||
// TODO: Not ideal as this stacks them all if they get to 0, oh well
|
|
||||||
if (keyframeViewModel.Keyframe.Position + offset > TimeSpan.Zero)
|
|
||||||
{
|
|
||||||
keyframeViewModel.Keyframe.Position += offset;
|
|
||||||
keyframeViewModel.Update(LayerPropertiesViewModel.PixelsPerSecond);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
_profileEditorService.UpdateProfilePreview();
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
private void CreateViewModels(LayerPropertyViewModel property)
|
|
||||||
{
|
|
||||||
PropertyTrackViewModels.Add(_propertyTrackVmFactory.Create(this, property));
|
|
||||||
foreach (var child in property.Children)
|
|
||||||
CreateViewModels(child);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -48,6 +48,8 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.LayerProperties.Timeline
|
|||||||
{
|
{
|
||||||
if (e.LeftButton == MouseButtonState.Released)
|
if (e.LeftButton == MouseButtonState.Released)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
((IInputElement)sender).CaptureMouse();
|
||||||
if (Keyboard.IsKeyDown(Key.LeftShift) || Keyboard.IsKeyDown(Key.RightShift) && !IsSelected)
|
if (Keyboard.IsKeyDown(Key.LeftShift) || Keyboard.IsKeyDown(Key.RightShift) && !IsSelected)
|
||||||
PropertyTrackViewModel.PropertyTimelineViewModel.SelectKeyframe(this, true, false);
|
PropertyTrackViewModel.PropertyTimelineViewModel.SelectKeyframe(this, true, false);
|
||||||
else if (Keyboard.IsKeyDown(Key.LeftCtrl) || Keyboard.IsKeyDown(Key.RightCtrl))
|
else if (Keyboard.IsKeyDown(Key.LeftCtrl) || Keyboard.IsKeyDown(Key.RightCtrl))
|
||||||
@ -55,16 +57,14 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.LayerProperties.Timeline
|
|||||||
else if (!IsSelected)
|
else if (!IsSelected)
|
||||||
PropertyTrackViewModel.PropertyTimelineViewModel.SelectKeyframe(this, false, false);
|
PropertyTrackViewModel.PropertyTimelineViewModel.SelectKeyframe(this, false, false);
|
||||||
|
|
||||||
((IInputElement) sender).CaptureMouse();
|
|
||||||
e.Handled = true;
|
e.Handled = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void KeyframeMouseUp(object sender, MouseButtonEventArgs e)
|
public void KeyframeMouseUp(object sender, MouseButtonEventArgs e)
|
||||||
{
|
{
|
||||||
if (e.LeftButton == MouseButtonState.Released)
|
|
||||||
return;
|
|
||||||
((IInputElement) sender).ReleaseMouseCapture();
|
|
||||||
_profileEditorService.UpdateSelectedProfileElement();
|
_profileEditorService.UpdateSelectedProfileElement();
|
||||||
|
|
||||||
|
((IInputElement)sender).ReleaseMouseCapture();
|
||||||
e.Handled = true;
|
e.Handled = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -95,6 +95,7 @@ namespace Artemis.UI.Screens.Module.ProfileEditor.LayerProperties.Timeline
|
|||||||
|
|
||||||
PropertyTrackViewModel.PropertyTimelineViewModel.MoveSelectedKeyframes(newTime - Keyframe.Position);
|
PropertyTrackViewModel.PropertyTimelineViewModel.MoveSelectedKeyframes(newTime - Keyframe.Position);
|
||||||
}
|
}
|
||||||
|
|
||||||
e.Handled = true;
|
e.Handled = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -46,14 +46,14 @@
|
|||||||
<DataTrigger.EnterActions>
|
<DataTrigger.EnterActions>
|
||||||
<BeginStoryboard>
|
<BeginStoryboard>
|
||||||
<Storyboard>
|
<Storyboard>
|
||||||
<DoubleAnimation Storyboard.TargetProperty="StrokeThickness" To="1" Duration="0:0:0.25"></DoubleAnimation>
|
<DoubleAnimation Storyboard.TargetProperty="StrokeThickness" To="1" Duration="0:0:0.25" />
|
||||||
</Storyboard>
|
</Storyboard>
|
||||||
</BeginStoryboard>
|
</BeginStoryboard>
|
||||||
</DataTrigger.EnterActions>
|
</DataTrigger.EnterActions>
|
||||||
<DataTrigger.ExitActions>
|
<DataTrigger.ExitActions>
|
||||||
<BeginStoryboard>
|
<BeginStoryboard>
|
||||||
<Storyboard>
|
<Storyboard>
|
||||||
<DoubleAnimation Storyboard.TargetProperty="StrokeThickness" To="0" Duration="0:0:0.25"></DoubleAnimation>
|
<DoubleAnimation Storyboard.TargetProperty="StrokeThickness" To="0" Duration="0:0:0.25" />
|
||||||
</Storyboard>
|
</Storyboard>
|
||||||
</BeginStoryboard>
|
</BeginStoryboard>
|
||||||
</DataTrigger.ExitActions>
|
</DataTrigger.ExitActions>
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
|
||||||
<packages>
|
<packages>
|
||||||
<package id="Castle.Core" version="4.4.0" targetFramework="net461" />
|
<package id="Castle.Core" version="4.4.0" targetFramework="net461" />
|
||||||
<package id="FluentValidation" version="8.5.0" targetFramework="net472" />
|
<package id="FluentValidation" version="8.5.0" targetFramework="net472" />
|
||||||
@ -16,7 +17,7 @@
|
|||||||
<package id="SkiaSharp" version="1.68.2-preview.29" targetFramework="net472" />
|
<package id="SkiaSharp" version="1.68.2-preview.29" targetFramework="net472" />
|
||||||
<package id="SkiaSharp.Views.Desktop.Common" version="1.68.2-preview.29" targetFramework="net472" />
|
<package id="SkiaSharp.Views.Desktop.Common" version="1.68.2-preview.29" targetFramework="net472" />
|
||||||
<package id="SkiaSharp.Views.WPF" version="1.68.2-preview.29" targetFramework="net472" />
|
<package id="SkiaSharp.Views.WPF" version="1.68.2-preview.29" targetFramework="net472" />
|
||||||
<package id="Stylet" version="1.3.0" targetFramework="net472" />
|
<package id="Stylet" version="1.3.1" targetFramework="net472" />
|
||||||
<package id="System.Buffers" version="4.5.0" targetFramework="net472" />
|
<package id="System.Buffers" version="4.5.0" targetFramework="net472" />
|
||||||
<package id="System.ComponentModel.Annotations" version="4.6.0" targetFramework="net472" />
|
<package id="System.ComponentModel.Annotations" version="4.6.0" targetFramework="net472" />
|
||||||
<package id="System.Memory" version="4.5.3" targetFramework="net472" />
|
<package id="System.Memory" version="4.5.3" targetFramework="net472" />
|
||||||
|
|||||||
@ -9,6 +9,186 @@
|
|||||||
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/PLACE_ACCESSORHOLDER_ATTRIBUTE_ON_SAME_LINE_EX/@EntryValue">NEVER</s:String>
|
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/PLACE_ACCESSORHOLDER_ATTRIBUTE_ON_SAME_LINE_EX/@EntryValue">NEVER</s:String>
|
||||||
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/PLACE_FIELD_ATTRIBUTE_ON_SAME_LINE_EX/@EntryValue">NEVER</s:String>
|
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/PLACE_FIELD_ATTRIBUTE_ON_SAME_LINE_EX/@EntryValue">NEVER</s:String>
|
||||||
<s:Int64 x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/WRAP_LIMIT/@EntryValue">200</s:Int64>
|
<s:Int64 x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/WRAP_LIMIT/@EntryValue">200</s:Int64>
|
||||||
|
<s:String x:Key="/Default/CodeStyle/CSharpFileLayoutPatterns/Pattern/@EntryValue"><?xml version="1.0" encoding="utf-16"?>
|
||||||
|
<Patterns xmlns="urn:schemas-jetbrains-com:member-reordering-patterns">
|
||||||
|
<TypePattern DisplayName="Non-reorderable types">
|
||||||
|
<TypePattern.Match>
|
||||||
|
<Or>
|
||||||
|
<And>
|
||||||
|
<Kind Is="Interface" />
|
||||||
|
<Or>
|
||||||
|
<HasAttribute Name="System.Runtime.InteropServices.InterfaceTypeAttribute" />
|
||||||
|
<HasAttribute Name="System.Runtime.InteropServices.ComImport" />
|
||||||
|
</Or>
|
||||||
|
</And>
|
||||||
|
<Kind Is="Struct" />
|
||||||
|
<HasAttribute Name="JetBrains.Annotations.NoReorderAttribute" />
|
||||||
|
<HasAttribute Name="JetBrains.Annotations.NoReorder" />
|
||||||
|
</Or>
|
||||||
|
</TypePattern.Match>
|
||||||
|
</TypePattern>
|
||||||
|
<TypePattern DisplayName="xUnit.net Test Classes" RemoveRegions="All">
|
||||||
|
<TypePattern.Match>
|
||||||
|
<And>
|
||||||
|
<Kind Is="Class" />
|
||||||
|
<HasMember>
|
||||||
|
<And>
|
||||||
|
<Kind Is="Method" />
|
||||||
|
<HasAttribute Name="Xunit.FactAttribute" Inherited="True" />
|
||||||
|
</And>
|
||||||
|
</HasMember>
|
||||||
|
</And>
|
||||||
|
</TypePattern.Match>
|
||||||
|
<Entry DisplayName="Setup/Teardown Methods">
|
||||||
|
<Entry.Match>
|
||||||
|
<Or>
|
||||||
|
<Kind Is="Constructor" />
|
||||||
|
<And>
|
||||||
|
<Kind Is="Method" />
|
||||||
|
<ImplementsInterface Name="System.IDisposable" />
|
||||||
|
</And>
|
||||||
|
</Or>
|
||||||
|
</Entry.Match>
|
||||||
|
<Entry.SortBy>
|
||||||
|
<Kind Order="Constructor" />
|
||||||
|
</Entry.SortBy>
|
||||||
|
</Entry>
|
||||||
|
<Entry DisplayName="All other members" />
|
||||||
|
<Entry DisplayName="Test Methods" Priority="100">
|
||||||
|
<Entry.Match>
|
||||||
|
<And>
|
||||||
|
<Kind Is="Method" />
|
||||||
|
<HasAttribute Name="Xunit.FactAttribute" />
|
||||||
|
</And>
|
||||||
|
</Entry.Match>
|
||||||
|
<Entry.SortBy>
|
||||||
|
<Name />
|
||||||
|
</Entry.SortBy>
|
||||||
|
</Entry>
|
||||||
|
</TypePattern>
|
||||||
|
<TypePattern DisplayName="NUnit Test Fixtures" RemoveRegions="All">
|
||||||
|
<TypePattern.Match>
|
||||||
|
<And>
|
||||||
|
<Kind Is="Class" />
|
||||||
|
<HasAttribute Name="NUnit.Framework.TestFixtureAttribute" Inherited="True" />
|
||||||
|
</And>
|
||||||
|
</TypePattern.Match>
|
||||||
|
<Entry DisplayName="Setup/Teardown Methods">
|
||||||
|
<Entry.Match>
|
||||||
|
<And>
|
||||||
|
<Kind Is="Method" />
|
||||||
|
<Or>
|
||||||
|
<HasAttribute Name="NUnit.Framework.SetUpAttribute" Inherited="True" />
|
||||||
|
<HasAttribute Name="NUnit.Framework.TearDownAttribute" Inherited="True" />
|
||||||
|
<HasAttribute Name="NUnit.Framework.FixtureSetUpAttribute" Inherited="True" />
|
||||||
|
<HasAttribute Name="NUnit.Framework.FixtureTearDownAttribute" Inherited="True" />
|
||||||
|
</Or>
|
||||||
|
</And>
|
||||||
|
</Entry.Match>
|
||||||
|
</Entry>
|
||||||
|
<Entry DisplayName="All other members" />
|
||||||
|
<Entry DisplayName="Test Methods" Priority="100">
|
||||||
|
<Entry.Match>
|
||||||
|
<And>
|
||||||
|
<Kind Is="Method" />
|
||||||
|
<HasAttribute Name="NUnit.Framework.TestAttribute" />
|
||||||
|
</And>
|
||||||
|
</Entry.Match>
|
||||||
|
<Entry.SortBy>
|
||||||
|
<Name />
|
||||||
|
</Entry.SortBy>
|
||||||
|
</Entry>
|
||||||
|
</TypePattern>
|
||||||
|
<TypePattern DisplayName="Default Pattern">
|
||||||
|
<Entry DisplayName="Public Delegates" Priority="100">
|
||||||
|
<Entry.Match>
|
||||||
|
<And>
|
||||||
|
<Access Is="Public" />
|
||||||
|
<Kind Is="Delegate" />
|
||||||
|
</And>
|
||||||
|
</Entry.Match>
|
||||||
|
<Entry.SortBy>
|
||||||
|
<Name />
|
||||||
|
</Entry.SortBy>
|
||||||
|
</Entry>
|
||||||
|
<Entry DisplayName="Public Enums" Priority="100">
|
||||||
|
<Entry.Match>
|
||||||
|
<And>
|
||||||
|
<Access Is="Public" />
|
||||||
|
<Kind Is="Enum" />
|
||||||
|
</And>
|
||||||
|
</Entry.Match>
|
||||||
|
<Entry.SortBy>
|
||||||
|
<Name />
|
||||||
|
</Entry.SortBy>
|
||||||
|
</Entry>
|
||||||
|
<Entry DisplayName="Static Fields and Constants">
|
||||||
|
<Entry.Match>
|
||||||
|
<Or>
|
||||||
|
<Kind Is="Constant" />
|
||||||
|
<And>
|
||||||
|
<Kind Is="Field" />
|
||||||
|
<Static />
|
||||||
|
</And>
|
||||||
|
</Or>
|
||||||
|
</Entry.Match>
|
||||||
|
<Entry.SortBy>
|
||||||
|
<Kind Order="Constant Field" />
|
||||||
|
</Entry.SortBy>
|
||||||
|
</Entry>
|
||||||
|
<Entry DisplayName="Fields">
|
||||||
|
<Entry.Match>
|
||||||
|
<And>
|
||||||
|
<Kind Is="Field" />
|
||||||
|
<Not>
|
||||||
|
<Static />
|
||||||
|
</Not>
|
||||||
|
</And>
|
||||||
|
</Entry.Match>
|
||||||
|
<Entry.SortBy>
|
||||||
|
<Readonly />
|
||||||
|
<Name />
|
||||||
|
</Entry.SortBy>
|
||||||
|
</Entry>
|
||||||
|
<Entry DisplayName="Constructors">
|
||||||
|
<Entry.Match>
|
||||||
|
<Kind Is="Constructor" />
|
||||||
|
</Entry.Match>
|
||||||
|
<Entry.SortBy>
|
||||||
|
<Static />
|
||||||
|
</Entry.SortBy>
|
||||||
|
</Entry>
|
||||||
|
<Entry DisplayName="Properties, Indexers">
|
||||||
|
<Entry.Match>
|
||||||
|
<Or>
|
||||||
|
<Kind Is="Property" />
|
||||||
|
<Kind Is="Indexer" />
|
||||||
|
</Or>
|
||||||
|
</Entry.Match>
|
||||||
|
</Entry>
|
||||||
|
<Entry DisplayName="Interface Implementations" Priority="100">
|
||||||
|
<Entry.Match>
|
||||||
|
<And>
|
||||||
|
<Kind Is="Member" />
|
||||||
|
<ImplementsInterface />
|
||||||
|
</And>
|
||||||
|
</Entry.Match>
|
||||||
|
<Entry.SortBy>
|
||||||
|
<ImplementsInterface Immediate="True" />
|
||||||
|
</Entry.SortBy>
|
||||||
|
</Entry>
|
||||||
|
<Entry DisplayName="All other members">
|
||||||
|
<Entry.SortBy>
|
||||||
|
<Access />
|
||||||
|
</Entry.SortBy>
|
||||||
|
</Entry>
|
||||||
|
<Entry DisplayName="Nested Types">
|
||||||
|
<Entry.Match>
|
||||||
|
<Kind Is="Type" />
|
||||||
|
</Entry.Match>
|
||||||
|
</Entry>
|
||||||
|
</TypePattern>
|
||||||
|
</Patterns></s:String>
|
||||||
<s:Boolean x:Key="/Default/CodeStyle/Generate/=Formatting/@KeyIndexDefined">True</s:Boolean>
|
<s:Boolean x:Key="/Default/CodeStyle/Generate/=Formatting/@KeyIndexDefined">True</s:Boolean>
|
||||||
<s:String x:Key="/Default/CodeStyle/Generate/=Formatting/Options/=UseNameOf/@EntryIndexedValue">True</s:String>
|
<s:String x:Key="/Default/CodeStyle/Generate/=Formatting/Options/=UseNameOf/@EntryIndexedValue">True</s:String>
|
||||||
<s:Boolean x:Key="/Default/CodeStyle/Generate/=Implementations/@KeyIndexDefined">True</s:Boolean>
|
<s:Boolean x:Key="/Default/CodeStyle/Generate/=Implementations/@KeyIndexDefined">True</s:Boolean>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user