Merge branch 'master' of github.com:jean-emmanuel/open-stage-control
This commit is contained in:
commit
54f1c79046
7 changed files with 37 additions and 22 deletions
|
|
@ -1,5 +1,11 @@
|
|||
# CSS Tips
|
||||
|
||||
## Browser inspector
|
||||
|
||||
|
||||
Hit `F12` to open the developers tools panel. The html/css inspector helps retreiving the class names needed to style specific parts of the widgets
|
||||
|
||||
|
||||
## Inline syntax
|
||||
|
||||
For simple use cases, the `css` property can be written as a HTML inline styles (without any CSS selector). CSS rules will apply to the widget element.
|
||||
|
|
@ -84,19 +90,3 @@ Media queries can also be used:
|
|||
[CSS variables](https://developer.mozilla.org/en-US/docs/Web/CSS/Using_CSS_custom_properties) declared in the [default theme](https://github.com/jean-emmanuel/open-stage-control/blob/master/src/scss/themes/default.scss) can be overriden.
|
||||
|
||||
Widgets also rely on CSS variables for the style properties (colors, padding, etc). These are documented in the widgets' `css` property description.
|
||||
|
||||
## Other tips
|
||||
|
||||
#### Use the inspector
|
||||
|
||||
Hit `F12` to open the developers tools panel. The html/css inspector helps retreiving the class names needed to style specific parts of the widgets.
|
||||
|
||||
#### Panel's background-color
|
||||
|
||||
This works for panel, strip and tabs:
|
||||
|
||||
```css
|
||||
> .panel {
|
||||
background-color: red;
|
||||
}
|
||||
```
|
||||
|
|
|
|||
|
|
@ -64,6 +64,14 @@ Returns the property called `"name"` of the first matching widget.
|
|||
|
||||
----
|
||||
|
||||
#### `updateProp`: `function(id, name)`
|
||||
- `id`: widget `id` as a string. Can be `"this"` to target the host widget, or `"parent"` to target the parent widget.
|
||||
- `name`: property name.
|
||||
|
||||
Forcers a widget to check if one of its properties has changed and update itself if needed.
|
||||
|
||||
----
|
||||
|
||||
#### `httpGet`: `function(url, callback)`
|
||||
|
||||
- `url`: url of the resource to fetch (local url only)
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ module.exports = class Plot extends StaticProperties(Canvas, {bypass: true, inte
|
|||
logScaleX: {type: 'boolean|number', value: false, help: 'Set to `true` to use logarithmic scale for the x axis (base 10). Set to a `number` to define the logarithm\'s base.'},
|
||||
logScaleY: {type: 'boolean|number', value: false, help: 'Set to `true` to use logarithmic scale for the y axis (base 10). Set to a `number` to define the logarithm\'s base.'},
|
||||
origin: {type: 'number', value: 'auto', help: 'Defines the y axis origin. Set to `false` to disable it.'},
|
||||
dots: {type: 'boolean', value: true, help: 'Draw dots on the line'},
|
||||
dots: {type: 'boolean', value: false, help: 'Draw dots on the line'},
|
||||
bars: {type: 'boolean', value: false, help: 'Set to `true` to use draw bars instead (disables `logScaleX` and forces `x axis` even spacing)'},
|
||||
pips:{type: 'boolean', value: true, help: 'Set to `false` to hide the scale'},
|
||||
|
||||
|
|
@ -186,7 +186,7 @@ module.exports = class Plot extends StaticProperties(Canvas, {bypass: true, inte
|
|||
this.ctx.lineWidth = 2 * PXSCALE
|
||||
for (var i = 0; i < points.length; i += 2) {
|
||||
this.ctx.beginPath()
|
||||
this.ctx.arc(points[i], points[i + 1], 3 * PXSCALE, 0, 2*Math.PI)
|
||||
this.ctx.arc(points[i], points[i + 1], 2 * PXSCALE, 0, 2*Math.PI)
|
||||
this.ctx.fill()
|
||||
this.ctx.stroke()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -132,6 +132,21 @@ class ScriptVm extends Vm {
|
|||
|
||||
}
|
||||
|
||||
this.sandbox.contentWindow.updateProp = (id, prop)=>{
|
||||
|
||||
var widgets = this.resolveId(id),
|
||||
widget = this.getWidget()
|
||||
|
||||
if (widget.builtIn) widget = widget.parent
|
||||
|
||||
for (var i = widgets.length - 1; i >= 0; i--) {
|
||||
|
||||
widgets[i].updateProps(Array.isArray(prop) ? prop : [prop], widget)
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
this.sandbox.contentWindow.httpGet = (url, callback)=>{
|
||||
|
||||
var parser = urlParser(url),
|
||||
|
|
@ -263,7 +278,7 @@ class ScriptVm extends Vm {
|
|||
|
||||
}
|
||||
|
||||
for (var imports of ['set', 'get', 'getProp', 'send', 'httpGet', 'stateGet', 'stateSet', 'storage',
|
||||
for (var imports of ['set', 'get', 'getProp', 'updateProp', 'send', 'httpGet', 'stateGet', 'stateSet', 'storage',
|
||||
'setInterval', 'clearInterval', 'setTimeout', 'clearTimeout']) {
|
||||
this.sanitize(this.sandbox.contentWindow[imports])
|
||||
}
|
||||
|
|
|
|||
|
|
@ -105,7 +105,7 @@ class Script extends Widget {
|
|||
|
||||
this.scriptLock = true
|
||||
try {
|
||||
this.script(context, this.parsersLocalScope)
|
||||
this.script(context, this.builtIn ? this.parent.parsersLocalScope : this.parsersLocalScope)
|
||||
} catch(e) {
|
||||
console.log(e)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -69,7 +69,7 @@ $padding: 8rem;
|
|||
// border: $padding solid var(--color-ui-background);
|
||||
padding: $padding;
|
||||
background: var(--color-ui-background);
|
||||
.btn, input {
|
||||
.btn {
|
||||
margin: 1rem;
|
||||
margin-left: $padding;
|
||||
text-overflow: clip;
|
||||
|
|
@ -82,6 +82,7 @@ $padding: 8rem;
|
|||
.save-as {
|
||||
flex:1;
|
||||
border: 0;
|
||||
margin: 1rem;
|
||||
padding: 0 10rem;
|
||||
font-size: 120%;
|
||||
position: relative;
|
||||
|
|
|
|||
|
|
@ -101,8 +101,9 @@ $padding: 8rem;
|
|||
white-space: normal;
|
||||
line-height: 150%;
|
||||
background: var(--color-background);
|
||||
padding-top:8rem;
|
||||
padding: $padding;
|
||||
overflow-x: auto;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue