mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-04-20 22:39:39 +00:00
Knob (#600)
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.~~ 
This commit is contained in:
@@ -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"
|
||||
|
||||
Reference in New Issue
Block a user