Merge branch 'master' of github.com:jean-emmanuel/open-stage-control

This commit is contained in:
jean-emmanuel 2021-05-09 18:34:59 +02:00
commit b033ddec40
13 changed files with 111 additions and 67 deletions

View file

@ -1,5 +1,22 @@
# Changelog
## 1.9.7
- bug fixes
- issue when resizing widget using keyboard shortcuts
- advanced syntaxes (VAR{}): avoid storing default value as string if it can be parsed as a javascript primitive (boolean, number, etc)
- advanced syntaxes (VAR{}): ignore quotes around variable name
- editor
- change keyboard shortcuts for moving widgets (now `mod + arrows`) and navigating in widgets (now `arrows`) to feel more natural with the project tree view.
- widgets
- script: bypass keyboard shortcuts already used by the editor if it is enabled
- matrix: removed ambiguous `start` property
- matrix: advanced syntax blocks can be passed to children without being resolved at the matrix\' scope by adding an underscore before the opening bracket
- text: add `soft` mode for the `wrap` property
- input: improve `numeric` mode on iOS
## 1.9.6
- bug fixes
@ -15,7 +32,7 @@
- switch: add `wrap` property
- editor
- display dropdown and checkbox for boolean properties with extra choices
- display dropdown and checkbox for boolean properties with extra choices
## 1.9.5

View file

@ -2,7 +2,7 @@
"name": "open-stage-control",
"productName": "Open Stage Control",
"description": "Libre and modular OSC / MIDI controller",
"version": "1.9.6",
"version": "1.9.7",
"author": {
"name": "Jean-Emmanuel Doucet",
"email": "jean-emmanuel@ammd.net"

View file

@ -86,14 +86,14 @@ Multiple widgets can be edited at once.
| ++ctrl+shift+d++ | Duplicate selected widget and increment id |
| ++alt+c+"Drag"++ | Paste selection to position |
| ++alt+c+shift+"Drag"++ | Paste selection to dragged position and increment id |
| ++up++ <br/>++down++ <br/>++left++ <br/>++right++ | Move selected widgets (1 grid unit, hold ++shift++ for 5 grid units) |
| ++ctrl+up++ <br/>++ctrl+down++ <br/>++ctrl+left++ <br/>++ctrl+right++ | Move selected widgets (1 grid unit, hold ++shift++ for 5 grid units) |
| ++alt+up++ <br/>++alt+down++ <br/>++alt+left++ <br/>++alt+right++ | Resize selected widgets (1 grid unit, hold ++shift++ for 5 grid units) |
| ++ctrl+a++ | Select current widget's siblings and itself |
| ++ctrl+shift+a++ | Cancel current widget selection |
| ++ctrl+up++ | Select current widget's parent |
| ++ctrl+down++ | Select current widget's first child |
| ++ctrl+right++ | Select current widget's next sibling |
| ++ctrl+left++ | Select current widget's previous sibling |
| ++up++ | Select current widget's previous sibling |
| ++down++ | Select current widget's next sibling |
| ++left++ | Select current widget's parent |
| ++right++ | Select current widget's first child |
| ++t++ | Show selected widget in the project tree |
| ++"Home"++ | Send selected widget to back |
| ++"Page Up"++ | Send selected widget farther |
@ -122,14 +122,14 @@ Multiple widgets can be edited at once.
| ++cmd+shift+d++ | Duplicate selected widget and increment id |
| ++alt+c+"Drag"++ | Paste selection to position |
| ++alt+c+shift+"Drag"++ | Paste selection to dragged position and increment id |
| ++up++ <br/>++down++ <br/>++left++ <br/>++right++ | Move selected widgets (1 grid unit, hold ++shift++ for 5 grid units) |
| ++cmd+up++ <br/>++cmd+down++ <br/>++cmd+left++ <br/>++cmd+right++ | Move selected widgets (1 grid unit, hold ++shift++ for 5 grid units) |
| ++alt+up++ <br/>++alt+down++ <br/>++alt+left++ <br/>++alt+right++ | Resize selected widgets (1 grid unit, hold ++shift++ for 5 grid units) |
| ++cmd+a++ | Select current widget's siblings and itself |
| ++cmd+shift+a++ | Cancel current widget selection |
| ++cmd+up++ | Select current widget's parent |
| ++cmd+down++ | Select current widget's first child |
| ++cmd+right++ | Select current widget's next sibling |
| ++cmd+left++ | Select current widget's previous sibling |
| ++up++ | Select current widget's previous sibling |
| ++down++ | Select current widget's next sibling |
| ++left++ | Select current widget's parent |
| ++right++ | Select current widget's first child |
| ++t++ | Show selected widget in the project tree |
| ++"Home"++ | Send selected widget to back |
| ++"Page Up"++ | Send selected widget farther |

View file

@ -62,7 +62,7 @@
| --- | --- | --- | --- |
| <h6 id="address">address<sup><i class="fas fa-bolt" title="dynamic"></i></sup><a class="headerlink" href="#address" title="Permanent link">#</a></h6> | `string` | <code>"auto"</code> | OSC address for sending / receiving messages, it must start with a slash (`/`)<br/><br/>By default ("auto"), the widget's id is used: `/widget_id` |
| <h6 id="preArgs">preArgs<sup><i class="fas fa-bolt" title="dynamic"></i></sup><a class="headerlink" href="#preArgs" title="Permanent link">#</a></h6> | `*`&vert;<br/>`array` | <code>""</code> | A value or array of values that will be prepended to the widget's value in the OSC messages it sends.<br/><br/>Incoming messages must match these to affect by the widget. |
| <h6 id="typeTags">typeTags<sup><i class="fas fa-bolt" title="dynamic"></i></sup><a class="headerlink" href="#typeTags" title="Permanent link">#</a></h6> | `string` | <code>""</code> | Defines the osc argument types, one letter per argument (including preArgs)<br/>- If empty, the types are infered automatically from the values (with numbers casted to floats by default)<br/>- If there are more arguments than type letters, the last type is used for the extra arguments<br/><br/>See <a href="http://opensoundcontrol.org/spec-1_0">http://opensoundcontrol.org/spec-1_0</a> for existing typetags |
| <h6 id="typeTags">typeTags<sup><i class="fas fa-bolt" title="dynamic"></i></sup><a class="headerlink" href="#typeTags" title="Permanent link">#</a></h6> | `string` | <code>""</code> | Defines the osc argument types, one letter per argument (including preArgs)<br/>- If empty, the types are infered automatically from the values (with numbers casted to floats by default)<br/>- If there are more arguments than type letters, the last type is used for the extra arguments<br/><br/>See <a href="http://opensoundcontrol.org/">OSC 1.0 specification</a> for existing typetags |
| <h6 id="decimals">decimals<sup><i class="fas fa-bolt" title="dynamic"></i></sup><a class="headerlink" href="#decimals" title="Permanent link">#</a></h6> | `integer` | <code>2</code> | Defines the number of decimals to send. |
| <h6 id="target">target<sup><i class="fas fa-bolt" title="dynamic"></i></sup><a class="headerlink" href="#target" title="Permanent link">#</a></h6> | `string`&vert;<br/>`array`&vert;<br/>`null` | <code>""</code> | This defines the targets of the widget's OSC messages<br/>- A `string` or `array` of strings formatted as follow: `ip:port` or `["ip:portA", "ip:portB"]`<br/>- If midi is enabled, targets can be `midi:device_name`<br/>- If no target is set, messages can still be sent if the server has default targets |
| <h6 id="ignoreDefaults">ignoreDefaults<a class="headerlink" href="#ignoreDefaults" title="Permanent link">#</a></h6> | `boolean` | <code>false</code> | Set to `true` to ignore the server's default targets |
@ -87,7 +87,7 @@
| <h6 id="button_colorTextOn">colorTextOn<a class="headerlink" href="#button_colorTextOn" title="Permanent link">#</a></h6> | `string` | <code>"auto"</code> | Defines the widget's text color when active. |
| <h6 id="button_label">label<sup><i class="fas fa-bolt" title="dynamic"></i></sup><a class="headerlink" href="#button_label" title="Permanent link">#</a></h6> | `string`&vert;<br/>`boolean` | <code>"auto"</code> | Set to `false` to hide completely<br/>- Insert icons using the prefix ^ followed by the icon's name : `^play`, `^pause`, etc (see https://fontawesome.com/icons?d=gallery&s=solid&m=free)<br/>- Icons can be transformed with the following suffixes: `.flip-[horizontal|vertical|both]`, `.rotate-[90|180|270]`, `.spin`, `.pulse`. Example: `^play.flip-horizontal` |
| <h6 id="button_vertical">vertical<a class="headerlink" href="#button_vertical" title="Permanent link">#</a></h6> | `boolean` | <code>false</code> | Set to `true` to display the text vertically |
| <h6 id="button_wrap">wrap<a class="headerlink" href="#button_wrap" title="Permanent link">#</a></h6> | `boolean` | <code>false</code> | Set to `true` to wrap long lines automatically. |
| <h6 id="button_wrap">wrap<a class="headerlink" href="#button_wrap" title="Permanent link">#</a></h6> | `boolean`&vert;<br/>`string` | <code>false</code> | Set to `true` to wrap long lines automatically. Set to `soft` to avoid breaking words.<br/><br/>Choices: `false`, `true`, `soft` |
=== "button"
@ -109,6 +109,7 @@
| <h6 id="switch_colorTextOn">colorTextOn<a class="headerlink" href="#switch_colorTextOn" title="Permanent link">#</a></h6> | `string` | <code>"auto"</code> | Defines the widget's text color when active. |
| <h6 id="switch_layout">layout<a class="headerlink" href="#switch_layout" title="Permanent link">#</a></h6> | `string` | <code>"vertical"</code> | Defines how items should be laid out<br/><br/>Choices: `vertical`, `horizontal`, `grid` |
| <h6 id="switch_gridTemplate">gridTemplate<a class="headerlink" href="#switch_gridTemplate" title="Permanent link">#</a></h6> | `string`&vert;<br/>`number` | <code>""</code> | If `layout` is `grid`, can be either a number of columns or a valid value for the css property "grid-template". |
| <h6 id="switch_wrap">wrap<a class="headerlink" href="#switch_wrap" title="Permanent link">#</a></h6> | `boolean`&vert;<br/>`string` | <code>false</code> | Set to `true` to wrap long lines automatically. Set to `soft` to avoid breaking words.<br/><br/>Choices: `false`, `true`, `soft` |
=== "switch"
@ -224,7 +225,7 @@
| property | type |default | description |
| --- | --- | --- | --- |
| <h6 id="panel_variables">variables<sup><i class="fas fa-bolt" title="dynamic"></i></sup><a class="headerlink" href="#panel_variables" title="Permanent link">#</a></h6> | `*` | <code>"@\{parent.variables}"</code> | Defines one or more arbitrary variables that can be inherited by children widgets |
| <h6 id="panel_traversing">traversing<sup><i class="fas fa-bolt" title="dynamic"></i></sup><a class="headerlink" href="#panel_traversing" title="Permanent link">#</a></h6> | `boolean` | <code>false</code> | Set to `true` to enable traversing gestures in this widget. Set to `smart` or `auto` to limit affected widgets by the type of the first touched widget |
| <h6 id="panel_traversing">traversing<sup><i class="fas fa-bolt" title="dynamic"></i></sup><a class="headerlink" href="#panel_traversing" title="Permanent link">#</a></h6> | `boolean` | <code>false</code> | Set to `true` to enable traversing gestures in this widget. Set to `smart` to limit affected widgets by the type of the first touched widget<br/><br/>Choices: `false`, `true`, `smart` |
=== "value"
@ -273,7 +274,7 @@
| property | type |default | description |
| --- | --- | --- | --- |
| <h6 id="modal_variables">variables<sup><i class="fas fa-bolt" title="dynamic"></i></sup><a class="headerlink" href="#modal_variables" title="Permanent link">#</a></h6> | `*` | <code>"@\{parent.variables}"</code> | Defines one or more arbitrary variables that can be inherited by children widgets |
| <h6 id="modal_traversing">traversing<sup><i class="fas fa-bolt" title="dynamic"></i></sup><a class="headerlink" href="#modal_traversing" title="Permanent link">#</a></h6> | `boolean` | <code>false</code> | Set to `true` to enable traversing gestures in this widget. Set to `smart` or `auto` to limit affected widgets by the type of the first touched widget |
| <h6 id="modal_traversing">traversing<sup><i class="fas fa-bolt" title="dynamic"></i></sup><a class="headerlink" href="#modal_traversing" title="Permanent link">#</a></h6> | `boolean` | <code>false</code> | Set to `true` to enable traversing gestures in this widget. Set to `smart` to limit affected widgets by the type of the first touched widget<br/><br/>Choices: `false`, `true`, `smart` |
| <h6 id="modal_doubleTap">doubleTap<a class="headerlink" href="#modal_doubleTap" title="Permanent link">#</a></h6> | `boolean` | <code>false</code> | Set to `true` to make the modal require a double tap to open instead of a single tap |
=== "value"
@ -329,11 +330,10 @@
| property | type |default | description |
| --- | --- | --- | --- |
| <h6 id="matrix_variables">variables<sup><i class="fas fa-bolt" title="dynamic"></i></sup><a class="headerlink" href="#matrix_variables" title="Permanent link">#</a></h6> | `*` | <code>"@\{parent.variables}"</code> | Defines one or more arbitrary variables that can be inherited by children widgets |
| <h6 id="matrix_traversing">traversing<sup><i class="fas fa-bolt" title="dynamic"></i></sup><a class="headerlink" href="#matrix_traversing" title="Permanent link">#</a></h6> | `boolean` | <code>false</code> | Set to `true` to enable traversing gestures in this widget. Set to `smart` or `auto` to limit affected widgets by the type of the first touched widget |
| <h6 id="matrix_traversing">traversing<sup><i class="fas fa-bolt" title="dynamic"></i></sup><a class="headerlink" href="#matrix_traversing" title="Permanent link">#</a></h6> | `boolean` | <code>false</code> | Set to `true` to enable traversing gestures in this widget. Set to `smart` to limit affected widgets by the type of the first touched widget<br/><br/>Choices: `false`, `true`, `smart` |
| <h6 id="matrix_widgetType">widgetType<a class="headerlink" href="#matrix_widgetType" title="Permanent link">#</a></h6> | `string` | <code>"button"</code> | Defines the type of the widgets in the matrix |
| <h6 id="matrix_quantity">quantity<a class="headerlink" href="#matrix_quantity" title="Permanent link">#</a></h6> | `number` | <code>4</code> | Defines the number of widgets in the matrix |
| <h6 id="matrix_start">start<a class="headerlink" href="#matrix_start" title="Permanent link">#</a></h6> | `integer` | <code>0</code> | First widget's index |
| <h6 id="matrix_props">props<sup><i class="fas fa-bolt" title="dynamic"></i></sup><a class="headerlink" href="#matrix_props" title="Permanent link">#</a></h6> | `object` | <code>\{}</code> | Defines a set of property to override the widgets' defaults.<br/><br/>JS{{}} and #{} blocks in this field are resolved with an extra variable representing each widget's index: `$` (e.g. `#{$}`)<br/><br/>Advanced syntax blocks (@{}, OSC{}, JS{{}} and #{}) are resolved at the matrix' scope (ie @{this.variables} returns the matrix' variables property)<br/><br/>Note: by default, the widgets inherit from the matrix' `id` and osc properties (`id` and `address` are appended with `/$`) |
| <h6 id="matrix_props">props<sup><i class="fas fa-bolt" title="dynamic"></i></sup><a class="headerlink" href="#matrix_props" title="Permanent link">#</a></h6> | `object` | <code>\{}</code> | Defines a set of property to override the widgets' defaults.<br/><br/>JS{} and #{} blocks in this field are resolved with an extra variable representing each widget's index: `$` (e.g. `#{$}`)<br/><br/>Advanced syntax blocks (@{}, OSC{}, JS{}, VAR{} and #{}) are resolved at the matrix' scope (ie @{this.variables} returns the matrix' variables property)<br/><br/>Advanced syntax blocks can be passed to children without being resolved at the matrix' scope by adding an underscore before the opening bracket.<br/><br/>Note: unless overridden, children inherit from the matrix' `id` and osc properties (`id` and `address` are appended with `/$`) |
=== "value"
@ -407,7 +407,7 @@
| property | type |default | description |
| --- | --- | --- | --- |
| <h6 id="root_variables">variables<sup><i class="fas fa-bolt" title="dynamic"></i></sup><a class="headerlink" href="#root_variables" title="Permanent link">#</a></h6> | `*` | <code>"@\{parent.variables}"</code> | Defines one or more arbitrary variables that can be inherited by children widgets |
| <h6 id="root_traversing">traversing<sup><i class="fas fa-bolt" title="dynamic"></i></sup><a class="headerlink" href="#root_traversing" title="Permanent link">#</a></h6> | `boolean` | <code>false</code> | Set to `true` to enable traversing gestures in this widget. Set to `smart` or `auto` to limit affected widgets by the type of the first touched widget |
| <h6 id="root_traversing">traversing<sup><i class="fas fa-bolt" title="dynamic"></i></sup><a class="headerlink" href="#root_traversing" title="Permanent link">#</a></h6> | `boolean` | <code>false</code> | Set to `true` to enable traversing gestures in this widget. Set to `smart` to limit affected widgets by the type of the first touched widget<br/><br/>Choices: `false`, `true`, `smart` |
=== "value"
@ -444,7 +444,7 @@
| property | type |default | description |
| --- | --- | --- | --- |
| <h6 id="tab_variables">variables<sup><i class="fas fa-bolt" title="dynamic"></i></sup><a class="headerlink" href="#tab_variables" title="Permanent link">#</a></h6> | `*` | <code>"@\{parent.variables}"</code> | Defines one or more arbitrary variables that can be inherited by children widgets |
| <h6 id="tab_traversing">traversing<sup><i class="fas fa-bolt" title="dynamic"></i></sup><a class="headerlink" href="#tab_traversing" title="Permanent link">#</a></h6> | `boolean` | <code>false</code> | Set to `true` to enable traversing gestures in this widget. Set to `smart` or `auto` to limit affected widgets by the type of the first touched widget |
| <h6 id="tab_traversing">traversing<sup><i class="fas fa-bolt" title="dynamic"></i></sup><a class="headerlink" href="#tab_traversing" title="Permanent link">#</a></h6> | `boolean` | <code>false</code> | Set to `true` to enable traversing gestures in this widget. Set to `smart` to limit affected widgets by the type of the first touched widget<br/><br/>Choices: `false`, `true`, `smart` |
=== "value"
@ -617,7 +617,7 @@
| property | type |default | description |
| --- | --- | --- | --- |
| <h6 id="text_vertical">vertical<a class="headerlink" href="#text_vertical" title="Permanent link">#</a></h6> | `boolean` | <code>false</code> | Set to `true` to display the text vertically |
| <h6 id="text_wrap">wrap<a class="headerlink" href="#text_wrap" title="Permanent link">#</a></h6> | `boolean` | <code>false</code> | Set to `true` to wrap long lines automatically. |
| <h6 id="text_wrap">wrap<a class="headerlink" href="#text_wrap" title="Permanent link">#</a></h6> | `boolean`&vert;<br/>`string` | <code>false</code> | Set to `true` to wrap long lines automatically. Set to `soft` to avoid breaking words.<br/><br/>Choices: `false`, `true`, `soft` |
| <h6 id="text_align">align<a class="headerlink" href="#text_align" title="Permanent link">#</a></h6> | `string` | <code>"center"</code> | Text alignment.<br/><br/>Choices: `center`, `left`, `right`, `top`, `bottom`, `left top`, `left bottom`, `right top`, `right bottom` |
## Pads
@ -803,7 +803,7 @@
| --- | --- | --- | --- |
| <h6 id="script_script">script<a class="headerlink" href="#script_script" title="Permanent link">#</a></h6> | `script` | <code>""</code> | Script executed whenever the widget's receives the defined event. See <a href="https://openstagecontrol.ammd.net/docs/widgets/scripting/">documentation</a>. |
| <h6 id="script_event">event<a class="headerlink" href="#script_event" title="Permanent link">#</a></h6> | `string` | <code>"value"</code> | Define which events trigger the script's execution.<br/><br/>Choices: `value`, `keyboard`, `once` |
| <h6 id="script_keyBinding">keyBinding<a class="headerlink" href="#script_keyBinding" title="Permanent link">#</a></h6> | `string`&vert;<br/>`array` | <code>""</code> | Key combo `string` or `array` of strings (see <a href="https://github.com/RobertWHurst/KeyboardJS">KeyboardJS</a> documentation) |
| <h6 id="script_keyBinding">keyBinding<a class="headerlink" href="#script_keyBinding" title="Permanent link">#</a></h6> | `string`&vert;<br/>`array` | <code>""</code> | Key combo `string` or `array` of strings (see <a href="https://github.com/RobertWHurst/KeyboardJS">KeyboardJS</a> documentation).<br/><br/>If the editor is enabled, some keys / combos will not work. |
| <h6 id="script_keyRepeat">keyRepeat<a class="headerlink" href="#script_keyRepeat" title="Permanent link">#</a></h6> | `boolean` | <code>true</code> | Set to `false` to prevent keydown repeats when holding the key combo pressed |
| <h6 id="script_keyType">keyType<a class="headerlink" href="#script_keyType" title="Permanent link">#</a></h6> | `string` | <code>"keydown"</code> | Determines which key event trigger the script's execution<br/><br/>Choices: `keydown`, `keyup`, `both` |

View file

@ -209,6 +209,7 @@ class Editor {
for (let c of combos) {
keyboardJS.bind(c, (e)=>{
e.catchedByEditor = true
this.handleKeyboard(c, e)
})
}
@ -330,10 +331,10 @@ class Editor {
break
case 'up':
case 'down':
case 'right':
case 'left':
case 'mod + up':
case 'mod + down':
case 'mod + right':
case 'mod + left':
if (!this.selectedWidgets.length) return
if (this.selectedWidgets[0].props.top === undefined && e.key.match(/Arrow(Up|Down)/)) return
@ -368,33 +369,24 @@ class Editor {
}
break
case 'mod + up':
case 'mod + down':
case 'mod + right':
case 'mod + left':
case 'up':
case 'down':
case 'right':
case 'left':
if (!this.selectedWidgets.length) return
var curWidget = this.selectedWidgets[0],
toSelect = null
if (e.key === 'ArrowUp' && curWidget.parent !== widgetManager) {
if (e.key === 'ArrowLeft' && curWidget.parent !== widgetManager) {
toSelect = curWidget.parent
} else if (e.key === 'ArrowDown') {
} else if (e.key === 'ArrowRight') {
let toSelectList = [...curWidget.children]
toSelect = curWidget.children[0]
if (toSelectList && toSelectList.length) {
toSelectList.sort((a,b) => a.container.offsetLeft>b.container.offsetLeft)
toSelect = toSelectList[0]
if (toSelect.container.classList.contains('not-editable')) {
toSelect = null
}
}
}
else if((e.key == 'ArrowLeft') || (e.key == 'ArrowRight')){
} else if((e.key == 'ArrowUp') || (e.key == 'ArrowDown')){
if (curWidget.parent === widgetManager) return
@ -404,7 +396,7 @@ class Editor {
toSelectList.sort((a,b) => a.container.offsetLeft > b.container.offsetLeft)
var idx = toSelectList.indexOf(curWidget)
if (idx >= 0) {
var nextIdx = (idx + (e.key === 'ArrowLeft' ? -1 : 1 ) + toSelectList.length) % toSelectList.length
var nextIdx = (idx + (e.key === 'ArrowUp' ? -1 : 1 ) + toSelectList.length) % toSelectList.length
toSelect = toSelectList[nextIdx]
}
}
@ -828,12 +820,16 @@ class Editor {
for (var i = 0; i < this.selectedWidgets.length; i++) {
let w = this.selectedWidgets[i],
dW = deltaW * w.container.offsetWidth / this.widgetDragResize.initWidth,
dH = deltaH * w.container.offsetHeight / this.widgetDragResize.initHeight,
nW, nH
nW = w.container.offsetWidth + dW
nH = w.container.offsetHeight + dH
if (i === 0 && ui) {
nW = ui.originalSize.width + deltaW
nH = ui.originalSize.height + deltaH
} else {
nW = w.container.offsetWidth + deltaW
nH = w.container.offsetHeight + deltaH
}
if (w.props.width !== undefined && w.parent.getProp('layout') !== 'vertical') {
var newWidth = Math.max(nW, GRIDWIDTH) / PXSCALE

View file

@ -147,6 +147,11 @@ class UiDragResize extends UiWidget {
this.updateRectangle()
this.initLeft = this.left
this.initTop = this.top
this.initWidth = this.width
this.initHeight = this.height
this.widgets[0].parentNode.appendChild(this.container)
this.mounted = true

View file

@ -54,7 +54,7 @@ function applylocalZoom() {
document.addEventListener('keydown', function(event){
if (event[mod]) {
console.log(event.keyCode)
var z = false
if (event.keyCode == 96 || event.keyCode == 48) {
PXSCALE = INITIALZOOM

View file

@ -60,7 +60,11 @@ class Input extends Canvas {
this.blur(true)
})
if (this.getProp('numeric')) this.input.type = 'number'
if (this.getProp('numeric')) {
this.input.type = 'number'
this.input.pattern = '[0-9\.]*'
this.input.inputMode = 'decimal'
}
var asYouType = this.getProp('asYouType')

View file

@ -122,7 +122,7 @@ class Widget extends EventEmitter {
'Defines the osc argument types, one letter per argument (including preArgs)',
'- If empty, the types are infered automatically from the values (with numbers casted to floats by default)',
'- If there are more arguments than type letters, the last type is used for the extra arguments',
'See <a href="http://opensoundcontrol.org/spec-1_0">http://opensoundcontrol.org/spec-1_0</a> for existing typetags'
'See <a href="http://opensoundcontrol.org/">OSC 1.0 specification</a> for existing typetags'
]},
decimals: {type: 'integer', value: 2, help: [
'Defines the number of decimals to send.',
@ -638,6 +638,18 @@ class Widget extends EventEmitter {
return typeof variables[m] === 'string' ? variables[m] : JSON.stringify(variables[m])
}))
if (typeof value === 'string' && isJSON(value)) {
try {
value = JSON.parseFlex(value)
} catch (err) {}
}
if (
// remove quotes
(name[0] === '"' && name[name.length - 1] === '"') ||
(name[0] === '\'' && name[name.length - 1] === '\'')
) name = name.slice(1, name.length - 1)
if (!this.variables[name]) {
this.variables[name] = {default: value, value: value, propNames: [propName]}
@ -729,7 +741,7 @@ class Widget extends EventEmitter {
})
} catch (err) {
this.errorProp(propName, 'JS{{}}', err)
this.errorProp(propName, 'JS{}', err)
}
try {

View file

@ -17,12 +17,12 @@ class Matrix extends Panel {
class_specific: {
widgetType: {type: 'string', value: 'button', help: 'Defines the type of the widgets in the matrix'},
quantity: {type: 'number', value: 4, help: 'Defines the number of widgets in the matrix'},
start: {type: 'integer', value: 0, help: 'First widget\'s index'},
props: {type: 'object', value: {}, help: [
'Defines a set of property to override the widgets\' defaults.',
'JS{{}} and #{} blocks in this field are resolved with an extra variable representing each widget\'s index: `$` (e.g. `#{$}`)',
'Advanced syntax blocks (@{}, OSC{}, JS{{}} and #{}) are resolved at the matrix\' scope (ie @{this.variables} returns the matrix\' variables property)',
'Note: by default, the widgets inherit from the matrix\' `id` and osc properties (`id` and `address` are appended with `/$`)'
'JS{} and #{} blocks in this field are resolved with an extra variable representing each widget\'s index: `$` (e.g. `#{$}`)',
'Advanced syntax blocks (@{}, OSC{}, JS{}, VAR{} and #{}) are resolved at the matrix\' scope (ie @{this.variables} returns the matrix\' variables property)',
'Advanced syntax blocks can be passed to children without being resolved at the matrix\' scope by adding an underscore before the opening bracket.',
'Note: unless overridden, children inherit from the matrix\' `id` and osc properties (`id` and `address` are appended with `/$`)'
]},
},
style: {
@ -60,19 +60,19 @@ class Matrix extends Panel {
this.start = parseInt(this.getProp('start'))
if (parser.widgets[this.getProp('widgetType')]) {
for (let i = 0; i < this.getProp('quantity'); i++) {
var props = this.resolveProp('props', undefined, false, false, false, {'$':i + this.start})
var data = this.defaultProps(i + this.start)
var props = this.resolveProp('props', undefined, false, false, false, {'$':i})
var data = this.defaultProps(i)
if (typeof props === 'object' && props !== null) {
Object.assign(data, props)
}
data = JSON.parse(JSON.stringify(data).replace(/(JS|#|OSC|@|VAR)_\{/g, '$1{'))
var widget = parser.parse({
data: data,
parentNode: this.widget,
@ -126,12 +126,14 @@ class Matrix extends Panel {
for (let i = this.children.length - 1; i >= 0; i--) {
let data = this.resolveProp('props', undefined, false, false, false, {'$': i + this.start})
let data = this.resolveProp('props', undefined, false, false, false, {'$': i})
if (typeof data !== 'object' || data === null || Array.isArray(data)) {
data = {}
}
data = JSON.parse(JSON.stringify(data).replace(/(JS|#|OSC|@|VAR)_\{/g, '$1{'))
if (typeof oldPropValue === 'object' && oldPropValue !== null) {
// if an overridden default props is removed, set it back to default
let overriddenDefaults,
@ -139,7 +141,7 @@ class Matrix extends Panel {
for (var k in oldPropValue) {
if (data[k] === undefined) {
if (Matrix.overriddenDefaults.indexOf(k) !== -1) {
overriddenDefaults = overriddenDefaults || this.defaultProps(i + this.start)
overriddenDefaults = overriddenDefaults || this.defaultProps(i)
data[k] = overriddenDefaults[k]
} else {
widgetDefaults = widgetDefaults || parser.defaults[data.type || this.getProp('widgetType')]

View file

@ -20,8 +20,8 @@ module.exports = class Text extends StaticProperties(Widget, {bypass: true, inte
style: {
_separator_text_style: 'Text style',
vertical: {type: 'boolean', value: false, help: 'Set to `true` to display the text vertically'},
wrap: {type: 'boolean', value: false, help: [
'Set to `true` to wrap long lines automatically.',
wrap: {type: 'boolean|string', value: false, choices: [false, true, 'soft'], help: [
'Set to `true` to wrap long lines automatically. Set to `soft` to avoid breaking words.',
]},
align: {type: 'string', value: 'center', choices: ['center', 'left', 'right', 'top', 'bottom', 'left top', 'left bottom', 'right top', 'right bottom'], help: 'Text alignment.'},
},
@ -46,7 +46,7 @@ module.exports = class Text extends StaticProperties(Widget, {bypass: true, inte
if (this.getProp('align').includes('top')) this.text.classList.add('top')
if (this.getProp('align').includes('bottom')) this.text.classList.add('bottom')
if (this.getProp('wrap')) this.text.classList.add('wrap')
if (this.getProp('wrap') === 'soft') this.text.classList.add('wrap-soft')
this.setValue(this.getProp('default'))

View file

@ -26,7 +26,10 @@ class Script extends Widget {
_separator: 'event: keyboard',
keyBinding: {type: 'string|array', value: '', help: 'Key combo `string` or `array` of strings (see <a href="https://github.com/RobertWHurst/KeyboardJS">KeyboardJS</a> documentation)'},
keyBinding: {type: 'string|array', value: '', help: [
'Key combo `string` or `array` of strings (see <a href="https://github.com/RobertWHurst/KeyboardJS">KeyboardJS</a> documentation).',
'If the editor is enabled, some keys / combos will not work.'
]},
keyRepeat: {type: 'boolean', value: true, help: 'Set to `false` to prevent keydown repeats when holding the key combo pressed'},
keyType: {type: 'string', value: 'keydown', choices: ['keydown', 'keyup', 'both'], help: 'Determines which key event trigger the script\'s execution'},
@ -145,6 +148,8 @@ class Script extends Widget {
keyboardCallback(e) {
if (e.catchedByEditor) return
if (e.target && (e.target.tagName === 'INPUT' || e.target.tagName === 'TEXTAREA' || e.target.tagName === 'SELECT')) return
if (this.getProp('keyType') !== 'both' && e.type !== this.getProp('keyType')) return

View file

@ -85,6 +85,9 @@
white-space: pre-wrap;
word-break: break-all;
}
&.wrap-soft {
word-break: normal
}
&.vertical {
transform: rotate(180deg);
text-overflow: ellipsis;