From 8b1d09116d18d926be1d94344a8f4d8359aa6666 Mon Sep 17 00:00:00 2001 From: bordun Date: Fri, 7 May 2021 08:11:02 +0200 Subject: [PATCH 01/15] misc: remove debug log --- src/client/ui/zoom.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/client/ui/zoom.js b/src/client/ui/zoom.js index 2cdc4566..0d723ce0 100644 --- a/src/client/ui/zoom.js +++ b/src/client/ui/zoom.js @@ -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 From 1987f900a05d5447b388d8c30ea3caab69f278d4 Mon Sep 17 00:00:00 2001 From: bordun Date: Fri, 7 May 2021 08:25:52 +0200 Subject: [PATCH 02/15] issue when resizing widget using keyboard shortcuts --- CHANGELOG.md | 8 +++++++- src/client/ui/ui-dragresize.js | 5 +++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 88c1b1bc..22888d14 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # Changelog +## 1.9.7 + +- bug fixes + - issue when resizing widget using keyboard shortcuts + + ## 1.9.6 - bug fixes @@ -15,7 +21,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 diff --git a/src/client/ui/ui-dragresize.js b/src/client/ui/ui-dragresize.js index 23a15d18..70c425b4 100644 --- a/src/client/ui/ui-dragresize.js +++ b/src/client/ui/ui-dragresize.js @@ -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 From 9dc123f3e306bbd7795a5816ff74ec47f951cf47 Mon Sep 17 00:00:00 2001 From: bordun Date: Fri, 7 May 2021 08:28:12 +0200 Subject: [PATCH 03/15] 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 --- CHANGELOG.md | 3 +++ src/client/editor/index.js | 35 +++++++++++++---------------------- 2 files changed, 16 insertions(+), 22 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 22888d14..9285f73c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,9 @@ - bug fixes - issue when resizing widget using keyboard shortcuts +- 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. + ## 1.9.6 diff --git a/src/client/editor/index.js b/src/client/editor/index.js index 1df1aa83..7342fbbf 100644 --- a/src/client/editor/index.js +++ b/src/client/editor/index.js @@ -330,10 +330,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 +368,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 +395,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] } } From b39477dd12c8c95957313d644421b42aa851c341 Mon Sep 17 00:00:00 2001 From: bordun Date: Fri, 7 May 2021 08:45:57 +0200 Subject: [PATCH 04/15] docs: editor arrow shortcuts --- resources/docs/docs/user-interface/editor.md | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/resources/docs/docs/user-interface/editor.md b/resources/docs/docs/user-interface/editor.md index 2be23576..9bcee9c1 100644 --- a/resources/docs/docs/user-interface/editor.md +++ b/resources/docs/docs/user-interface/editor.md @@ -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++
++down++
++left++
++right++ | Move selected widgets (1 grid unit, hold ++shift++ for 5 grid units) | + | ++ctrl+up++
++ctrl+down++
++ctrl+left++
++ctrl+right++ | Move selected widgets (1 grid unit, hold ++shift++ for 5 grid units) | | ++alt+up++
++alt+down++
++alt+left++
++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++
++down++
++left++
++right++ | Move selected widgets (1 grid unit, hold ++shift++ for 5 grid units) | + | ++cmd+up++
++cmd+down++
++cmd+left++
++cmd+right++ | Move selected widgets (1 grid unit, hold ++shift++ for 5 grid units) | | ++alt+up++
++alt+down++
++alt+left++
++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 | From 38c2750b14590a292f8c1eda2f6a11063e9e00dc Mon Sep 17 00:00:00 2001 From: bordun Date: Fri, 7 May 2021 08:47:13 +0200 Subject: [PATCH 05/15] script: bypass keyboard shortcuts already used by the editor if it is enabled --- CHANGELOG.md | 2 ++ src/client/editor/index.js | 1 + src/client/widgets/scripts/script.js | 7 ++++++- 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9285f73c..825daf3f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,8 @@ - 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 ## 1.9.6 diff --git a/src/client/editor/index.js b/src/client/editor/index.js index 7342fbbf..b35f16a8 100644 --- a/src/client/editor/index.js +++ b/src/client/editor/index.js @@ -209,6 +209,7 @@ class Editor { for (let c of combos) { keyboardJS.bind(c, (e)=>{ + e.catchedByEditor = true this.handleKeyboard(c, e) }) } diff --git a/src/client/widgets/scripts/script.js b/src/client/widgets/scripts/script.js index d60b131c..34db3990 100644 --- a/src/client/widgets/scripts/script.js +++ b/src/client/widgets/scripts/script.js @@ -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 KeyboardJS documentation)'}, + keyBinding: {type: 'string|array', value: '', help: [ + 'Key combo `string` or `array` of strings (see KeyboardJS 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 From 827ea47b6fc7a7e59ee4b05bcbfd1afb2a6ca2bf Mon Sep 17 00:00:00 2001 From: bordun Date: Fri, 7 May 2021 08:52:34 +0200 Subject: [PATCH 06/15] matrix: removed ambiguous `start` property --- CHANGELOG.md | 3 ++- src/client/widgets/containers/matrix.js | 11 ++++------- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 825daf3f..84256b7b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,7 +9,8 @@ - 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 + - script: bypass keyboard shortcuts already used by the editor if it is enabled + - matrix: removed ambiguous `start` property ## 1.9.6 diff --git a/src/client/widgets/containers/matrix.js b/src/client/widgets/containers/matrix.js index 0a6a3e09..9a8baeac 100644 --- a/src/client/widgets/containers/matrix.js +++ b/src/client/widgets/containers/matrix.js @@ -17,7 +17,6 @@ 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. `#{$}`)', @@ -60,14 +59,12 @@ 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) @@ -126,7 +123,7 @@ 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 = {} @@ -139,7 +136,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')] From 6a2b69bad7242e70c2d475777e9d9c95165802e7 Mon Sep 17 00:00:00 2001 From: bordun Date: Sat, 8 May 2021 12:35:27 +0200 Subject: [PATCH 07/15] text: add `soft` mode for the `wrap` property --- CHANGELOG.md | 1 + src/client/widgets/indicators/text.js | 6 +++--- src/scss/widgets/indicators.scss | 3 +++ 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 84256b7b..3df669fe 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ - widgets - script: bypass keyboard shortcuts already used by the editor if it is enabled - matrix: removed ambiguous `start` property + - text: add `soft` mode for the `wrap` property ## 1.9.6 diff --git a/src/client/widgets/indicators/text.js b/src/client/widgets/indicators/text.js index e10ad6da..f2f7e8cd 100644 --- a/src/client/widgets/indicators/text.js +++ b/src/client/widgets/indicators/text.js @@ -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')) diff --git a/src/scss/widgets/indicators.scss b/src/scss/widgets/indicators.scss index f88613ef..f6b8a3c2 100644 --- a/src/scss/widgets/indicators.scss +++ b/src/scss/widgets/indicators.scss @@ -85,6 +85,9 @@ white-space: pre-wrap; word-break: break-all; } + &.wrap-soft { + word-break: normal + } &.vertical { transform: rotate(180deg); text-overflow: ellipsis; From e98f270690c74d5cf76c37d47816a398fa997c08 Mon Sep 17 00:00:00 2001 From: bordun Date: Sat, 8 May 2021 12:42:50 +0200 Subject: [PATCH 08/15] matrix: advanced syntax blocks can be passed to children without being resolved at the matrix\' scope by adding an underscore before the opening bracket --- CHANGELOG.md | 1 + src/client/widgets/containers/matrix.js | 11 ++++++++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3df669fe..c9f35532 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ - 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 ## 1.9.6 diff --git a/src/client/widgets/containers/matrix.js b/src/client/widgets/containers/matrix.js index 9a8baeac..839b6eb7 100644 --- a/src/client/widgets/containers/matrix.js +++ b/src/client/widgets/containers/matrix.js @@ -19,9 +19,10 @@ class Matrix extends Panel { quantity: {type: 'number', value: 4, help: 'Defines the number of widgets in the matrix'}, 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: { @@ -70,6 +71,8 @@ class Matrix extends Panel { 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, @@ -129,6 +132,8 @@ class Matrix extends Panel { 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, From 15b52a5d25025c4599418a649c49f9ac782f50f1 Mon Sep 17 00:00:00 2001 From: bordun Date: Sat, 8 May 2021 16:02:18 +0200 Subject: [PATCH 09/15] advanced syntaxes (VAR{}): avoid storing default value as string if it can be parsed as a javascript primitive (boolean, number, etc) --- CHANGELOG.md | 1 + src/client/widgets/common/widget.js | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index c9f35532..8d15c11e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,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) - 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. diff --git a/src/client/widgets/common/widget.js b/src/client/widgets/common/widget.js index 6491f684..3f26c56b 100644 --- a/src/client/widgets/common/widget.js +++ b/src/client/widgets/common/widget.js @@ -638,6 +638,12 @@ 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 (!this.variables[name]) { this.variables[name] = {default: value, value: value, propNames: [propName]} From 41ff33123588d1309bbb79e2a93f7e829f208592 Mon Sep 17 00:00:00 2001 From: bordun Date: Sat, 8 May 2021 16:09:04 +0200 Subject: [PATCH 10/15] misc: JS{} error log --- src/client/widgets/common/widget.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/client/widgets/common/widget.js b/src/client/widgets/common/widget.js index 3f26c56b..25dffe3f 100644 --- a/src/client/widgets/common/widget.js +++ b/src/client/widgets/common/widget.js @@ -735,7 +735,7 @@ class Widget extends EventEmitter { }) } catch (err) { - this.errorProp(propName, 'JS{{}}', err) + this.errorProp(propName, 'JS{}', err) } try { From c1669cd03d549723b9baa556a6fe4e66a5b94bb9 Mon Sep 17 00:00:00 2001 From: bordun Date: Sat, 8 May 2021 16:17:43 +0200 Subject: [PATCH 11/15] advanced syntaxes (VAR{}): ignore quotes around variable name --- CHANGELOG.md | 3 ++- src/client/widgets/common/widget.js | 6 ++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8d15c11e..568a193b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,7 +4,8 @@ - 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{}): 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. diff --git a/src/client/widgets/common/widget.js b/src/client/widgets/common/widget.js index 25dffe3f..1becd336 100644 --- a/src/client/widgets/common/widget.js +++ b/src/client/widgets/common/widget.js @@ -644,6 +644,12 @@ class Widget extends EventEmitter { } 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]} From ccd11ad569fede752335bb36fb16c8a632aae8ac Mon Sep 17 00:00:00 2001 From: bordun Date: Sat, 8 May 2021 16:27:55 +0200 Subject: [PATCH 12/15] misc: syntax error --- src/client/widgets/common/widget.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/client/widgets/common/widget.js b/src/client/widgets/common/widget.js index 1becd336..4ff84269 100644 --- a/src/client/widgets/common/widget.js +++ b/src/client/widgets/common/widget.js @@ -647,7 +647,7 @@ class Widget extends EventEmitter { if ( // remove quotes (name[0] === '"' && name[name.length - 1] === '"') || - (name[0] === '\'' && name[name.length - 1] === '\'') || + (name[0] === '\'' && name[name.length - 1] === '\'') ) name = name.slice(1, name.length - 1) if (!this.variables[name]) { From cd55407e402ecbe157947207b3e51c93bd89f4c4 Mon Sep 17 00:00:00 2001 From: bordun Date: Sat, 8 May 2021 19:04:27 +0200 Subject: [PATCH 13/15] input: improve `numeric` mode on iOS --- CHANGELOG.md | 1 + src/client/widgets/basics/input.js | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 568a193b..e0829af2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,7 @@ - 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 diff --git a/src/client/widgets/basics/input.js b/src/client/widgets/basics/input.js index 57186173..db9c5221 100644 --- a/src/client/widgets/basics/input.js +++ b/src/client/widgets/basics/input.js @@ -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') From fc894166537325575a54d18fa8ebd95a5d186ec5 Mon Sep 17 00:00:00 2001 From: bordun Date: Sat, 8 May 2021 19:11:15 +0200 Subject: [PATCH 14/15] docs: dead link editor: partly revert 866890d7abc25da70f51669e18f25fc674a1f5b1 (contains unfinished changes) --- CHANGELOG.md | 2 +- src/client/editor/index.js | 12 ++++++++---- src/client/widgets/common/widget.js | 2 +- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e0829af2..bb745046 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,7 +15,7 @@ - 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 + - input: improve `numeric` mode on iOS ## 1.9.6 diff --git a/src/client/editor/index.js b/src/client/editor/index.js index b35f16a8..530b37ba 100644 --- a/src/client/editor/index.js +++ b/src/client/editor/index.js @@ -820,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 diff --git a/src/client/widgets/common/widget.js b/src/client/widgets/common/widget.js index 4ff84269..37892089 100644 --- a/src/client/widgets/common/widget.js +++ b/src/client/widgets/common/widget.js @@ -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 http://opensoundcontrol.org/spec-1_0 for existing typetags' + 'See OSC 1.0 specification for existing typetags' ]}, decimals: {type: 'integer', value: 2, help: [ 'Defines the number of decimals to send.', From 4fd618ae6539f419408b96ef68c281a9991d4fc0 Mon Sep 17 00:00:00 2001 From: bordun Date: Sat, 8 May 2021 19:26:16 +0200 Subject: [PATCH 15/15] package: 1.9.7 --- package.json | 2 +- .../docs/docs/widgets/properties-reference.md | 22 +++++++++---------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/package.json b/package.json index a5b1dd79..5e1c5b43 100644 --- a/package.json +++ b/package.json @@ -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" diff --git a/resources/docs/docs/widgets/properties-reference.md b/resources/docs/docs/widgets/properties-reference.md index 6285b24b..b99c3923 100644 --- a/resources/docs/docs/widgets/properties-reference.md +++ b/resources/docs/docs/widgets/properties-reference.md @@ -62,7 +62,7 @@ | --- | --- | --- | --- | |
address#
| `string` | "auto" | OSC address for sending / receiving messages, it must start with a slash (`/`)

By default ("auto"), the widget's id is used: `/widget_id` | |
preArgs#
| `*`|
`array` | "" | A value or array of values that will be prepended to the widget's value in the OSC messages it sends.

Incoming messages must match these to affect by the widget. | - |
typeTags#
| `string` | "" | 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 http://opensoundcontrol.org/spec-1_0 for existing typetags | + |
typeTags#
| `string` | "" | 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 OSC 1.0 specification for existing typetags | |
decimals#
| `integer` | 2 | Defines the number of decimals to send. | |
target#
| `string`|
`array`|
`null` | "" | This defines the targets of the widget's OSC messages
- A `string` or `array` of strings formatted as follow: `ip:port` or `["ip:portA", "ip:portB"]`
- If midi is enabled, targets can be `midi:device_name`
- If no target is set, messages can still be sent if the server has default targets | |
ignoreDefaults#
| `boolean` | false | Set to `true` to ignore the server's default targets | @@ -87,7 +87,7 @@ |
colorTextOn#
| `string` | "auto" | Defines the widget's text color when active. | |
label#
| `string`|
`boolean` | "auto" | Set to `false` to hide completely
- 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)
- Icons can be transformed with the following suffixes: `.flip-[horizontal|vertical|both]`, `.rotate-[90|180|270]`, `.spin`, `.pulse`. Example: `^play.flip-horizontal` | |
vertical#
| `boolean` | false | Set to `true` to display the text vertically | - |
wrap#
| `boolean` | false | Set to `true` to wrap long lines automatically. | + |
wrap#
| `boolean`|
`string` | false | Set to `true` to wrap long lines automatically. Set to `soft` to avoid breaking words.

Choices: `false`, `true`, `soft` | === "button" @@ -109,6 +109,7 @@ |
colorTextOn#
| `string` | "auto" | Defines the widget's text color when active. | |
layout#
| `string` | "vertical" | Defines how items should be laid out

Choices: `vertical`, `horizontal`, `grid` | |
gridTemplate#
| `string`|
`number` | "" | If `layout` is `grid`, can be either a number of columns or a valid value for the css property "grid-template". | + |
wrap#
| `boolean`|
`string` | false | Set to `true` to wrap long lines automatically. Set to `soft` to avoid breaking words.

Choices: `false`, `true`, `soft` | === "switch" @@ -224,7 +225,7 @@ | property | type |default | description | | --- | --- | --- | --- | |
variables#
| `*` | "@\{parent.variables}" | Defines one or more arbitrary variables that can be inherited by children widgets | - |
traversing#
| `boolean` | false | 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 | + |
traversing#
| `boolean` | false | 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

Choices: `false`, `true`, `smart` | === "value" @@ -273,7 +274,7 @@ | property | type |default | description | | --- | --- | --- | --- | | | `*` | "@\{parent.variables}" | Defines one or more arbitrary variables that can be inherited by children widgets | - | | `boolean` | false | 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 | + | | `boolean` | false | 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

Choices: `false`, `true`, `smart` | | | `boolean` | false | 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 | | --- | --- | --- | --- | |
variables#
| `*` | "@\{parent.variables}" | Defines one or more arbitrary variables that can be inherited by children widgets | - |
traversing#
| `boolean` | false | 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 | + |
traversing#
| `boolean` | false | 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

Choices: `false`, `true`, `smart` | |
widgetType#
| `string` | "button" | Defines the type of the widgets in the matrix | |
quantity#
| `number` | 4 | Defines the number of widgets in the matrix | - |
start#
| `integer` | 0 | First widget's index | - |
props#
| `object` | \{} | 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 `/$`) | + |
props#
| `object` | \{} | 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{}, 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 `/$`) | === "value" @@ -407,7 +407,7 @@ | property | type |default | description | | --- | --- | --- | --- | |
variables#
| `*` | "@\{parent.variables}" | Defines one or more arbitrary variables that can be inherited by children widgets | - |
traversing#
| `boolean` | false | 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 | + |
traversing#
| `boolean` | false | 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

Choices: `false`, `true`, `smart` | === "value" @@ -444,7 +444,7 @@ | property | type |default | description | | --- | --- | --- | --- | |
variables#
| `*` | "@\{parent.variables}" | Defines one or more arbitrary variables that can be inherited by children widgets | - |
traversing#
| `boolean` | false | 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 | + |
traversing#
| `boolean` | false | 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

Choices: `false`, `true`, `smart` | === "value" @@ -617,7 +617,7 @@ | property | type |default | description | | --- | --- | --- | --- | |
vertical#
| `boolean` | false | Set to `true` to display the text vertically | - |
wrap#
| `boolean` | false | Set to `true` to wrap long lines automatically. | + |
wrap#
| `boolean`|
`string` | false | Set to `true` to wrap long lines automatically. Set to `soft` to avoid breaking words.

Choices: `false`, `true`, `soft` | |
align#
| `string` | "center" | Text alignment.

Choices: `center`, `left`, `right`, `top`, `bottom`, `left top`, `left bottom`, `right top`, `right bottom` | ## Pads @@ -803,7 +803,7 @@ | --- | --- | --- | --- | |
script#
| `script` | "" | Script executed whenever the widget's receives the defined event. See documentation. | |
event#
| `string` | "value" | Define which events trigger the script's execution.

Choices: `value`, `keyboard`, `once` | - |
keyBinding#
| `string`|
`array` | "" | Key combo `string` or `array` of strings (see KeyboardJS documentation) | + |
keyBinding#
| `string`|
`array` | "" | Key combo `string` or `array` of strings (see KeyboardJS documentation).

If the editor is enabled, some keys / combos will not work. | |
keyRepeat#
| `boolean` | true | Set to `false` to prevent keydown repeats when holding the key combo pressed | |
keyType#
| `string` | "keydown" | Determines which key event trigger the script's execution

Choices: `keydown`, `keyup`, `both` |