Resolved issues with history due to merges, opened a new pull request.
A more visual widget that the usual number/slider. Differentiates itself
from the functionality of a slider by not setting the value on click,
only stepping, emulating an actual knob.

- Left/Right takes 1 step at a time
- Up/Down moves 1% or 1 step, whichever is larger
- Move + Shift moves by 10% or 1 step, whichever is larger

This also includes a fixes to some size logic.
- [x] ~~Still missing being able to drag the knob itself, as the
clicking of the widget is not recognized if it's outside of where a
normal height widget would be.~~

![knob-node](https://github.com/user-attachments/assets/9d0ce70d-a220-49d0-987f-8dcef2b1d299)
This commit is contained in:
Miguel C
2025-02-26 14:07:32 -06:00
committed by GitHub
parent 963e4b0904
commit fbcc396880
3 changed files with 277 additions and 0 deletions

View File

@@ -30,6 +30,15 @@ export interface IWidgetSliderOptions extends IWidgetOptions<number> {
marker_color?: CanvasColour
}
export interface IWidgetKnobOptions extends IWidgetOptions<number> {
min: number
max: number
step: number
slider_color?: CanvasColour // TODO: Replace with knob color
marker_color?: CanvasColour
gradient_stops?: string
}
/**
* A widget for a node.
* All types are based on IBaseWidget - additions can be made there or directly on individual types.
@@ -47,6 +56,7 @@ export type IWidget =
| ICustomWidget
| ISliderWidget
| IButtonWidget
| IKnobWidget
export interface IBooleanWidget extends IBaseWidget {
type?: "toggle"
@@ -66,6 +76,12 @@ export interface ISliderWidget extends IBaseWidget {
marker?: number
}
export interface IKnobWidget extends IBaseWidget {
type?: "knob"
value: number
options: IWidgetKnobOptions
}
/** A combo-box widget (dropdown, select, etc) */
export interface IComboWidget extends IBaseWidget {
type?: "combo"