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:
1
lib/types/options.d.ts
vendored
1
lib/types/options.d.ts
vendored
@@ -22,6 +22,7 @@ export type RowProps<T> = {
|
|||||||
max?: number
|
max?: number
|
||||||
min?: number
|
min?: number
|
||||||
subtitle?: string
|
subtitle?: string
|
||||||
|
increment?: number
|
||||||
}
|
}
|
||||||
|
|
||||||
export type OSDOrientation = "horizontal" | "vertical";
|
export type OSDOrientation = "horizontal" | "vertical";
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ export const BarGeneral = () => {
|
|||||||
Header('General Settings'),
|
Header('General Settings'),
|
||||||
Option({ opt: options.theme.font.name, title: 'Font', type: 'font' }),
|
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.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' }),
|
Option({ opt: options.terminal, title: 'Terminal', subtitle: "Tools such as 'btop' will open in this terminal", type: 'string' }),
|
||||||
|
|
||||||
Header('On Screen Display'),
|
Header('On Screen Display'),
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ export const Inputter = <T>({
|
|||||||
enums,
|
enums,
|
||||||
max = 1000000,
|
max = 1000000,
|
||||||
min = 0,
|
min = 0,
|
||||||
|
increment = 1
|
||||||
}: RowProps<T>,
|
}: RowProps<T>,
|
||||||
className: string
|
className: string
|
||||||
) => {
|
) => {
|
||||||
@@ -43,7 +44,7 @@ export const Inputter = <T>({
|
|||||||
case "number": return self.child = Widget.SpinButton({
|
case "number": return self.child = Widget.SpinButton({
|
||||||
setup(self) {
|
setup(self) {
|
||||||
self.set_range(min, max)
|
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.on("value-changed", () => opt.value = self.value as T)
|
||||||
self.hook(opt, () => self.value = opt.value as number)
|
self.hook(opt, () => self.value = opt.value as number)
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user