diff --git a/src/LGraphCanvas.ts b/src/LGraphCanvas.ts
index 25c189884..a94cae987 100644
--- a/src/LGraphCanvas.ts
+++ b/src/LGraphCanvas.ts
@@ -32,6 +32,7 @@ import type {
CanvasPointerEvent,
CanvasPointerExtensions,
} from "./types/events"
+import type { PromptOptionalParams } from "./types/optionalParams"
import type { ClipboardItems } from "./types/serialisation"
import type { IBaseWidget } from "./types/widgets"
@@ -5793,7 +5794,7 @@ export class LGraphCanvas {
value: any,
callback: (arg0: any) => void,
event: CanvasMouseEvent,
- multiline?: boolean,
+ optionalParams?: PromptOptionalParams,
): HTMLDivElement {
const that = this
title = title || ""
@@ -5801,9 +5802,11 @@ export class LGraphCanvas {
const customProperties = {
is_modified: false,
className: "graphdialog rounded",
- innerHTML: multiline
+ innerHTML: optionalParams && optionalParams.multiline
? " "
- : " ",
+ : (optionalParams && optionalParams.stepValue
+ ? ` `
+ : " "),
close() {
that.prompt_box = null
if (dialog.parentNode) {
@@ -5881,6 +5884,12 @@ export class LGraphCanvas {
callback(this.value)
}
dialog.close()
+ } else if (e.shiftKey && e.code === "ArrowUp" && e.target instanceof HTMLInputElement && e.target.type === "number") {
+ e.preventDefault()
+ e.target.stepUp(10)
+ } else if (e.shiftKey && e.code === "ArrowDown" && e.target instanceof HTMLInputElement && e.target.type === "number") {
+ e.preventDefault()
+ e.target.stepDown(10)
} else {
return
}
diff --git a/src/types/optionalParams.ts b/src/types/optionalParams.ts
new file mode 100644
index 000000000..5a4f2db13
--- /dev/null
+++ b/src/types/optionalParams.ts
@@ -0,0 +1,4 @@
+export type PromptOptionalParams = {
+ multiline?: boolean
+ stepValue?: number
+}
diff --git a/src/widgets/NumberWidget.ts b/src/widgets/NumberWidget.ts
index 5707e31f7..9609423f7 100644
--- a/src/widgets/NumberWidget.ts
+++ b/src/widgets/NumberWidget.ts
@@ -48,6 +48,7 @@ export class NumberWidget extends BaseSteppedWidget implements I
override onClick({ e, node, canvas }: WidgetEventOptions) {
const x = e.canvasX - node.pos[0]
const width = this.width || node.size[0]
+ const step = getWidgetStep(this.options)
// Determine if clicked on left/right arrows
const delta = x < 40
@@ -75,7 +76,7 @@ export class NumberWidget extends BaseSteppedWidget implements I
if (!isNaN(newValue)) {
this.setValue(newValue, { e, node, canvas })
}
- }, e)
+ }, e, { stepValue: step })
}
/**
diff --git a/src/widgets/TextWidget.ts b/src/widgets/TextWidget.ts
index 0567fd591..28014c15d 100644
--- a/src/widgets/TextWidget.ts
+++ b/src/widgets/TextWidget.ts
@@ -43,7 +43,9 @@ export class TextWidget extends BaseWidget implements IStringWidg
}
},
e,
- this.options?.multiline ?? false,
+ {
+ multiline: this.options?.multiline ?? false,
+ },
)
}
}