From e4996e1d53e56ef6567f003f311dfd4ec0ef56b7 Mon Sep 17 00:00:00 2001 From: jean-emmanuel Date: Sun, 31 Dec 2017 12:53:53 +0100 Subject: [PATCH] docs: add keys docs --- resources/docs/widgets/inputs.md | 42 ++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/resources/docs/widgets/inputs.md b/resources/docs/widgets/inputs.md index 8d23bcc6..58063075 100644 --- a/resources/docs/widgets/inputs.md +++ b/resources/docs/widgets/inputs.md @@ -29,3 +29,45 @@ - type: `string` - default: `empty` - usage: `unit` will be appended to the displayed widget's value (it doesn't affect osc messages) + + +## Keys + + +```js +{ + type:'keys', + // etc +} +``` + +### `widgetId` +- type: `object` +- default: `empty` +- usage: a widget's `id` whose value will be linked to the Keys + +### `binding` +- type: `string|array` +- default: `''` +- usage: [keyboardjs](https://github.com/RobertWHurst/KeyboardJS) key combo string or array of strings. + +### `keydown` +- type: `string` +- default: `''` +- usage: [MathJS](http://mathjs.org/docs/expressions/syntax.html) expression whose output will be sent to the linked widget. This will be evaluated when the key combo is pressed. Available variables are ; + - `value`: widget's value + - `key`: pressed key name (usefull for handling multiple keys with a single `keys` widget) + - `ctrl`: control key state + - `alt`: alt key state + - `shift`: shift key state + - `super`: command/windows key state + +### `keyup` +- type: `string` +- default: `''` +- usage: same as `keydown`, but evaluated when releasing the key combo. + +### `repeat` +- type: `boolean` +- default: `true` +- usage: set to `false` to prevent `keydown` repeats when holding the key combo pressed.