Class PenInput
- Namespace
- WitShells.CanvasDrawTool
Specialized input handler for pen/stylus tablets. Supports pressure sensitivity, tilt, and pen-specific features. Works with Wacom, Surface Pen, Apple Pencil (via Unity's Pen device).
public class PenInput : DrawingInput
- Inheritance
-
PenInput
- Inherited Members
Fields
OnBarrelButtonPressed
public UnityEvent OnBarrelButtonPressed
Field Value
- UnityEvent
OnBarrelButtonReleased
public UnityEvent OnBarrelButtonReleased
Field Value
- UnityEvent
OnEraserTipActive
public UnityEvent OnEraserTipActive
Field Value
- UnityEvent
OnPenTipActive
public UnityEvent OnPenTipActive
Field Value
- UnityEvent
OnPressureChanged
public UnityEvent<float> OnPressureChanged
Field Value
- UnityEvent<float>
OnTiltChanged
public UnityEvent<Vector2> OnTiltChanged
Field Value
- UnityEvent<Vector2>
Properties
CurrentBarrelAction
public PenInput.BarrelButtonAction CurrentBarrelAction { get; }
Property Value
IsBarrelButtonPressed
public bool IsBarrelButtonPressed { get; }
Property Value
IsEraserTip
public bool IsEraserTip { get; }
Property Value
IsPenAvailable
public bool IsPenAvailable { get; }
Property Value
RawPressure
public float RawPressure { get; }
Property Value
Tilt
public Vector2 Tilt { get; }
Property Value
- Vector2
UsePressureForOpacity
public bool UsePressureForOpacity { get; set; }
Property Value
UsePressureForSize
public bool UsePressureForSize { get; set; }
Property Value
Methods
Awake()
protected override void Awake()
GetEffectiveOpacity(float, float)
Get the effective opacity based on pressure settings.
public float GetEffectiveOpacity(float baseOpacity, float pressure)
Parameters
Returns
GetEffectiveSize(int, float)
Get the effective size based on pressure settings.
public int GetEffectiveSize(int baseSize, float pressure)
Parameters
Returns
GetTouchPressure(Finger)
protected override float GetTouchPressure(UnityEngine.InputSystem.EnhancedTouch.Finger finger)
Parameters
fingerFinger
Returns
SetBarrelButtonAction(BarrelButtonAction)
Set the barrel button action.
public void SetBarrelButtonAction(PenInput.BarrelButtonAction action)
Parameters
actionPenInput.BarrelButtonAction
SetPressureCurve(AnimationCurve)
Set the pressure curve.
public void SetPressureCurve(AnimationCurve curve)
Parameters
curveAnimationCurve
ShouldUseEraser()
Check if we should use eraser (either eraser tip or barrel button set to eraser).
public bool ShouldUseEraser()
Returns
ShouldUseEyedropper()
Check if we should use eyedropper (barrel button set to eyedropper).
public bool ShouldUseEyedropper()
Returns
Update()
protected override void Update()