Type a repeat delay as whole milliseconds
The two On key down fields read in milliseconds now, and say so in their labels. A number field shows three decimals unless a property asks for fewer, so both params set decimals: 0 – the field reads 300, not 300.000, and rounds to whole milliseconds while typing or scrubbing. The clock behind it still counts seconds; the conversion sits at the one place that reads the properties.
This commit is contained in:
1 parent
3ab8d88ad6
commit
338ff4389f
3 files changed
+44
-10
No files matched your search
@@ -11,8 +11,26 @@ export const OnKeyDown: NodeDef = {
|
||||
outputs: [exec()],
|
||||
params: [
|
||||
keyParam,
|
||||
{ key: 'repeatAfter', label: 'Repeat after (ms)', kind: 'number', default: 0, min: 0, step: 50 },
|
||||
{ key: 'repeatInterval', label: 'Repeat interval (ms)', kind: 'number', default: 0, min: 0, step: 10 },
|
||||
// `decimals: 0`: a millisecond is the finest step the repeat clock reads, so a fractional
|
||||
// field would only ever show a ".000" nothing can use.
|
||||
{
|
||||
key: 'repeatAfter',
|
||||
label: 'Repeat after (ms)',
|
||||
kind: 'number',
|
||||
default: 0,
|
||||
min: 0,
|
||||
step: 50,
|
||||
decimals: 0,
|
||||
},
|
||||
{
|
||||
key: 'repeatInterval',
|
||||
label: 'Repeat interval (ms)',
|
||||
kind: 'number',
|
||||
default: 0,
|
||||
min: 0,
|
||||
step: 10,
|
||||
decimals: 0,
|
||||
},
|
||||
],
|
||||
// Both rows go together: with no delay there is no repeat, so the interval is not in play either.
|
||||
hiddenParams: (params) => (asNumber(params.repeatAfter ?? 0) > 0 ? [] : ['repeatAfter', 'repeatInterval']),
|
||||
|
||||
Reference in new issue
Block a user