mirror of
https://github.com/vale981/VoiDPlugins
synced 2025-03-04 16:51:38 -05:00
Rewrite and rename Detail mode / Precision Control
Merged the two classes into one, and renamed plugin
This commit is contained in:
parent
904d2b8e1d
commit
be99524417
5 changed files with 49 additions and 65 deletions
|
@ -1,38 +0,0 @@
|
|||
using OpenTabletDriver.Plugin;
|
||||
using OpenTabletDriver.Plugin.Tablet;
|
||||
using OpenTabletDriver.Plugin.Attributes;
|
||||
using System;
|
||||
using System.Numerics;
|
||||
|
||||
namespace DetailMode
|
||||
{
|
||||
[PluginName("Detail Mode")]
|
||||
public class DetailBinding : IBinding
|
||||
{
|
||||
public string Property { set; get; }
|
||||
public Action Press => (Action) (() =>
|
||||
{
|
||||
DetailFilter.IsActive = !DetailFilter.IsActive;
|
||||
DetailFilter.SetPosition = true;
|
||||
});
|
||||
public Action Release => (Action) (() => DetailFilter.SetPosition = false);
|
||||
}
|
||||
|
||||
public class DetailFilter : IFilter
|
||||
{
|
||||
public static Vector2 StartingPoint;
|
||||
public static bool IsActive { set; get; }
|
||||
public static bool SetPosition { set; get; }
|
||||
public Vector2 Filter(Vector2 OriginalPoint)
|
||||
{
|
||||
if (DetailFilter.SetPosition && Info.Driver.OutputMode is OpenTabletDriver.Plugin.Output.AbsoluteOutputMode)
|
||||
DetailFilter.StartingPoint = new Vector2(OriginalPoint.X, OriginalPoint.Y);
|
||||
return DetailFilter.IsActive ? new Vector2(OriginalPoint.X * this.Scale + DetailFilter.StartingPoint.X, OriginalPoint.Y * this.Scale + DetailFilter.StartingPoint.Y) : OriginalPoint;
|
||||
}
|
||||
|
||||
[SliderProperty("Detail Multiplier", 0.0f, 10f, 0.3f)]
|
||||
public float Scale { get; set; }
|
||||
|
||||
public FilterStage FilterStage => FilterStage.PostTranspose;
|
||||
}
|
||||
}
|
|
@ -1,25 +0,0 @@
|
|||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 16
|
||||
VisualStudioVersion = 16.0.30524.135
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DetailMode", "DetailMode.csproj", "{C51EE48C-0A9E-4815-ADA0-D6A2EBA08019}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{C51EE48C-0A9E-4815-ADA0-D6A2EBA08019}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{C51EE48C-0A9E-4815-ADA0-D6A2EBA08019}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{C51EE48C-0A9E-4815-ADA0-D6A2EBA08019}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{C51EE48C-0A9E-4815-ADA0-D6A2EBA08019}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {C6807CAA-BD69-4297-8422-7C5B8DEFA539}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
|
@ -13,7 +13,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "VMultiMode", "VMultiMode\VM
|
|||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MeL", "MeL\MeL.csproj", "{F0931C43-4A63-4CDB-9B5F-A8DC50557109}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DetailMode", "DetailMode\DetailMode.csproj", "{3315D19C-54CB-4947-8CF5-54953870FB4F}"
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PrecisionControl", "PrecisionControl\PrecisionControl.csproj", "{3315D19C-54CB-4947-8CF5-54953870FB4F}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
|
|
48
PrecisionControl/PrecisionControl.cs
Normal file
48
PrecisionControl/PrecisionControl.cs
Normal file
|
@ -0,0 +1,48 @@
|
|||
using OpenTabletDriver.Plugin;
|
||||
using OpenTabletDriver.Plugin.Tablet;
|
||||
using OpenTabletDriver.Plugin.Attributes;
|
||||
using System;
|
||||
using System.Numerics;
|
||||
using System.Linq;
|
||||
|
||||
namespace PrecisionControl
|
||||
{
|
||||
[PluginName("Precision Control")]
|
||||
public class PrecisionControl: IBinding, IValidateBinding, IFilter
|
||||
{
|
||||
public static Vector2 StartingPoint;
|
||||
public float _Scale;
|
||||
public static bool IsActive { set; get; }
|
||||
public static bool SetPosition { set; get; }
|
||||
public string Property { set; get; }
|
||||
|
||||
public Action Press => (Action)(() =>
|
||||
{
|
||||
IsActive = !IsActive;
|
||||
SetPosition = true;
|
||||
});
|
||||
|
||||
public Action Release => (Action)(() => SetPosition = false);
|
||||
|
||||
public string[] ValidProperties
|
||||
{
|
||||
get { return new[]{ "Toggle Precision Control" }; }
|
||||
}
|
||||
|
||||
public Vector2 Filter(Vector2 OriginalPoint)
|
||||
{
|
||||
if (SetPosition && Info.Driver.OutputMode is OpenTabletDriver.Plugin.Output.AbsoluteOutputMode)
|
||||
StartingPoint = new Vector2(OriginalPoint.X, OriginalPoint.Y);
|
||||
return IsActive ? new Vector2(OriginalPoint.X * Scale + StartingPoint.X, OriginalPoint.Y * Scale + StartingPoint.Y) : OriginalPoint;
|
||||
}
|
||||
|
||||
[SliderProperty("Precision Multiplier", 0.0f, 10f, 0.3f)]
|
||||
public float Scale
|
||||
{
|
||||
get => _Scale;
|
||||
set { _Scale = value; }
|
||||
}
|
||||
|
||||
public FilterStage FilterStage => FilterStage.PostTranspose;
|
||||
}
|
||||
}
|
|
@ -12,7 +12,6 @@
|
|||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="HidSharpCore" Version="1.0.1" />
|
||||
<ProjectReference Include="../.modules/OpenTabletDriver/OpenTabletDriver.Plugin/OpenTabletDriver.Plugin.csproj" />
|
||||
</ItemGroup>
|
||||
|
Loading…
Add table
Reference in a new issue