added 'increment' option for Inputter (#64)

* added 'increment' option for Inputter

* added 'quick edit: added max value for font-weight

* forgot to include type change
This commit is contained in:
matavach
2024-08-02 21:54:25 -05:00
committed by GitHub
parent 308e22b02f
commit 1f7c5a70ca
3 changed files with 4 additions and 2 deletions

View File

@@ -22,6 +22,7 @@ export type RowProps<T> = {
max?: number
min?: number
subtitle?: string
increment?: number
}
export type OSDOrientation = "horizontal" | "vertical";

View File

@@ -11,7 +11,7 @@ export const BarGeneral = () => {
Header('General Settings'),
Option({ opt: options.theme.font.name, title: 'Font', type: 'font' }),
Option({ opt: options.theme.font.size, title: 'Font Size', type: 'string' }),
Option({ opt: options.theme.font.weight, title: 'Font Weight', subtitle: "100, 200, 300, etc.", type: 'number' }),
Option({ opt: options.theme.font.weight, title: 'Font Weight', subtitle: "100, 200, 300, etc.", type: 'number', increment: 100, min: 100, max: 900}),
Option({ opt: options.terminal, title: 'Terminal', subtitle: "Tools such as 'btop' will open in this terminal", type: 'string' }),
Header('On Screen Display'),

View File

@@ -32,6 +32,7 @@ export const Inputter = <T>({
enums,
max = 1000000,
min = 0,
increment = 1
}: RowProps<T>,
className: string
) => {
@@ -43,7 +44,7 @@ export const Inputter = <T>({
case "number": return self.child = Widget.SpinButton({
setup(self) {
self.set_range(min, max)
self.set_increments(1, 5)
self.set_increments(1 * increment, 5 * increment)
self.on("value-changed", () => opt.value = self.value as T)
self.hook(opt, () => self.value = opt.value as number)
},