keys: key variable in keydown and keyup is now always lowercased when referencing a single character
This commit is contained in:
parent
30c0b7685f
commit
eab71c1375
2 changed files with 10 additions and 1 deletions
|
|
@ -7,6 +7,7 @@
|
|||
- widgets
|
||||
- switch: add `traversing` option (`true` by default)
|
||||
- knob: act as a relative encoder when traversing gestures are enabled and `snap` is `false`
|
||||
- keys: `key` variable in `keydown` and `keyup` is now always lowercased when referencing a single character
|
||||
- custom module
|
||||
- expose shorthand functions `send` and `receives`
|
||||
- expose a client object instead of just an id in `app` event handlers to allow retrieving the client's ip address as well
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ class Keys extends Widget {
|
|||
binding: {type: 'string|array', value: '', help: 'Key combo `string` or `array` of strings (see <a href="https://github.com/RobertWHurst/KeyboardJS">KeyboardJS</a> documentation)'},
|
||||
keydown: {type: 'string', value: '', help: [
|
||||
'This property is evaluated each time the key combo is pressed and defines the widget\'s own value. Formulas are given extras variables in this context:',
|
||||
'- `key`: pressed key name (usefull for handling multiple keys with a single keys widget)',
|
||||
'- `key`: pressed key name (usefull for handling multiple keys with a single keys widget, lowercased when referencing a character key)',
|
||||
'- `ctrl`: control key state',
|
||||
'- `alt`: alt key state',
|
||||
'- `shift`: shift key state',
|
||||
|
|
@ -86,6 +86,10 @@ class Keys extends Widget {
|
|||
meta: e.metaKey
|
||||
}
|
||||
|
||||
if (context.key.length === 1) {
|
||||
context.key = context.key.toLowerCase()
|
||||
}
|
||||
|
||||
this.setValue(this.resolveProp('keydown', undefined, false, false, false, context), {sync: true, send: true})
|
||||
|
||||
}
|
||||
|
|
@ -110,6 +114,10 @@ class Keys extends Widget {
|
|||
meta: e.metaKey
|
||||
}
|
||||
|
||||
if (context.key.length === 1) {
|
||||
context.key = context.key.toLowerCase()
|
||||
}
|
||||
|
||||
this.setValue(this.resolveProp('keyup', undefined, false, false, false, context), {sync: true, send: true})
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue