matrices: add spacing option

This commit is contained in:
jean-emmanuel 2017-07-21 20:56:27 +02:00
parent feee5a363c
commit 669de6d32e
6 changed files with 87 additions and 9 deletions

View file

@ -230,7 +230,7 @@
"dashed": true,
"color": "auto",
"css": "margin: 20rem 0 20rem 10rem;",
"widgetId": "",
"widgetId": "knob_1",
"range": {
"min": 0,
"max": 1
@ -246,7 +246,7 @@
},
{
"type": "meter",
"id": "meter_1",
"id": "meter_2",
"label": false,
"unit": "",
"alignRight": false,
@ -255,7 +255,7 @@
"dashed": true,
"color": "auto",
"css": "margin: 20rem 0",
"widgetId": "",
"widgetId": "knob_2",
"range": {
"min": 0,
"max": 1
@ -684,6 +684,61 @@
"preArgs": [],
"split": false,
"target": []
},
{
"type": "multipush",
"top": 10,
"left": 620,
"id": "multipush",
"matrix": [
2,
4
],
"start": 0,
"spacing": 5,
"label": "auto",
"width": 130,
"height": 220,
"color": "auto",
"css": "",
"traversing": true,
"on": 1,
"off": 0,
"value": "",
"precision": 2,
"address": "/multipush",
"preArgs": [],
"split": false,
"target": [],
"style": "style",
"norelease": false
},
{
"type": "multitoggle",
"top": 240,
"left": 620,
"matrix": [
2,
4
],
"start": 0,
"spacing": 5,
"label": "auto",
"width": 130,
"height": 220,
"color": "auto",
"css": "",
"traversing": true,
"on": 1,
"off": 0,
"value": "",
"precision": 2,
"address": "/multipush",
"preArgs": [],
"split": false,
"target": [],
"led": true,
"id": "multitoggle"
}
],
"tabs": [],

View file

@ -82,6 +82,11 @@ Unidirectionnal panel with stretching capability. By default, children widgets t
- default: `false`
- usage: set to `true` to stretch widgets evenly
### `spacing`
- type: `integer`
- default: `0`
- usage: adds space between widgets
### `border`
- type: `boolean`
- default: `true`

View file

@ -69,6 +69,11 @@ Multifader creates a row of vertical faders that respond to the same gestures.
- default: `0`
- usage: first toggle's index
### `spacing`
- type: `integer`
- default: `0`
- usage: adds space between widgets
### `traversing`
- type: `boolean`
- default: `true`
@ -112,6 +117,10 @@ Multifader creates a row of vertical faders that respond to the same gestures.
- default: `0`
- usage: first push's index
### `spacing`
- type: `integer`
- default: `0`
- usage: adds space between widgets
### `traversing`
- type: `boolean`

View file

@ -12,8 +12,9 @@ module.exports = class Multipush extends _matrices_base {
matrix: [2,2],
start:0,
spacing:0,
style:'style',
_style:'style',
label:'auto',
left:'auto',
@ -46,6 +47,10 @@ module.exports = class Multipush extends _matrices_base {
super(options)
this.widget[0].style.setProperty('--columns', this.getProp('matrix')[0])
this.widget[0].style.setProperty('--rows', this.getProp('matrix')[1])
this.widget[0].style.setProperty('--spacing', this.getProp('spacing') + 'rem')
var strData = JSON.stringify(options.props)
var parsers = require('../../parser'),
@ -65,7 +70,6 @@ module.exports = class Multipush extends _matrices_base {
data.css = ''
var element = parsewidgets([data],this.widget)
element[0].style.setProperty('width', 100/this.getProp('matrix')[0] + '%')
element[0].classList.add('not-editable')
this.value[i-this.start] = this.getProp('off')

View file

@ -12,6 +12,7 @@ module.exports = class Multitoggle extends _matrices_base {
matrix: [2,2],
start:0,
spacing:0,
_style:'style',
@ -46,6 +47,10 @@ module.exports = class Multitoggle extends _matrices_base {
super(options)
this.widget[0].style.setProperty('--columns', this.getProp('matrix')[0])
this.widget[0].style.setProperty('--rows', this.getProp('matrix')[1])
this.widget[0].style.setProperty('--spacing', this.getProp('spacing') + 'rem')
var strData = JSON.stringify(options.props)
var parsers = require('../../parser'),
@ -65,7 +70,6 @@ module.exports = class Multitoggle extends _matrices_base {
data.css = ''
var element = parsewidgets([data],this.widget)
element[0].style.setProperty('width', 100/this.getProp('matrix')[0] + '%')
element[0].classList.add('not-editable')
this.value[i-this.start] = this.getProp('off')

View file

@ -20,12 +20,13 @@
flex-direction: row;
padding:1rem 2rem 2rem 1rem;
> .widget {
min-height: 0;
min-width: 0;
margin:0!important;
height: auto;
// margin:0!important;
height: calc( 100% / var(--rows) - var(--spacing));
width: calc( 100% / var(--columns) - var(--spacing));
margin: calc(var(--spacing) / 2);
.label {
background:none;
border:0;