Compare commits
249 commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a2b4bd48b9 | ||
|
|
7d4064486d | ||
|
|
df4b098032 | ||
|
|
45d454d389 | ||
|
|
12534ac102 | ||
|
|
81c2178b7b | ||
|
|
96db4489b5 | ||
|
|
7c594167a0 | ||
|
|
a75300aef9 | ||
|
|
fac6992cd5 | ||
|
|
3d2b2e0586 | ||
|
|
c541f3f35b | ||
|
|
867ccfc2f6 | ||
|
|
00cc41ddc2 | ||
|
|
e227ded1ad | ||
|
|
782dd1f673 | ||
|
|
18390be315 | ||
|
|
b2345e456b | ||
|
|
ee746d4d1c | ||
|
|
8fd3198c46 | ||
|
|
ad40de2ffb | ||
|
|
e851361992 | ||
|
|
1d7d99a9e8 | ||
|
|
8a67f7d861 | ||
|
|
95843e59bd | ||
|
|
2f61b05af1 | ||
|
|
836ddbfcfb | ||
|
|
1eeb38367c | ||
|
|
5e8aea0022 | ||
|
|
e8a5c83b00 | ||
|
|
122bf58057 | ||
|
|
3402efe0a6 | ||
|
|
3a46d25e9c | ||
|
|
7c7bbf7639 | ||
|
|
93c08db3a3 | ||
|
|
d6df5793bb | ||
|
|
dec1c947e0 | ||
|
|
f84696ac31 | ||
|
|
631e83ca67 | ||
|
|
02068e6d4d | ||
|
|
edbfaf1249 | ||
|
|
a274fabb95 | ||
|
|
27b1ede452 | ||
|
|
3d3b7e1568 | ||
|
|
941c5ba847 | ||
|
|
28c4bee396 | ||
|
|
b3ec24e28f | ||
|
|
71d21062cf | ||
|
|
81d07d46bc | ||
|
|
c8d3529523 | ||
|
|
1950a55cf1 | ||
|
|
7bc93922d8 | ||
|
|
2df088d5fc | ||
|
|
4106e33049 | ||
|
|
72ddb4d396 | ||
|
|
bd2e7b16ae | ||
|
|
bd86a5df0e | ||
|
|
bf51aee607 | ||
|
|
31c201fcda | ||
|
|
5b52ff4d41 | ||
|
|
7752ed22cb | ||
|
|
012949dbe5 | ||
|
|
7df37e2afa | ||
|
|
9f3c762926 | ||
|
|
cf43836778 | ||
|
|
4af2729faa | ||
|
|
2abba54d59 | ||
|
|
ff2fdab80c | ||
|
|
0cd1a1a33c | ||
|
|
370bee3cd4 | ||
|
|
9efb0f4b86 | ||
|
|
3f807c6aee | ||
|
|
dfe157f54c | ||
|
|
bf97566730 | ||
|
|
1c2f683468 | ||
|
|
2ff9c52f45 | ||
|
|
6a73a4b1f2 | ||
|
|
d19bc1b38c | ||
|
|
3e720b072e | ||
|
|
46ea30b576 | ||
|
|
55720cea18 | ||
|
|
5a6c1658f9 | ||
|
|
82960592dc | ||
|
|
bab6647815 | ||
|
|
75f50c044c | ||
|
|
f298d73d1d | ||
|
|
6bfd949e34 | ||
|
|
9ef0a508a7 | ||
|
|
dd62bf8b28 | ||
|
|
eb661a0a17 | ||
|
|
410949e6e7 | ||
|
|
090ce0ed70 | ||
|
|
23f2f9151c | ||
|
|
f62c9ded6e | ||
|
|
1c699a7800 | ||
|
|
42f2bd2932 | ||
|
|
54c481751e | ||
|
|
901367677d | ||
|
|
201e4886e3 | ||
|
|
1c8211214b | ||
|
|
b8a723daaf | ||
|
|
076e94a0c3 | ||
|
|
3f4695ec3c | ||
|
|
b9c960f8da | ||
|
|
7d2e7843cd | ||
|
|
15128b05ec | ||
|
|
049a296e61 | ||
|
|
7f61710e24 | ||
|
|
86e3487e0a | ||
|
|
f145839454 | ||
|
|
bd2e6fa102 | ||
|
|
fcabbae8b2 | ||
|
|
c037f734e9 | ||
|
|
f1febf53fb | ||
|
|
6fbf9f87a4 | ||
|
|
3757f9c1c4 | ||
|
|
b7a866634c | ||
|
|
911084c513 | ||
|
|
949ba4a645 | ||
|
|
43fd389e40 | ||
|
|
6283726360 | ||
|
|
e5cfbbc91c | ||
|
|
9d919c7ea7 | ||
|
|
c896b38b43 | ||
|
|
ed2f35d649 | ||
|
|
2fa0f165de | ||
|
|
4b8e6edec9 | ||
|
|
b4d78d87f4 | ||
|
|
6e4a3af441 | ||
|
|
97cacd46ea | ||
|
|
3c83a35c37 | ||
|
|
8c194be517 | ||
|
|
412866e417 | ||
|
|
a4266e2e76 | ||
|
|
ae74946493 | ||
|
|
b96bf4f6f8 | ||
|
|
25d4318e7f | ||
|
|
c9354f3c78 | ||
|
|
c93db8b3c6 | ||
|
|
77b3b6be85 | ||
|
|
aced94adfd | ||
|
|
ead0d0f981 | ||
|
|
80cf05b1d2 | ||
|
|
66ca153a34 | ||
|
|
eff2375a4b | ||
|
|
a6401b63e2 | ||
|
|
667c880745 | ||
|
|
408945e399 | ||
|
|
e4fbb55d09 | ||
|
|
17db9f5d77 | ||
|
|
370c73c7aa | ||
|
|
d86375f536 | ||
|
|
3cf45e9102 | ||
|
|
dff4e252d3 | ||
|
|
ee7d167c53 | ||
|
|
dda61f4641 | ||
|
|
69a4623dfd | ||
|
|
c544a37434 | ||
|
|
040c462ae8 | ||
|
|
f36664718d | ||
|
|
532ba56635 | ||
|
|
d753646118 | ||
|
|
e874cc7f96 | ||
|
|
f9dc4f3d9d | ||
|
|
f2be501509 | ||
|
|
aceb8e175d | ||
|
|
12d134d8a2 | ||
|
|
cfe0fe994f | ||
|
|
677d67f8e3 | ||
|
|
f4cdf11c7f | ||
|
|
d2d3faf43d | ||
|
|
43d6f2df0b | ||
|
|
98e287b9e8 | ||
|
|
e6a6a38865 | ||
|
|
f6fb539e83 | ||
|
|
dca301ae2e | ||
|
|
840be72b2e | ||
|
|
f25346015c | ||
|
|
ef2de79613 | ||
|
|
ca6eb09a48 | ||
|
|
891d1092f5 | ||
|
|
1d221b7613 | ||
|
|
2239c06bbb | ||
|
|
fd1c34928d | ||
|
|
050988b6d1 | ||
|
|
e842044652 | ||
|
|
b4d361f28a | ||
|
|
e733f3e556 | ||
|
|
d66277866a | ||
|
|
8cdf821926 | ||
|
|
caf412f16b | ||
|
|
0c12dfe6fd | ||
|
|
8b0f271419 | ||
|
|
b5c8427011 | ||
|
|
96fd5effdc | ||
|
|
6d0947aea9 | ||
|
|
b3c82251f9 | ||
|
|
8b59296010 | ||
|
|
02c39debf2 | ||
|
|
7b2da56bd1 | ||
|
|
83e338a183 | ||
|
|
993d3c6914 | ||
|
|
bdfe6f6bb9 | ||
|
|
56a05b61be | ||
|
|
87903a484e | ||
|
|
41f77d8ffe | ||
|
|
c24fba0d07 | ||
|
|
0be383c79d | ||
|
|
e2ad561010 | ||
|
|
0986d2ae9d | ||
|
|
c89eb4f84f | ||
|
|
f91b4c1ec3 | ||
|
|
d7ce10c5e2 | ||
|
|
1849f2a6a9 | ||
|
|
a263233bbd | ||
|
|
185d4c6b80 | ||
|
|
c904b941ba | ||
|
|
ce7b6750c9 | ||
|
|
cd05e21d47 | ||
|
|
93fa6b2f72 | ||
|
|
e5a123977f | ||
|
|
d665222d9f | ||
|
|
dea2b19ad5 | ||
|
|
57133f35e1 | ||
|
|
1c3389d736 | ||
|
|
e1e54c038b | ||
|
|
e65d287907 | ||
|
|
c1dc378603 | ||
|
|
a432d52a68 | ||
|
|
6003add49a | ||
|
|
ec1434a651 | ||
|
|
30b55b6652 | ||
|
|
51eb674cd3 | ||
|
|
0aefc2dfab | ||
|
|
6c292e1d49 | ||
|
|
bc3d6db62f | ||
|
|
1d1281e1d8 | ||
|
|
dc01b51128 | ||
|
|
db81e18443 | ||
|
|
d69d20b6e4 | ||
|
|
95ae2f50e8 | ||
|
|
6fb8bf9438 | ||
|
|
9d210294ce | ||
|
|
60fd409b75 | ||
|
|
17cde3a3df | ||
|
|
3279223e75 | ||
|
|
9bf7428108 | ||
|
|
1f75b25996 | ||
|
|
0e078b2c4f |
|
|
@ -2,7 +2,7 @@ anHsudo: required
|
|||
dist: trusty
|
||||
language: node_js
|
||||
node_js:
|
||||
- "6"
|
||||
- "9"
|
||||
before_install:
|
||||
- sudo dpkg --add-architecture i386
|
||||
- sudo apt-get update -qq
|
||||
|
|
@ -34,13 +34,13 @@ before_deploy:
|
|||
- mv open-stage-control-linux-ia32 open-stage-control-${VERSION}-linux-ia32
|
||||
- mv open-stage-control-linux-x64 open-stage-control-${VERSION}-linux-x64
|
||||
- mv open-stage-control-linux-armv7l open-stage-control-${VERSION}-linux-armv7l
|
||||
- mv open-stage-control-linux-arm64 open-stage-control-${VERSION}-linux-arm64
|
||||
# - mv open-stage-control-linux-arm64 open-stage-control-${VERSION}-linux-arm64
|
||||
- zip -q -r --symlinks packages/open-stage-control-${VERSION}-osx.zip open-stage-control-darwin-x64/open-stage-control.app
|
||||
- zip -q -r packages/open-stage-control-${VERSION}-win32-ia32.zip open-stage-control-${VERSION}-win32-ia32
|
||||
- zip -q -r packages/open-stage-control-${VERSION}-win32-x64.zip open-stage-control-${VERSION}-win32-x64
|
||||
- zip -q -r packages/open-stage-control-${VERSION}-linux-ia32.zip open-stage-control-${VERSION}-linux-ia32
|
||||
- zip -q -r packages/open-stage-control-${VERSION}-linux-x64.zip open-stage-control-${VERSION}-linux-x64
|
||||
- zip -q -r packages/open-stage-control-${VERSION}-linux-armv7l.zip open-stage-control-${VERSION}-linux-armv7l
|
||||
- zip -q -r packages/open-stage-control-${VERSION}-linux-arm64.zip open-stage-control-${VERSION}-linux-arm64
|
||||
# - zip -q -r packages/open-stage-control-${VERSION}-linux-arm64.zip open-stage-control-${VERSION}-linux-arm64
|
||||
- ls packages
|
||||
- cd ..
|
||||
|
|
|
|||
57
CHANGELOG.md
|
|
@ -1,11 +1,66 @@
|
|||
# Changelog
|
||||
|
||||
## 0.23.0
|
||||
|
||||
- bug fixes
|
||||
- plots now send their value to other widget for synchronization as expected
|
||||
- text widgets now apply their target widget's precision
|
||||
- property inheritance accepts targetting a parent widget by its id
|
||||
- multiple icons not displayed correctly
|
||||
- broken `--blank` option
|
||||
- main
|
||||
- added `--disable-gpu` option for disabling hardware acceleration (fixes rendering glitches and reduces input lag on some systems)
|
||||
- widgets
|
||||
- inputs: **new** `keys` widget, for keyboard bindings
|
||||
- property inheritance: new special property name `_value` (retrieve the widget's value, and update when it changes)
|
||||
- switch: added `showValues` to display both values and labels in the buttons; array values can now be selected via osc
|
||||
- range: both handles can be moved by holding `shift` while dragging
|
||||
- rgb: **removed** `touchAddress` option
|
||||
- labels/texts: multiple white spaces are no longer merged
|
||||
- plot: can receive stringified arrays of coordinates or stringified objects for merging coordinates sets; added `bars` option for drawing barcharts;
|
||||
- widgets' `precision` option allows setting a specific data type for numbers (sliders can send doubles !)
|
||||
- misc
|
||||
- event system rewritten
|
||||
- js build size reduced
|
||||
|
||||
## 0.22.0
|
||||
|
||||
- bug fixes
|
||||
- sessions opened from command line with relative paths are now added to the history with their absolute path
|
||||
- sending an empty message to a `text` widget resets it to its initial value and without ignoring its `value` property
|
||||
- sending no value to a widget with `preArgs` is now possible : all the arguments found in incomming osc messages are now taken into account to match the widgets in the session
|
||||
- regression breaking state quicksave from sidepanel
|
||||
- engine
|
||||
- downgraded to the latest *stable* electron release
|
||||
- main
|
||||
- added `zeroconf` / `bonjour` publishing for the app's http and osc input ports
|
||||
- added `--instance-name` option to differenciate mulitple instances in zeroconf networks
|
||||
- widgets
|
||||
- sliders/pads: holding `Ctrl` now enables high precision dragging with the mouse and bypasses the `snap` option
|
||||
- inputs: renamed `input`'s property `horizontal` to `vertical` to match how the widget actually displays
|
||||
- sliders: **new** `range` widget
|
||||
- plots: **new** `image` widget
|
||||
- remote control
|
||||
- **removed** deprecated `/EXEC`
|
||||
- renamed `/EDIT_SOFT` to `/EDIT/MERGE`
|
||||
- added `/EDIT/GET` (get a widget's data)
|
||||
- added `/GET` (get a widget's value)
|
||||
- added `/SET` (set a widget's value as if it was interacted with from the interface)
|
||||
|
||||
|
||||
## 0.21.3
|
||||
|
||||
- bug fixes
|
||||
- session/state: regression (0.21.2) breaking save-to-file function
|
||||
- ui
|
||||
- FontAwesome 5 (icon font) !
|
||||
|
||||
## 0.21.2
|
||||
|
||||
- bug fixes
|
||||
- cli: broken long flag `--no-gui`
|
||||
- headless: when running with `node`, errors don't stop the server; when running with `electron` (default), errors are logged in the console instead of being showed in a dialog window
|
||||
- switcher widgets regression (broken)
|
||||
- switcher widgets regression (broken)
|
||||
- midi
|
||||
- float values are now allowed and automatically rounded
|
||||
- misc
|
||||
|
|
|
|||
|
|
@ -46,6 +46,6 @@ This program is a free software released under the GNU/GPL3 license, it relies o
|
|||
|
||||
----
|
||||
|
||||
<a href="http://browserstack.com/"><img alt="BrowserStack" src="http://osc.ammd.net/img/logo-browserstack.svg" width="300" /></a>
|
||||
<a href="http://browserstack.com/"><img alt="BrowserStack" src="http://osc.ammd.net/img/logo-browserstack.png" width="300" /></a>
|
||||
|
||||
BrowserStack helps debugging Open Stage Control by providing a complete suite of browser emulators for Android, iOS and Windows, how awesome is that ? *Quite very much indeed !*
|
||||
|
|
|
|||
BIN
app/browser/fonts/fa-solid-900.woff
Normal file
14
app/browser/fonts/fa-solid.css
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
/*!
|
||||
* Font Awesome Free 5.0.0 by @fontawesome - http://fontawesome.com
|
||||
* License - http://fontawesome.com/license (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License)
|
||||
*/
|
||||
@font-face {
|
||||
font-family: FontAwesome;
|
||||
font-style: normal;
|
||||
font-weight: 900;
|
||||
src: url("./fa-solid-900.woff") format("woff")}
|
||||
|
||||
.fa,
|
||||
.fas {
|
||||
font-family: FontAwesome;
|
||||
font-weight: 900; }
|
||||
4
app/browser/fonts/font-awesome.min.css
vendored
5
app/browser/fonts/fontawesome.min.css
vendored
Normal file
|
|
@ -3,18 +3,18 @@
|
|||
<head>
|
||||
<meta charset="utf-8"/>
|
||||
<meta name="viewport" content="width=device-width, user-scalable=no"/>
|
||||
<link rel="preload" href="fonts/fontawesome-webfont.woff" as="font"/>
|
||||
<link rel="preload" href="fonts/roboto-medium.woff" as="font"/>
|
||||
<link rel="preload" href="scripts.js.map" as="fetch"/>
|
||||
<link rel="stylesheet" type="text/css" href="styles.css" hot-reload/>
|
||||
<link rel="stylesheet" type="text/css" href="theme.css" hot-reload/>
|
||||
<link rel="stylesheet" type="text/css" href="fonts/font-awesome.min.css"/>
|
||||
<link rel="stylesheet" type="text/css" href="fonts/roboto-medium.css"/>
|
||||
<script src="scripts.js"></script>
|
||||
<link rel="preload" href="browser/fonts/fa-solid-900.woff" as="font"/>
|
||||
<link rel="preload" href="browser/fonts/roboto-medium.woff" as="font"/>
|
||||
<link rel="stylesheet" type="text/css" href="browser/styles.css" hot-reload/>
|
||||
<link rel="stylesheet" type="text/css" href="browser/theme.css" hot-reload/>
|
||||
<link rel="stylesheet" type="text/css" href="browser/fonts/fontawesome.min.css"/>
|
||||
<link rel="stylesheet" type="text/css" href="browser/fonts/fa-solid.css"/>
|
||||
<link rel="stylesheet" type="text/css" href="browser/fonts/roboto-medium.css"/>
|
||||
<script src="browser/scripts.js"></script>
|
||||
<link rel="shortcut icon" href="browser/favicon.png?2"/>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div id="lobby"></div>
|
||||
<div id="container"></div>
|
||||
<div id="sidepanel"></div>
|
||||
</body>
|
||||
|
|
|
|||
|
|
@ -148,7 +148,7 @@
|
|||
"id": "time",
|
||||
"label": false,
|
||||
"vertical": false,
|
||||
"css": "font-size:140%; flex:4",
|
||||
"css": "font-size:120%; flex:4",
|
||||
"preArgs": [],
|
||||
"value": "00:00:00:00",
|
||||
"address": "/position/smpte",
|
||||
|
|
@ -266,7 +266,7 @@
|
|||
"type": "strip",
|
||||
"id": "trim_@{parent.variables.n}",
|
||||
"label": false,
|
||||
"height": 50,
|
||||
"height": 60,
|
||||
"color": "auto",
|
||||
"css": "",
|
||||
"horizontal": true,
|
||||
|
|
@ -279,55 +279,50 @@
|
|||
"type": "strip",
|
||||
"id": "trim_meta_@{parent.variables.n}",
|
||||
"label": false,
|
||||
"width": "auto",
|
||||
"width": 50,
|
||||
"color": "auto",
|
||||
"css": "",
|
||||
"horizontal": false,
|
||||
"horizontal": true,
|
||||
"stretch": true,
|
||||
"border": false,
|
||||
"spacing": 0,
|
||||
"variables": "@{parent.variables}",
|
||||
"widgets": [
|
||||
{
|
||||
"type": "input",
|
||||
"type": "text",
|
||||
"id": "trim_label_@{parent.variables.n}",
|
||||
"label": false,
|
||||
"color": "auto",
|
||||
"css": "",
|
||||
"value": "Trim",
|
||||
"preArgs": [],
|
||||
"widgetId": "",
|
||||
"height": 20,
|
||||
"linkId": "",
|
||||
"unit": "",
|
||||
"horizontal": false,
|
||||
"editable": false,
|
||||
"precision": 2,
|
||||
"target": [],
|
||||
"address": "/trim_label_@{parent.variables.n}"
|
||||
"address": "/trim_label_@{parent.variables.n}",
|
||||
"vertical": true,
|
||||
"width": "auto",
|
||||
"css": "line-height:12rem"
|
||||
},
|
||||
{
|
||||
"type": "input",
|
||||
"id": "trim_input_@{parent.variables.n}",
|
||||
"label": false,
|
||||
"color": "auto",
|
||||
"css": "",
|
||||
"preArgs": [],
|
||||
"widgetId": "trim_knob_@{parent.variables.n}",
|
||||
"height": 20,
|
||||
"linkId": "",
|
||||
"unit": "",
|
||||
"horizontal": false,
|
||||
"editable": true,
|
||||
"precision": 2,
|
||||
"precision": 1,
|
||||
"target": [],
|
||||
"value": "",
|
||||
"address": "/trim_input_@{parent.variables.n}"
|
||||
"address": "/trim_input_@{parent.variables.n}",
|
||||
"width": "auto",
|
||||
"css": "",
|
||||
"vertical": true
|
||||
}
|
||||
],
|
||||
"_style": "style",
|
||||
"_children": "children",
|
||||
"scroll": true,
|
||||
"css": "",
|
||||
"_geometry": "geometry",
|
||||
"_panel": "panel",
|
||||
"layout": "",
|
||||
|
|
@ -442,7 +437,7 @@
|
|||
"type": "toggle",
|
||||
"id": "disk_@{parent.variables.n}",
|
||||
"linkId": "",
|
||||
"label": "^hdd-o",
|
||||
"label": "^hdd",
|
||||
"css": "",
|
||||
"on": 1,
|
||||
"off": 0,
|
||||
|
|
@ -588,7 +583,6 @@
|
|||
"label": false,
|
||||
"unit": "dB",
|
||||
"height": 30,
|
||||
"horizontal": false,
|
||||
"color": "auto",
|
||||
"css": "margin:5rem 5rem 0",
|
||||
"widgetId": "fader_@{parent.variables.n}",
|
||||
|
|
@ -597,7 +591,8 @@
|
|||
"precision": 2,
|
||||
"preArgs": [],
|
||||
"target": [],
|
||||
"address": "/fader_input_@{parent.variables.n}"
|
||||
"address": "/fader_input_@{parent.variables.n}",
|
||||
"vertical": false
|
||||
},
|
||||
{
|
||||
"type": "fader",
|
||||
|
|
@ -928,7 +923,7 @@
|
|||
"type": "strip",
|
||||
"id": "master_trim_strip",
|
||||
"label": false,
|
||||
"height": 50,
|
||||
"height": 60,
|
||||
"color": "auto",
|
||||
"css": "",
|
||||
"horizontal": true,
|
||||
|
|
@ -941,55 +936,50 @@
|
|||
"type": "strip",
|
||||
"id": "trim_meta_@{parent.variables.n}",
|
||||
"label": false,
|
||||
"width": "auto",
|
||||
"width": 50,
|
||||
"color": "auto",
|
||||
"css": "",
|
||||
"horizontal": false,
|
||||
"horizontal": true,
|
||||
"stretch": true,
|
||||
"border": false,
|
||||
"spacing": 0,
|
||||
"variables": "@{parent.variables}",
|
||||
"widgets": [
|
||||
{
|
||||
"type": "input",
|
||||
"type": "text",
|
||||
"id": "mastertrim_label",
|
||||
"label": false,
|
||||
"color": "auto",
|
||||
"css": "",
|
||||
"css": "line-height:12rem",
|
||||
"value": "Trim",
|
||||
"preArgs": [],
|
||||
"widgetId": "",
|
||||
"height": 20,
|
||||
"linkId": "",
|
||||
"unit": "",
|
||||
"horizontal": false,
|
||||
"editable": false,
|
||||
"precision": 2,
|
||||
"target": [],
|
||||
"address": "/mastertrim_label"
|
||||
"address": "/mastertrim_label",
|
||||
"vertical": true,
|
||||
"width": "auto"
|
||||
},
|
||||
{
|
||||
"type": "input",
|
||||
"id": "mastertrim_input",
|
||||
"label": false,
|
||||
"color": "auto",
|
||||
"css": "",
|
||||
"preArgs": [],
|
||||
"widgetId": "mastertrim",
|
||||
"height": 20,
|
||||
"linkId": "",
|
||||
"unit": "",
|
||||
"horizontal": false,
|
||||
"editable": true,
|
||||
"precision": 2,
|
||||
"precision": 1,
|
||||
"target": [],
|
||||
"value": "",
|
||||
"address": "/mastertrim_input"
|
||||
"address": "/mastertrim_input",
|
||||
"width": "auto",
|
||||
"css": "",
|
||||
"vertical": true
|
||||
}
|
||||
],
|
||||
"_style": "style",
|
||||
"_children": "children",
|
||||
"scroll": true,
|
||||
"css": "",
|
||||
"_geometry": "geometry",
|
||||
"_panel": "panel",
|
||||
"layout": "",
|
||||
|
|
@ -1202,7 +1192,6 @@
|
|||
"label": false,
|
||||
"unit": "dB",
|
||||
"height": 30,
|
||||
"horizontal": false,
|
||||
"color": "auto",
|
||||
"css": "margin:5rem 5rem 0",
|
||||
"widgetId": "Master",
|
||||
|
|
@ -1211,7 +1200,8 @@
|
|||
"precision": 2,
|
||||
"preArgs": [],
|
||||
"target": [],
|
||||
"address": "/master_input"
|
||||
"address": "/master_input",
|
||||
"vertical": false
|
||||
},
|
||||
{
|
||||
"type": "fader",
|
||||
|
|
@ -1917,7 +1907,7 @@
|
|||
"type": "strip",
|
||||
"id": "trim_select_strip",
|
||||
"label": false,
|
||||
"height": 50,
|
||||
"height": 60,
|
||||
"color": "auto",
|
||||
"css": "",
|
||||
"horizontal": true,
|
||||
|
|
@ -1930,32 +1920,26 @@
|
|||
"type": "strip",
|
||||
"id": "trim_meta_select",
|
||||
"label": false,
|
||||
"width": "auto",
|
||||
"width": 50,
|
||||
"color": "auto",
|
||||
"css": "",
|
||||
"horizontal": false,
|
||||
"horizontal": true,
|
||||
"stretch": true,
|
||||
"border": false,
|
||||
"spacing": 0,
|
||||
"variables": "@{parent.variables}",
|
||||
"widgets": [
|
||||
{
|
||||
"type": "input",
|
||||
"type": "text",
|
||||
"id": "select_trim_label",
|
||||
"label": false,
|
||||
"color": "auto",
|
||||
"css": "",
|
||||
"css": "line-height:12rem",
|
||||
"value": "Trim",
|
||||
"preArgs": [],
|
||||
"widgetId": "",
|
||||
"height": 20,
|
||||
"linkId": "",
|
||||
"unit": "",
|
||||
"horizontal": false,
|
||||
"editable": false,
|
||||
"precision": 2,
|
||||
"target": [],
|
||||
"address": "/select_trim_label"
|
||||
"address": "/select_trim_label",
|
||||
"vertical": true,
|
||||
"width": "auto"
|
||||
},
|
||||
{
|
||||
"type": "input",
|
||||
|
|
@ -1965,20 +1949,21 @@
|
|||
"css": "",
|
||||
"preArgs": [],
|
||||
"widgetId": "select_trim_knob",
|
||||
"height": 20,
|
||||
"linkId": "",
|
||||
"unit": "",
|
||||
"horizontal": false,
|
||||
"editable": true,
|
||||
"precision": 2,
|
||||
"precision": 1,
|
||||
"target": [],
|
||||
"address": "/select_trim_input",
|
||||
"value": "",
|
||||
"address": "/select_trim_input"
|
||||
"width": "auto",
|
||||
"vertical": true
|
||||
}
|
||||
],
|
||||
"_style": "style",
|
||||
"_children": "children",
|
||||
"scroll": true,
|
||||
"css": "",
|
||||
"_geometry": "geometry",
|
||||
"_panel": "panel",
|
||||
"layout": "",
|
||||
|
|
@ -2087,7 +2072,7 @@
|
|||
"type": "toggle",
|
||||
"id": "disk_select",
|
||||
"linkId": "",
|
||||
"label": "^hdd-o",
|
||||
"label": "^hdd",
|
||||
"css": "",
|
||||
"on": 1,
|
||||
"off": 0,
|
||||
|
|
@ -2335,7 +2320,6 @@
|
|||
"label": false,
|
||||
"unit": "dB",
|
||||
"height": 30,
|
||||
"horizontal": false,
|
||||
"color": "auto",
|
||||
"css": "margin:5rem 5rem 0",
|
||||
"widgetId": "fader_select",
|
||||
|
|
@ -2344,7 +2328,8 @@
|
|||
"precision": 2,
|
||||
"preArgs": [],
|
||||
"target": [],
|
||||
"address": "/fader_input_select"
|
||||
"address": "/fader_input_select",
|
||||
"vertical": false
|
||||
},
|
||||
{
|
||||
"type": "fader",
|
||||
|
|
|
|||
146
app/examples/keys.json
Normal file
|
|
@ -0,0 +1,146 @@
|
|||
[
|
||||
{
|
||||
"type": "root",
|
||||
"tabs": [
|
||||
{
|
||||
"type": "tab",
|
||||
"id": "tab_1",
|
||||
"label": "auto",
|
||||
"color": "auto",
|
||||
"css": "",
|
||||
"layout": "",
|
||||
"spacing": 0,
|
||||
"value": "",
|
||||
"precision": 0,
|
||||
"address": "/tab_1",
|
||||
"preArgs": [],
|
||||
"target": [],
|
||||
"variables": "@{parent.variables}",
|
||||
"widgets": [
|
||||
{
|
||||
"type": "keys",
|
||||
"top": 300,
|
||||
"left": 0,
|
||||
"id": "keys_1",
|
||||
"width": "auto",
|
||||
"height": "auto",
|
||||
"label": "auto",
|
||||
"color": "auto",
|
||||
"css": "",
|
||||
"binding": [
|
||||
"r",
|
||||
"f"
|
||||
],
|
||||
"keydown": "# this is a comment\nx = key == \"r\" ? 0.1 : -0.1;\nvalue + x",
|
||||
"repeat": true,
|
||||
"widgetId": "fader_1",
|
||||
"keyup": ""
|
||||
},
|
||||
{
|
||||
"type": "fader",
|
||||
"top": 0,
|
||||
"left": 0,
|
||||
"id": "fader_1",
|
||||
"linkId": "",
|
||||
"width": "auto",
|
||||
"height": "auto",
|
||||
"label": "auto",
|
||||
"color": "auto",
|
||||
"css": "",
|
||||
"horizontal": false,
|
||||
"alignRight": false,
|
||||
"pips": true,
|
||||
"input": true,
|
||||
"meter": false,
|
||||
"compact": false,
|
||||
"dashed": false,
|
||||
"snap": false,
|
||||
"spring": false,
|
||||
"doubleTap": false,
|
||||
"range": {
|
||||
"min": 0,
|
||||
"max": 1
|
||||
},
|
||||
"logScale": false,
|
||||
"unit": "",
|
||||
"origin": "auto",
|
||||
"value": "",
|
||||
"precision": 2,
|
||||
"address": "/fader_1",
|
||||
"touchAddress": "",
|
||||
"meterAddress": "",
|
||||
"preArgs": [],
|
||||
"target": []
|
||||
},
|
||||
{
|
||||
"type": "xy",
|
||||
"top": 50,
|
||||
"left": 170,
|
||||
"id": "xy_1",
|
||||
"linkId": "",
|
||||
"width": 210,
|
||||
"height": 220,
|
||||
"label": "auto",
|
||||
"color": "auto",
|
||||
"css": "",
|
||||
"input": true,
|
||||
"pips": true,
|
||||
"pointSize": 20,
|
||||
"snap": false,
|
||||
"spring": false,
|
||||
"doubleTap": false,
|
||||
"rangeX": {
|
||||
"min": 0,
|
||||
"max": 1
|
||||
},
|
||||
"rangeY": {
|
||||
"min": 0,
|
||||
"max": 1
|
||||
},
|
||||
"logScaleX": false,
|
||||
"logScaleY": false,
|
||||
"value": "",
|
||||
"precision": 2,
|
||||
"address": "/xy_1",
|
||||
"touchAddress": "",
|
||||
"preArgs": [],
|
||||
"split": false,
|
||||
"target": []
|
||||
},
|
||||
{
|
||||
"type": "keys",
|
||||
"top": 270,
|
||||
"left": 170,
|
||||
"id": "keys_2",
|
||||
"width": 210,
|
||||
"height": "auto",
|
||||
"label": "auto",
|
||||
"color": "auto",
|
||||
"css": "",
|
||||
"binding": [
|
||||
"g",
|
||||
"t"
|
||||
],
|
||||
"widgetId": "xy_1",
|
||||
"keydown": "x = key == \"t\" ? 0.1 : -0.1;\nvalue[0] + x\nvalue[1] + x\n# value + 0.1 works too",
|
||||
"keyup": "",
|
||||
"repeat": false
|
||||
}
|
||||
],
|
||||
"tabs": [],
|
||||
"scroll": true
|
||||
}
|
||||
],
|
||||
"color": "auto",
|
||||
"css": "",
|
||||
"value": "",
|
||||
"precision": 0,
|
||||
"address": "/root",
|
||||
"preArgs": [],
|
||||
"target": [],
|
||||
"variables": {},
|
||||
"id": "root",
|
||||
"scroll": true,
|
||||
"label": false
|
||||
}
|
||||
]
|
||||
1813
app/examples/widgets.json
Normal file
|
|
@ -24,7 +24,7 @@ module.exports = {
|
|||
return
|
||||
}
|
||||
|
||||
if (settings.read('sessionFile')) this.sessionOpen({path:settings.read('sessionFile')},clientId)
|
||||
if (settings.read('sessionFile')) return this.sessionOpen({path:settings.read('sessionFile')},clientId)
|
||||
|
||||
var recentSessions = settings.read('recentSessions')
|
||||
|
||||
|
|
@ -45,7 +45,7 @@ module.exports = {
|
|||
if (err || !stats.isFile()) return
|
||||
|
||||
// add session to history
|
||||
sessionlist.unshift(data)
|
||||
sessionlist.unshift(path.resolve(data))
|
||||
// remove doubles from history
|
||||
sessionlist = sessionlist.filter(function(elem, index, self) {
|
||||
return index == self.indexOf(elem)
|
||||
|
|
@ -151,20 +151,14 @@ module.exports = {
|
|||
var value = shortdata.v,
|
||||
data = widgetHashTable[clientId][shortdata.h]
|
||||
|
||||
data.args = data.preArgs.concat(value)
|
||||
|
||||
var cloned
|
||||
data = JSON.parse(JSON.stringify(data))
|
||||
for (var k in shortdata) {
|
||||
if (!cloned) {
|
||||
data = JSON.parse(JSON.stringify(data))
|
||||
cloned = true
|
||||
}
|
||||
if (data[k]) {
|
||||
data[k] = shortdata[k]
|
||||
}
|
||||
data[k] = shortdata[k]
|
||||
}
|
||||
|
||||
clients[clientId].broadcast.emit('receiveOsc', data)
|
||||
data.args = data.preArgs ? data.preArgs.concat(value) : [value]
|
||||
|
||||
if (!data.noSync) clients[clientId].broadcast.emit('receiveOsc', data)
|
||||
|
||||
},
|
||||
|
||||
|
|
@ -175,24 +169,18 @@ module.exports = {
|
|||
var value = shortdata.v,
|
||||
data = widgetHashTable[clientId][shortdata.h]
|
||||
|
||||
data.args = data.preArgs.concat(value)
|
||||
|
||||
var cloned
|
||||
data = JSON.parse(JSON.stringify(data))
|
||||
for (var k in shortdata) {
|
||||
if (!cloned) {
|
||||
data = JSON.parse(JSON.stringify(data))
|
||||
cloned = true
|
||||
}
|
||||
if (data[k]) {
|
||||
data[k] = shortdata[k]
|
||||
}
|
||||
data[k] = shortdata[k]
|
||||
}
|
||||
|
||||
if (data.target.indexOf(null) == -1) {
|
||||
data.args = data.preArgs ? data.preArgs.concat(value) : [value]
|
||||
|
||||
if (!data.target || data.target.indexOf(null) == -1) {
|
||||
|
||||
var targets = []
|
||||
|
||||
if (settings.read('syncTargets')) Array.prototype.push.apply(targets, settings.read('syncTargets'))
|
||||
if (settings.read('targets') && !shortdata.target) Array.prototype.push.apply(targets, settings.read('targets'))
|
||||
if (data.target) Array.prototype.push.apply(targets, data.target)
|
||||
|
||||
|
||||
|
|
@ -226,7 +214,7 @@ module.exports = {
|
|||
|
||||
}
|
||||
|
||||
clients[clientId].broadcast.emit('receiveOsc', data)
|
||||
if (!data.noSync) clients[clientId].broadcast.emit('receiveOsc', data)
|
||||
|
||||
},
|
||||
|
||||
|
|
|
|||
|
|
@ -9,6 +9,9 @@ if (settings.read('noVsync') || (!settings.cli && settings.read('argv')['disabl
|
|||
app.commandLine.appendSwitch('--disable-gpu-vsync')
|
||||
}
|
||||
|
||||
if (settings.read('noGpu') || (!settings.cli && settings.read('argv')['disable-gpu'])) {
|
||||
app.disableHardwareAcceleration()
|
||||
}
|
||||
|
||||
app.on('window-all-closed', function() {
|
||||
if (process.platform != 'darwin') {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
var path = require('path'),
|
||||
{BrowserWindow} = require('electron'),
|
||||
{BrowserWindow, Menu} = require('electron'),
|
||||
shortcut = require('electron-localshortcut'),
|
||||
settings = require('./settings')
|
||||
|
||||
|
|
@ -25,6 +25,21 @@ module.exports = function(options={}) {
|
|||
window = null
|
||||
})
|
||||
|
||||
var template = [{
|
||||
label: 'Edit',
|
||||
submenu: [
|
||||
{role: 'undo', accelerator: "CmdOrCtrl+Z"},
|
||||
{role: 'redo', accelerator: "Shift+CmdOrCtrl+Z"},
|
||||
{type: 'separator'},
|
||||
{role: 'cut', accelerator: "CmdOrCtrl+X"},
|
||||
{role: 'copy', accelerator: "CmdOrCtrl+C"},
|
||||
{role: 'paste', accelerator: "CmdOrCtrl+V"}
|
||||
]
|
||||
}]
|
||||
|
||||
var menu = Menu.buildFromTemplate(template)
|
||||
Menu.setApplicationMenu(menu)
|
||||
|
||||
window.setMenuBarVisibility(false)
|
||||
|
||||
if (options.shortcuts) {
|
||||
|
|
|
|||
|
|
@ -3,10 +3,11 @@
|
|||
<head>
|
||||
<meta name="viewport" content="width=device-width, user-scalable=no"/>
|
||||
<link rel="preload" href="../../browser/fonts/roboto-medium.woff" as="font"/>
|
||||
<link rel="preload" href="../../browser/fonts/fontawesome-webfont.woff" as="font"/>
|
||||
<link rel="stylesheet" href="../../browser/styles.css"/>
|
||||
<link rel="stylesheet" href="../../browser/fonts/font-awesome.min.css"/>
|
||||
<link rel="stylesheet" href="../../browser/fonts/roboto-medium.css"/>
|
||||
<link rel="preload" href="../../browser/fonts/fa-solid-900.woff" as="font"/>
|
||||
<link rel="stylesheet" type="text/css" href="../../browser/styles.css"/>
|
||||
<link rel="stylesheet" type="text/css" href="../../browser/fonts/fontawesome.min.css"/>
|
||||
<link rel="stylesheet" type="text/css" href="../../browser/fonts/fa-solid.css"/>
|
||||
<link rel="stylesheet" type="text/css" href="../../browser/fonts/roboto-medium.css"/>
|
||||
<script src="launcher.js"></script>
|
||||
</head>
|
||||
|
||||
|
|
|
|||
|
|
@ -100,7 +100,7 @@ $(document).ready(()=>{
|
|||
if (!stop) $('input').not(input).trigger('change',true)
|
||||
})
|
||||
|
||||
cancel = $(`<div class="btn clear"><i class="fa fa-remove fa-fw"></i></div>`)
|
||||
cancel = $(`<div class="btn clear"><i class="fa fa-times fa-fw"></i></div>`)
|
||||
cancel.click((e)=>{
|
||||
e.preventDefault()
|
||||
if (option.type == 'boolean') {
|
||||
|
|
|
|||
|
|
@ -68,7 +68,7 @@ if (settings.cli) {
|
|||
launcher
|
||||
|
||||
app.on('ready',function(){
|
||||
launcher = require('./electron-window')({address:address, shortcuts:false, width:680, height:568, color:'#283143'})
|
||||
launcher = require('./electron-window')({address:address, shortcuts:false, width:680, height:626, color:'#283143'})
|
||||
})
|
||||
|
||||
process.stdout.write = (function(write) {
|
||||
|
|
|
|||
|
|
@ -4,6 +4,9 @@ import traceback
|
|||
import json as JSON
|
||||
import re
|
||||
|
||||
def ipcSend(name, data):
|
||||
print(JSON.dumps([name, data]))
|
||||
stdout.flush()
|
||||
|
||||
try:
|
||||
import rtmidi
|
||||
|
|
@ -18,10 +21,6 @@ except:
|
|||
if version_info.major == 3:
|
||||
raw_input = input
|
||||
|
||||
def ipcSend(name, data):
|
||||
print(JSON.dumps([name, data]))
|
||||
stdout.flush()
|
||||
|
||||
debug = False
|
||||
if 'debug' in argv:
|
||||
debug = True
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ require('vmodule')('serialport', {}, {global: true})
|
|||
var osc = require('osc'),
|
||||
ipc = require('./server').ipc,
|
||||
settings = require('./settings'),
|
||||
zeroconf = require('./zeroconf'),
|
||||
oscInPort = settings.read('oscInPort') || settings.read('httpPort'),
|
||||
debug = settings.read('debug'),
|
||||
vm = require('vm'),
|
||||
|
|
@ -17,6 +18,14 @@ var oscServer = new osc.UDPPort({
|
|||
metadata: true
|
||||
})
|
||||
|
||||
zeroconf.publish({
|
||||
name: settings.read('appName') + (settings.read('instanceName') ? ' (' + settings.read('instanceName') + ')' : ''),
|
||||
protocol: 'udp',
|
||||
type: 'osc',
|
||||
port: oscInPort
|
||||
}).on('error', (e)=>{
|
||||
console.error(`Error: Zeroconf: ${e.message}`)
|
||||
})
|
||||
|
||||
var parseType = function(type){
|
||||
var t = type[0].match(/[bhtdscrmifTFNI]/)
|
||||
|
|
@ -29,11 +38,15 @@ var parseType = function(type){
|
|||
|
||||
}
|
||||
|
||||
var parseArg = function(arg,precision){
|
||||
var parseArg = function(arg, precision){
|
||||
if (arg==null) return null
|
||||
switch (typeof arg) {
|
||||
case 'number':
|
||||
return {type: precision == 0 ? 'i' : 'f', value: parseFloat(arg.toFixed(precision))}
|
||||
var typeTagMatch = typeof precision == 'string' ? precision.match(/[0-9]+([a-zA-Z]{1})/) : null,
|
||||
typeTag = typeTagMatch === null ? precision == 0 ? 'i' : 'f' : typeTagMatch[1],
|
||||
precisionValue = parseFloat(precision) || 0
|
||||
|
||||
return {type: typeTag, value: parseFloat(arg.toFixed(precisionValue))}
|
||||
case 'boolean':
|
||||
return {type: arg ? 'T' : 'F', value: arg}
|
||||
case 'object':
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
var express = require('express')(),
|
||||
path = require('path'),
|
||||
http = require('http'),
|
||||
|
|
@ -6,12 +5,14 @@ var express = require('express')(),
|
|||
io = require('socket.io')(server),
|
||||
ipc = {},
|
||||
settings = require('./settings'),
|
||||
zeroconf = require('./zeroconf'),
|
||||
appAddresses = settings.read('appAddresses'),
|
||||
clients = {}
|
||||
|
||||
express.get('/', function(req, res){
|
||||
res.sendFile(path.resolve(__dirname + '/../browser/index.html'))
|
||||
})
|
||||
|
||||
express.get('*', function(req, res){
|
||||
if (req.path.indexOf('theme.css') != -1) {
|
||||
res.set('Content-Type', 'text/css');
|
||||
|
|
@ -20,13 +21,23 @@ express.get('*', function(req, res){
|
|||
} else {
|
||||
res.send('')
|
||||
}
|
||||
} else if (req.path.indexOf('browser/') != -1){
|
||||
res.sendFile(path.resolve(__dirname + '/..' + req.path))
|
||||
} else {
|
||||
res.sendFile(path.resolve(__dirname + '/../browser' + req.path))
|
||||
res.sendFile(path.resolve(req.path))
|
||||
}
|
||||
})
|
||||
|
||||
server.listen(settings.read('httpPort'))
|
||||
|
||||
zeroconf.publish({
|
||||
name: settings.read('appName') + (settings.read('instanceName') ? ' (' + settings.read('instanceName') + ')' : ''),
|
||||
type: 'http',
|
||||
port: settings.read('httpPort')
|
||||
}).on('error', (e)=>{
|
||||
console.error(`Error: Zeroconf: ${e.message}`)
|
||||
})
|
||||
|
||||
ipc.send = function(name,data,clientId) {
|
||||
if (clientId) {
|
||||
io.to(clientId).emit(name,data)
|
||||
|
|
|
|||
|
|
@ -63,12 +63,15 @@ var options = {
|
|||
}
|
||||
},
|
||||
'disable-vsync':{type:'boolean',describe:'disable gui\'s vertical synchronization', restart: true},
|
||||
'disable-gpu':{type:'boolean',describe:'disable hardware acceleration', restart: true},
|
||||
'read-only':{type:'boolean',describe:'disable session editing and session history changes',
|
||||
check: (r, argv)=>{
|
||||
return (!r || !argv.b) ?
|
||||
true : 'blank session can\'t be started in read-only mode'
|
||||
}
|
||||
},
|
||||
'instance-name':{type:'string',describe:'used to differenciate multiple instances in a zeroconf network'
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -124,7 +127,8 @@ var makeDefaultConfig = function(argv){
|
|||
recentSessions: [],
|
||||
|
||||
appName: 'Open Stage Control',
|
||||
syncTargets: argv.s || argv.sync || false,
|
||||
instanceName: argv['instance-name'] || false,
|
||||
targets: argv.s || argv.sync || false,
|
||||
oscInPort: argv.o || 0,
|
||||
httpPort: argv.p || 8080,
|
||||
debug: argv.d || false,
|
||||
|
|
@ -135,6 +139,7 @@ var makeDefaultConfig = function(argv){
|
|||
guiOnly: typeof argv.g == 'string' ? argv.g.length ? argv.g : true : false,
|
||||
urlOptions: argv['url-options'] ? '?' + argv['url-options'].join('&') : '',
|
||||
noVsync: argv['disable-vsync'] || false,
|
||||
noGpu: argv['disable-gpu'] || false,
|
||||
readOnly: argv['read-only'] || false,
|
||||
midi: argv.m,
|
||||
appAddresses:function(){
|
||||
|
|
|
|||
3
app/main/zeroconf.js
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
var zeroconf = require('bonjour')()
|
||||
|
||||
module.exports = zeroconf
|
||||
|
|
@ -2,7 +2,7 @@
|
|||
"name": "open-stage-control",
|
||||
"productName": "Open Stage Control",
|
||||
"description": "A libre desktop OSC bi-directionnal control surface application.",
|
||||
"version": "0.21.1",
|
||||
"version": "0.23.0",
|
||||
"author": {
|
||||
"name": "Jean-Emmanuel Doucet / AMMD",
|
||||
"email": "jeannot@ammd.net"
|
||||
|
|
@ -21,15 +21,16 @@
|
|||
"license": "GPL-3.0",
|
||||
"main": "index.js",
|
||||
"dependencies": {
|
||||
"vmodule":"1.0.1",
|
||||
"electron-localshortcut": "2.0.2",
|
||||
"bonjour": "^3.5.0",
|
||||
"chokidar": "2.0.0",
|
||||
"electron-localshortcut": "3.1.0",
|
||||
"express": "4.16.2",
|
||||
"jquery": "3.3.1",
|
||||
"osc": "2.2.0",
|
||||
"yargs": "9.0.1",
|
||||
"socket.io": "2.0.3",
|
||||
"express": "4.16.1",
|
||||
"jquery": "3.2.1",
|
||||
"chokidar": "1.7.0",
|
||||
"python-shell":"0.4.0"
|
||||
"python-shell": "0.4.0",
|
||||
"socket.io": "2.0.4",
|
||||
"vmodule": "1.0.1",
|
||||
"yargs": "11.0.0"
|
||||
},
|
||||
"scripts": {
|
||||
"start": "electron ."
|
||||
|
|
|
|||
39
package.json
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"name": "open-stage-control-builder",
|
||||
"description": "[Builder package] A libre desktop OSC bi-directionnal control surface application",
|
||||
"version": "0.21.1",
|
||||
"version": "0.23.0",
|
||||
"author": {
|
||||
"name": "Jean-Emmanuel Doucet / AMMD",
|
||||
"email": "jeannot@ammd.net"
|
||||
|
|
@ -20,35 +20,40 @@
|
|||
"license": "GPL-3.0",
|
||||
"dependencies": {
|
||||
"autolayout": "0.7.0",
|
||||
"babel-core": "^6.26.0",
|
||||
"babel-plugin-transform-object-rest-spread": "6.26.0",
|
||||
"babel-preset-env": "*",
|
||||
"babelify": "7.3.0",
|
||||
"browserify": "14.4.0",
|
||||
"babelify": "8.0.0",
|
||||
"browserify": "15.2.0",
|
||||
"cardinal-spline-js": "2.3.6",
|
||||
"electron": "~1.8.1",
|
||||
"electron-packager": "9.1.0",
|
||||
"electron": "~1.7.10",
|
||||
"electron-packager": "10.1.2",
|
||||
"exorcist": "1.0.0",
|
||||
"file-saver": "1.3.3",
|
||||
"jquery": "3.2.1",
|
||||
"jquery": "3.3.1",
|
||||
"json5": "0.5.1",
|
||||
"keyboardjs": "jean-emmanuel/KeyboardJS",
|
||||
"kiwi.js": "1.0.1",
|
||||
"licensify": "3.1.3",
|
||||
"mathjs": "3.16.4",
|
||||
"node-sass": "4.5.3",
|
||||
"nodemon": "1.12.0",
|
||||
"nosleep.js": "0.7.0",
|
||||
"screenfull": "3.3.1",
|
||||
"mathjs": "3.20.1",
|
||||
"minimatch": "^3.0.4",
|
||||
"node-sass": "4.7.2",
|
||||
"nodemon": "1.14.11",
|
||||
"screenfull": "3.3.2",
|
||||
"shortid": "2.2.8",
|
||||
"socket.io-client": "2.0.3",
|
||||
"uglifyify": "4.0.4"
|
||||
"socket.io-client": "2.0.4",
|
||||
"stacktrace-js": "^2.0.0",
|
||||
"through": "^2.3.8",
|
||||
"uglifyify": "4.0.5",
|
||||
"wolfy87-eventemitter": "^5.2.4"
|
||||
},
|
||||
"optionalDependencies": {
|
||||
"electron-installer-debian": "0.6.0"
|
||||
"electron-installer-debian": "0.8.0"
|
||||
},
|
||||
"scripts": {
|
||||
"postinstall": "cp resources/images/logo.ico app/browser/favicon.ico && cd app && npm install && cd .. && npm run build-js && npm run build-css",
|
||||
"postinstall": "cp resources/images/logo-nobadge.png app/browser/favicon.png && cd app && npm install && cd .. && npm run build-js && npm run build-css",
|
||||
"start": "cd app && npm start --",
|
||||
"build": "npm run build-js -- --prod && npm run build-css && electron-packager ./app open-stage-control --platform=$PLATFORM --arch=$ARCH --out dist/ --icon=resources/images/logo --overwrite --ignore \"(node_modules/serialport)\"",
|
||||
"build": "npm run build-js -- --prod && npm run build-css && electron-packager ./app open-stage-control --platform=$PLATFORM --arch=$ARCH --out dist/ --icon=resources/images/logo --overwrite --ignore \"(node_modules/serialport)\" --ignore \"(node_modules/uws)\"",
|
||||
"deb32": "electron-installer-debian --src dist/open-stage-control-linux-ia32/ --arch i386 --dest dist/open-stage-control-linux-ia32/ --icon resources/images/logo.png",
|
||||
"deb64": "electron-installer-debian --src dist/open-stage-control-linux-x64/ --arch amd64 --dest dist/open-stage-control-linux-x64/ --icon resources/images/logo.png",
|
||||
"debarm": "electron-installer-debian --src dist/open-stage-control-linux-armv7l/ --arch armv7l --dest dist/open-stage-control-linux-armv7l/ --icon resources/images/logo.png",
|
||||
|
|
@ -61,6 +66,6 @@
|
|||
"test": "npm run build-js && npm run build-css"
|
||||
},
|
||||
"engines": {
|
||||
"node": "6"
|
||||
"node": ">=6"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
20
resources/docs/credits.md
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
# License
|
||||
|
||||
Copyleft © Jean-Emmanuel Doucet @ [AMMD](http://ammd.net) 2018. This program is a free software released under the [GNU/GPL3](ttps://github.com/jean-emmanuel/open-stage-control/blob/master/LICENSE) license.
|
||||
|
||||
## Dependencies
|
||||
|
||||
|
||||
This relies on several other free softwares, including [Node.js](https://nodejs.org/), [Electron](http://electron.atom.io/), [osc.js](https://github.com/colinbdclark/osc.js), [socket.io](http://socket.io), [babel](http://babeljs.io/), [browserify](http://browserify.org), [exorcist](https://github.com/thlorenz/exorcist), [express](http://expressjs.com), [node-sass](https://github.com/sass/node-sass), [jQuery](http://jquery.com/), [jQuery-UI](http://jqueryui.com/), [Font Awesome](http://fontawesome.io/), [stacktracejs](stacktracejs.com), [mathjs](http://mathjs.org/). A comprehensive and up-to-date list can be found by reading these [two](https://github.com/jean-emmanuel/open-stage-control/blob/master/package.json) [files](https://github.com/jean-emmanuel/open-stage-control/blob/master/app/package.json).
|
||||
|
||||
## Contributors
|
||||
|
||||
https://github.com/jean-emmanuel/open-stage-control/graphs/contributors
|
||||
|
||||
----
|
||||
|
||||
<div style="width:300px">
|
||||
[](http://browserstack.com/)
|
||||
</div>
|
||||
|
||||
BrowserStack helps debugging Open Stage Control by providing a complete suite of browser emulators for Android, iOS and Windows, how awesome is that ? *Quite very much indeed !*
|
||||
|
|
@ -1,2 +1,43 @@
|
|||
body {overflow-y: scroll}
|
||||
.md-nav__title.md-nav__title--site {display: none;}
|
||||
|
||||
.md-header, .md-tabs {
|
||||
background:rgb(49, 63, 85)!important;
|
||||
}
|
||||
|
||||
@media only screen and (max-width: 76.1875em) {
|
||||
.md-header, .md-nav__title--site {
|
||||
background:rgb(49, 63, 85)!important;
|
||||
}
|
||||
}
|
||||
|
||||
.md-header-nav__button.md-logo {
|
||||
margin-right:-1rem!important;
|
||||
}
|
||||
|
||||
.md-nav__title--site, .md-header-nav__title {
|
||||
padding-top: 1px;
|
||||
text-transform: uppercase;
|
||||
font-size: 1.4rem!important;
|
||||
/* font-weight:500!important; */
|
||||
letter-spacing:1px;
|
||||
}
|
||||
|
||||
a.button {
|
||||
background:rgb(82, 168, 255);
|
||||
color:white!important;
|
||||
display: inline-block;
|
||||
padding: 5px 10px;
|
||||
border-radius: 3px;
|
||||
transition: opacity .2s;
|
||||
}
|
||||
|
||||
a.button:hover {
|
||||
opacity: 0.90;
|
||||
}
|
||||
|
||||
.align-center {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
article img {
|
||||
border-radius: 3px;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
The session editor can be enabled from the sidepanel. Once enabled, clicking on a widget will make it the *selected widget*, adding a fancy dashed blue border to it.
|
||||
|
||||
## Root panel
|
||||
## Root panel
|
||||
|
||||
The root panel can be selected by clicking on the "Root" button in the sidepanel.
|
||||
|
||||
|
|
@ -20,11 +20,11 @@ Right clicking / long touch on a widget or on a tab will also display a context
|
|||
- `Add tab`: create a new tab in selected container
|
||||
- `Delete`: delete selected tab or widget
|
||||
|
||||
## Save
|
||||
## Save
|
||||
|
||||
Current session can be exported as a `.js` file. When overwriting a session file that's currently is use by other clients, they will reload it automatically.
|
||||
|
||||
## Load
|
||||
## Load
|
||||
|
||||
Loading a session file doesn't affect other clients.
|
||||
|
||||
|
|
|
|||
15
resources/docs/examples.md
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
# Community examples
|
||||
|
||||
Feel free to submitt you own by [opening an issue](https://github.com/jean-emmanuel/open-stage-control/issues/new?title=[example]) on github.
|
||||
|
||||
## Ardour Control
|
||||
|
||||
https://github.com/jean-emmanuel/ardour-control
|
||||
|
||||

|
||||
|
||||
## Reaper panels
|
||||
|
||||
https://github.com/ThrashJazzAssassin/REAPER-OSC-panels
|
||||
|
||||

|
||||
|
|
@ -14,7 +14,7 @@ MIDI support requires additional software to be installed on the server's system
|
|||
|
||||
## Setup
|
||||
|
||||
When running the app, the `-m / -midi` switch must be set; it accepts the following options (separated by spaces):
|
||||
When running the app, the `-m / --midi` switch must be set; it accepts the following options (separated by spaces):
|
||||
|
||||
- `list`: prints the available MIDI ports to the console; numbers in the first column may be used for `input`/`output` definition below
|
||||
- `device_name:input,output`: connect to midi ports `input` and `output`; osc messages sent to target `midi:device_name` will be processed as midi events; Multiple devices can be declared
|
||||
|
|
|
|||
|
|
@ -6,12 +6,18 @@ Widgets can use each other's property values by using the following syntaxes:
|
|||
- `@{parent.propertyName}`
|
||||
- `@{widgetId.propertyName}` (where `widgetId` is the target widget's `id`)
|
||||
|
||||
`propertyName` can be any of the target widget's properties. Additionally, the special property name `_value` refers to a widget's value, as opposed to its `value` property.
|
||||
|
||||
It can be used to:
|
||||
|
||||
- concatenate strings: `/@{parent.id}/some_suffix`
|
||||
- define object value: `["@{parent.id}"]`
|
||||
|
||||
If the retreived property is an object (`[] / {}`), it can be used as is or one can retreive a specfic item from it: `@{parent.variables.0}` will try to return the first item of the parent's `variables` property.
|
||||
If the retreived property is an object (`[] / {}`), a subset can be defined by appending a dot and a key (array index or object key) : `@{parent.variables.key}`
|
||||
|
||||
!!! note ""
|
||||
The root panel's `id` is `root`.
|
||||
|
||||
|
||||
!!! warning "What about reverse inheritance ?"
|
||||
Containers cannot inherit their children's properties but to define their `value` property.
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ Apply a set of options to an existing widget by replacing the old ones with the
|
|||
!!! warning ""
|
||||
Editing a widget can be cpu expensive, hence updating the UI continuously is not a good idea
|
||||
|
||||
## `/EDIT_SOFT id options`
|
||||
## `/EDIT/MERGE id options`
|
||||
|
||||
Apply a set of options to an existing widget by merging them to the widget's options.
|
||||
|
||||
|
|
@ -28,6 +28,76 @@ Apply a set of options to an existing widget by merging them to the widget's opt
|
|||
!!! warning ""
|
||||
Editing a widget can be cpu expensive, hence updating the UI continuously is not a good idea
|
||||
|
||||
## `/EDIT/GET target id`
|
||||
|
||||
Sends back a widget's data (JSON stringified object), including its children, to specified target.
|
||||
|
||||
- `target`: `string`, `ip:port` pair
|
||||
- `id`: `string`, widget's `id`
|
||||
|
||||
Returns `/EDIT/GET id data`
|
||||
|
||||
- `id`: `string`
|
||||
- `data`: `string`
|
||||
|
||||
## `/EDIT/GET target address preArg1 preArg2 ...`
|
||||
|
||||
Sends back a widget's data (JSON stringified object), including its children, to specified target.
|
||||
|
||||
- `target`: `string`, `ip:port` pair
|
||||
- `address`: `string`, widget's `address`
|
||||
- `preArg[1...]`: `*`, widget's `preArgs`
|
||||
|
||||
Returns `/EDIT/GET address preArg1 preArg2 ... data`
|
||||
|
||||
- `address`: `string`, widget's `address`
|
||||
- `preArg[1...]`: `*`, widget's `preArgs`
|
||||
- `data`: `string`
|
||||
|
||||
|
||||
## `/GET target id`
|
||||
|
||||
Sends back a widget's value to specified target.
|
||||
|
||||
- `target`: `string`, `ip:port` pair
|
||||
- `id`: `string`, widget's `id`
|
||||
|
||||
Returns `/GET id value`
|
||||
|
||||
- `id`: `string`
|
||||
- `value`: `*`
|
||||
|
||||
## `/GET target address preArg1 preArg2 ...`
|
||||
|
||||
Sends back a widget's value to specified target.
|
||||
|
||||
- `target`: `string`, `ip:port` pair
|
||||
- `address`: `string`, widget's `address`
|
||||
- `preArg[1...]`: `*`, widget's `preArgs`
|
||||
|
||||
Returns `/GET address preArg1 preArg2 ... value`
|
||||
|
||||
- `address`: `string`, widget's `address`
|
||||
- `preArg[1...]`: `*`, widget's `preArgs`
|
||||
- `value`: `*`
|
||||
|
||||
|
||||
## `/SET target id value`
|
||||
|
||||
Set a widget's value as if it was interacted with from the interface. This is likely to make it send its value.
|
||||
|
||||
- `id`: `string`, widget's `id`
|
||||
- `value`: `*`, widget's new value
|
||||
|
||||
## `/SET address preArg1 preArg2 ... value`
|
||||
|
||||
Set a widget's value as if it was interacted with from the interface. This is likely to make it send its value.
|
||||
|
||||
- `address`: `string`, widget's `address`
|
||||
- `preArg[1...]`: `*`, widget's `preArgs`
|
||||
- `value`: `*`, widget's new value
|
||||
|
||||
|
||||
## `/TABS id id etc`
|
||||
|
||||
Open the tabs designated by the `id` parameters. The target tab link must be accesible (opening a tab located in a disabled tab won't work unless you specify the parent tab's `id` before; the safest way to go is to pass the whole tab tree to enable).
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ Client specific options can be set by adding query parameters to the server's ur
|
|||
| forceHdpi | number | 0 | force canvas scaling (ignore `hdpi`) |
|
||||
| doubletab | number | 375 | sets the double tap/click time thershold in milliseconds |
|
||||
| zoom | number | 1 | sets the initial zoom |
|
||||
| framerate | number | 60 | limit canvas drawing framerate |
|
||||
|
||||
Example:
|
||||
|
||||
|
|
|
|||
|
|
@ -24,7 +24,9 @@ Below are the available command-line options. Note that when running without any
|
|||
| -e, --examples | list examples instead of recent sessions |
|
||||
| --url-options | [url options](extras/url-options) (opt=value pairs) |
|
||||
| --disable-vsync | disable gui's vertical synchronization |
|
||||
| --disable-gpu | disable hardware acceleration |
|
||||
| --read-only | disable session editing and session history changes |
|
||||
| --instance-name | used to differenciate multiple instances in a zeroconf network |
|
||||
|
||||
Command-line only :
|
||||
|
||||
|
|
@ -47,13 +49,17 @@ $ open-stage-control --no-gui --load path/to/session.js --port 9999
|
|||
|
||||
This will create a headless app available through http on port 9999 with session.js loaded automatically.
|
||||
|
||||
!!! tip "What about HTTPS ?"
|
||||
Security is out of the app's scope. If you are concerned about safety, using a private - protected - network should be enough.
|
||||
|
||||
|
||||
## Run from sources
|
||||
|
||||
Running the app from the sources slightly differs from using built binaries : instead of running a binary, we'll launch the app with npm.
|
||||
|
||||
**1. Requirements**
|
||||
|
||||
- [Node.js >= 4](https://nodejs.org/)
|
||||
- [Node.js >= 4](https://nodejs.org/en/download/package-manager/)
|
||||
- [npm](https://www.npmjs.com/)
|
||||
|
||||
```
|
||||
|
|
@ -84,7 +90,7 @@ $ npm start [ -- options]
|
|||
|
||||
**1. Requirements**
|
||||
|
||||
- [Node.js >= 4](https://nodejs.org/)
|
||||
- [Node.js >= 4](https://nodejs.org/en/download/package-manager/)
|
||||
- [npm](https://www.npmjs.com/)
|
||||
|
||||
```
|
||||
|
|
@ -106,7 +112,7 @@ $ npm run build
|
|||
|
||||
$ npm run deb32
|
||||
|
||||
# or
|
||||
# or
|
||||
|
||||
$ npm run deb64
|
||||
|
||||
|
|
@ -132,7 +138,7 @@ $ xvfb-run open-stage-control -n
|
|||
|
||||
## Running without Electron
|
||||
|
||||
It is possible to run the server in headless mode without Electron using [node](https://nodejs.org) (v6 or higher) :
|
||||
It is possible to run the server in headless mode without Electron using [node](https://nodejs.org/en/download/package-manager/) (v6 or higher) :
|
||||
|
||||
```
|
||||
$ node /path/to/packaged/open-stage-control/resources/app/ -n
|
||||
|
|
|
|||
1
resources/docs/img/logo-browserstack.png
Symbolic link
|
|
@ -0,0 +1 @@
|
|||
../../images/logo-browserstack.png
|
||||
|
Before Width: | Height: | Size: 950 KiB |
|
|
@ -1 +0,0 @@
|
|||
../../images/logo-material.svg
|
||||
1
resources/docs/img/logo-nobadge.png
Symbolic link
|
|
@ -0,0 +1 @@
|
|||
../../images/logo-nobadge.png
|
||||
1
resources/docs/img/logo-nobadge.svg
Symbolic link
|
|
@ -0,0 +1 @@
|
|||
../../images/logo-nobadge.svg
|
||||
|
|
@ -1 +0,0 @@
|
|||
../../images/logo.png
|
||||
1
resources/docs/img/logo.svg
Symbolic link
|
|
@ -0,0 +1 @@
|
|||
../../images/logo.svg
|
||||
|
|
@ -1,15 +1,15 @@
|
|||
# Open Stage Control
|
||||
|
||||
|
||||
# <img style="margin:0 auto;display:inline-block;width:60px;float:left;margin-right:20px;margin-top:-7px;" src="img/logo.svg"/> Open Stage Control
|
||||
|
||||
Open Stage Control is a libre desktop OSC bi-directionnal control surface application. It's built on web technologies and run as an [Electron](http://electron.atom.io/) web server that accepts any number of clients.
|
||||
|
||||
[Try the online demo (Chrome 50+ required)](http://demo.osc.ammd.net)
|
||||
<a class="button" href="http://demo.osc.ammd.net">Try the online demo (Chrome 50+ required)</a>
|
||||
|
||||
[Download the latest release](https://github.com/jean-emmanuel/open-stage-control/releases)
|
||||
<a class="button" href="https://github.com/jean-emmanuel/open-stage-control/releases">Download the latest release</a>
|
||||
|
||||
|
||||
<div style="width:70%; box-shadow: 0 0 5px 0 rgba(0,0,0,.45); border-radius:2px;overflow:hidden">
|
||||
<a href="img/ardour-osc.png" title="Controlling Ardour"><img alt="Controlling Ardour" src="img/ardour-osc.png" style="display:block"/></a>
|
||||
</div>
|
||||

|
||||
|
||||
## Supported platforms
|
||||
|
||||
|
|
@ -19,17 +19,3 @@ The only supported client browsers are the one provided with the server and Chro
|
|||
## Need help ? Found a bug ?
|
||||
|
||||
Head over the github [issue tracker](https://github.com/jean-emmanuel/open-stage-control/issues) :)
|
||||
|
||||
## License & credits
|
||||
|
||||
Copyleft © Jean-Emmanuel @ [AMMD](http://ammd.net) 2017
|
||||
|
||||
This program is a free software released under the GNU/GPL3 license, it relies on the use of several other free softwares, including [Node.js](https://nodejs.org/), [Electron](http://electron.atom.io/), [osc.js](https://github.com/colinbdclark/osc.js), [socket.io](http://socket.io), [browserify](http://browserify.org), [exorcist](https://github.com/thlorenz/exorcist), [express](http://expressjs.com), [node-sass](https://github.com/sass/node-sass), [jQuery](http://jquery.com/), [jQuery-UI](http://jqueryui.com/), [Font Awesome](http://fontawesome.io/), [source-map](https://github.com/mozilla/source-map), [mathjs](http://mathjs.org/)
|
||||
|
||||
----
|
||||
|
||||
<div style="width:300px">
|
||||
[](http://browserstack.com/)
|
||||
</div>
|
||||
|
||||
BrowserStack helps debugging Open Stage Control by providing a complete suite of browser emulators for Android, iOS and Windows, how awesome is that ? *Quite very much indeed !*
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ The sidepanel can be opened by clicking the navigation icon in the upper right c
|
|||
- Export: save the state of all widgets to a `.preset` file
|
||||
- Import: load a state from a `.preset` file
|
||||
|
||||
### Traversing gestures
|
||||
### Traversing gestures
|
||||
|
||||
By default, a dragging gesture can only affect the widget it started on. Enabling traversing gesture does two things:
|
||||
|
||||
|
|
@ -30,4 +30,6 @@ See [Editing sessions](editing-sessions.md).
|
|||
| Click | Tap | Handled at pressing time, not releasing. |
|
||||
| Double Click | Double Tap | Some widgets handle double click / tap events. |
|
||||
| Right-click | Long touch | Widgets that have only one value input will give focus to it when receiving this event. When the editor is enabled, Right-click / Long touch spawns the editor's context menu. |
|
||||
| Drag | | The widgets respond to mouse and touch drag gestures with a 1:1 precision ratio. By using two or more fingers, one can obtain higher precision gestures : each finger that touches the widget without moving will slow down the moving one. |
|
||||
| Drag | Drag | The widgets respond to mouse and touch drag gestures with a 1:1 precision ratio. |
|
||||
| `Ctrl` + Drag | | Holding the `Ctrl` key while dragging with the mouse increases the gesture's precision by 10.|
|
||||
| | Two-fingers drag (single target) | Using two on a single-touch target increases the gesture's precision by 10. |
|
||||
|
|
|
|||
|
|
@ -12,24 +12,24 @@ Buttons are exactly what you think they are.
|
|||
}
|
||||
```
|
||||
|
||||
### `doubleTap`
|
||||
### `doubleTap`
|
||||
- type: `boolean`
|
||||
- default: `false`
|
||||
- usage: set to `true` to make the button require a double tap to be toggled instead of a single tap
|
||||
|
||||
### `led`
|
||||
### `led`
|
||||
- type: `boolean`
|
||||
- default: `false`
|
||||
- usage: set to `true` to display the toggle's state with a led
|
||||
|
||||
### `on`
|
||||
### `on`
|
||||
- type: `string|number|object`
|
||||
- default: `1`
|
||||
- usage: defines which value is sent on `on` position
|
||||
- set to `null` to send send no argument in the osc message
|
||||
- can be an `object` if the type needs to be specified (see [preArgs](./widgets.md#preargs))
|
||||
|
||||
### `off`
|
||||
### `off`
|
||||
- type: `string|number|object`
|
||||
- default: `0`
|
||||
- usage: defines which value is sent on `off` position
|
||||
|
|
@ -47,14 +47,14 @@ Buttons are exactly what you think they are.
|
|||
}
|
||||
```
|
||||
|
||||
### `on`
|
||||
### `on`
|
||||
- type: `string|number|object`
|
||||
- default: `1`
|
||||
- usage: defines which value is sent when pushing the button
|
||||
- set to `null` to send send no argument in the osc message
|
||||
- can be an `object` if the type needs to be specified (see [preArgs](./widgets.md#preargs))
|
||||
|
||||
### `off`
|
||||
### `off`
|
||||
- type: `string|number|object`
|
||||
- default: `0`
|
||||
- usage: defines which value is sent when releasing the button
|
||||
|
|
@ -78,14 +78,19 @@ Setting the `push`'s value externally (via osc) will toggle it's inner light.
|
|||
// etc
|
||||
}
|
||||
```
|
||||
|
||||
### `values`
|
||||
### `values`
|
||||
- type: `array|object`
|
||||
- default: `{"Value 1":1,"Value 2":2}`
|
||||
- usage:
|
||||
- `array` of possible values to switch between : `[1,2,3]`
|
||||
- `object` of `"label":value` pairs
|
||||
|
||||
### `showValues`
|
||||
- type: `boolean`
|
||||
- default: `false`
|
||||
- usage: if `values` is an `object`, set to `true` to display both values and labels instead of labels only
|
||||
|
||||
|
||||
## Dropdown
|
||||
```js
|
||||
{
|
||||
|
|
@ -94,7 +99,7 @@ Setting the `push`'s value externally (via osc) will toggle it's inner light.
|
|||
}
|
||||
```
|
||||
|
||||
### `values`
|
||||
### `values`
|
||||
- type: `array|object`
|
||||
- default: `{"Value 1":1,"Value 2":2}`
|
||||
- usage:
|
||||
|
|
|
|||
|
|
@ -15,28 +15,28 @@ Panels can contains tabs or widgets. These can be absolutely positioned and can
|
|||
}
|
||||
```
|
||||
|
||||
### `scroll`
|
||||
### `scroll`
|
||||
- type: `boolean`
|
||||
- default: `true`
|
||||
- usage: set to `false` to disable scrollbars
|
||||
|
||||
### `border`
|
||||
### `border`
|
||||
- type: `boolean`
|
||||
- default: `true`
|
||||
- usage: by default, widgets in panels/strip have their border disabled, except for panels and strips. Set to `false` to apply this rule to the panel too.
|
||||
|
||||
### `widgets`
|
||||
### `widgets`
|
||||
- type: `array`
|
||||
- default: `[]`
|
||||
- usage: each element of the `array` must be a widget `object`. A panel cannot contain widgets and tabs simultaneously.
|
||||
|
||||
### `tabs`
|
||||
### `tabs`
|
||||
- type: `array`
|
||||
- default: `[]`
|
||||
- usage: each element of the `array` must be a tab `object`. A panel cannot contain widgets and tabs simultaneously.
|
||||
|
||||
|
||||
### `variables`
|
||||
### `variables`
|
||||
- type: `*`
|
||||
- default: `@{parent.variables}`
|
||||
- usage: defines one or more arbitrary variables that can be inherited by children widgets.
|
||||
|
|
@ -47,19 +47,22 @@ Panels can contains tabs or widgets. These can be absolutely positioned and can
|
|||
- `@{parent.variables}` useful when nesting containers
|
||||
|
||||
|
||||
### `layout`
|
||||
### `layout`
|
||||
- type: `string`
|
||||
- default: `''`
|
||||
- usage: `layout` must be a valid [Visual Format Language](https://developer.apple.com/library/content/documentation/UserExperience/Conceptual/AutolayoutPG/VisualFormatLanguage.html) expression. It accepts the [Extended Visual Format Language](https://github.com/IjzerenHein/autolayout.js#extended-visual-format-language-evfl) as well. Widgets are targeted using their `id` or their index prefixed with a `$` (`$0, $1, etc`), the latter method being incompatible with the [range spread operator](https://github.com/IjzerenHein/autolayout.js#view-ranges-spread-operator). Expressions can be tested and debugged with the online [Visual Format Editor](https://rawgit.com/IjzerenHein/visualformat-editor/master/dist/index.html).
|
||||
- note: this only applies when the panel contains widgets, not tabs
|
||||
|
||||
### `spacing`
|
||||
### `spacing`
|
||||
- type: `integer|array`
|
||||
- default: `0`
|
||||
- usage: spacing size used in `layout` expression, can be set as a `[vertical,horizontal]` array.
|
||||
- note: this only applies when the panel contains widgets, not tabs
|
||||
|
||||
|
||||
### `noSync`
|
||||
- type: `boolean`
|
||||
- default: `false`
|
||||
- usage: set to `true` to prevent tab changes from synchronizing between clients that share the same session file
|
||||
|
||||
## Strip
|
||||
|
||||
|
|
@ -72,27 +75,27 @@ Unidirectionnal panel with stretching capability. By default, children widgets t
|
|||
}
|
||||
```
|
||||
|
||||
### `horizontal`
|
||||
### `horizontal`
|
||||
- type: `boolean`
|
||||
- default: `false`
|
||||
- usage: set to `true` to display widgets horizontally
|
||||
|
||||
### `stretch`
|
||||
### `stretch`
|
||||
- type: `boolean`
|
||||
- default: `false`
|
||||
- usage: set to `true` to stretch widgets evenly
|
||||
|
||||
### `spacing`
|
||||
### `spacing`
|
||||
- type: `integer`
|
||||
- default: `0`
|
||||
- usage: adds space between widgets
|
||||
|
||||
### `border`
|
||||
### `border`
|
||||
- type: `boolean`
|
||||
- default: `true`
|
||||
- usage: by default, widgets in panels/strip have their border disabled, except for panels and strips. Set to `false` to apply this rule to the strip too.
|
||||
|
||||
### `widgets`
|
||||
### `widgets`
|
||||
- type: `array`
|
||||
- default: `[]`
|
||||
- usage: each element of the `array` must be a widget `object`
|
||||
|
|
@ -111,22 +114,27 @@ Modals are buttons that turn into a centered popup panels when enabled. They can
|
|||
}
|
||||
```
|
||||
|
||||
### `doubleTap`
|
||||
### `doubleTap`
|
||||
- type: `boolean`
|
||||
- default: `false`
|
||||
- usage: set to `true` to make the modal require a double tap to open instead of a single tap
|
||||
|
||||
### `popupWidth` / `popupHeight`
|
||||
### `popupWidth` / `popupHeight`
|
||||
- type: `number|percentage`
|
||||
- default: `100%`
|
||||
- usage: sets the modal's size once opened
|
||||
|
||||
### `popupLabel`
|
||||
### `popupLabel`
|
||||
- type: `string`
|
||||
- default: `empty`
|
||||
- usage: alternative label for the popup
|
||||
|
||||
### `options`
|
||||
### `noSync`
|
||||
- type: `boolean`
|
||||
- default: `false`
|
||||
- usage: set to `true` to prevent modal's state changes from synchronizing between clients that share the same session file
|
||||
|
||||
### `options`
|
||||
- see panel's [`options`](#panel)
|
||||
|
||||
|
||||
|
|
@ -139,12 +147,12 @@ Modals are buttons that turn into a centered popup panels when enabled. They can
|
|||
}
|
||||
```
|
||||
|
||||
### `widgetId`
|
||||
### `widgetId`
|
||||
- type: `string`
|
||||
- default: `empty`
|
||||
- usage: `id` of the widget to clone
|
||||
|
||||
### `props`
|
||||
### `props`
|
||||
- type: `object`
|
||||
- default: `{}`
|
||||
- usage: cloned widget's properties to override
|
||||
|
|
|
|||
|
|
@ -10,22 +10,64 @@
|
|||
}
|
||||
```
|
||||
|
||||
### `widgetId`
|
||||
### `widgetId`
|
||||
- type: `object`
|
||||
- default: `empty`
|
||||
- usage: a widget's `id` whose value will be linked to the input
|
||||
|
||||
### `editable`
|
||||
### `editable`
|
||||
- type: `boolean`
|
||||
- default: `true`
|
||||
- usage: set to `false` to make the input non-editable
|
||||
|
||||
### `horizontal`
|
||||
### `horizontal`
|
||||
- type: `boolean`
|
||||
- default: `false`
|
||||
- usage: set to `true` to display the input horizontally
|
||||
|
||||
### `unit`
|
||||
### `unit`
|
||||
- type: `string`
|
||||
- default: `empty`
|
||||
- usage: `unit` will be appended to the displayed widget's value (it doesn't affect osc messages)
|
||||
|
||||
|
||||
## Keys
|
||||
|
||||
|
||||
```js
|
||||
{
|
||||
type:'keys',
|
||||
// etc
|
||||
}
|
||||
```
|
||||
|
||||
### `widgetId`
|
||||
- type: `object`
|
||||
- default: `empty`
|
||||
- usage: a widget's `id` whose value will be linked to the Keys
|
||||
|
||||
### `binding`
|
||||
- type: `string|array`
|
||||
- default: `''`
|
||||
- usage: [keyboardjs](https://github.com/RobertWHurst/KeyboardJS) key combo string or array of strings.
|
||||
|
||||
### `keydown`
|
||||
- type: `string`
|
||||
- default: `''`
|
||||
- usage: [MathJS](http://mathjs.org/docs/expressions/syntax.html) expression whose output will be sent to the linked widget. This will be evaluated when the key combo is pressed. Available variables are ;
|
||||
- `value`: widget's value
|
||||
- `key`: pressed key name (usefull for handling multiple keys with a single `keys` widget)
|
||||
- `ctrl`: control key state
|
||||
- `alt`: alt key state
|
||||
- `shift`: shift key state
|
||||
- `super`: command/windows key state
|
||||
|
||||
### `keyup`
|
||||
- type: `string`
|
||||
- default: `''`
|
||||
- usage: same as `keydown`, but evaluated when releasing the key combo.
|
||||
|
||||
### `repeat`
|
||||
- type: `boolean`
|
||||
- default: `true`
|
||||
- usage: set to `false` to prevent `keydown` repeats when holding the key combo pressed.
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ Formula evaluates mathematical expressions over other widgets' values each one o
|
|||
```
|
||||
|
||||
|
||||
### `formula`
|
||||
### `formula`
|
||||
- type: `string`
|
||||
- default: `''`
|
||||
- usage: a [mathjs](http://mathjs.org/docs/expressions/syntax.html) expression in which
|
||||
|
|
@ -24,19 +24,19 @@ Formula evaluates mathematical expressions over other widgets' values each one o
|
|||
- example: `${fader_1} * 2 + ${fader_2}`
|
||||
- **important note**: contrary to what is stated in *mathjs*' documentation, **matrix indexes are zero-based** here
|
||||
|
||||
### `condition`
|
||||
### `condition`
|
||||
- type: `string`
|
||||
- default: `''`
|
||||
- usage:
|
||||
- a [mathjs](http://mathjs.org/docs/expressions/syntax.html) comparison expression that bypasses widget's osc sending when returning`false`
|
||||
- example: `${fader_1} > 0.5`
|
||||
|
||||
### `unit`
|
||||
### `unit`
|
||||
- type: `string`
|
||||
- default: `empty`
|
||||
- usage: `unit` will be appended to the displayed widget's value (it doesn't affect osc messages)
|
||||
|
||||
### `split`
|
||||
### `split`
|
||||
- type: `object`
|
||||
- default: `[]`
|
||||
- usage: specify a different `address` for each item of the widget's value : `['/a', '/b']`
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ Multifader creates a row of vertical faders that respond to the same gestures.
|
|||
}
|
||||
```
|
||||
|
||||
### `strips`
|
||||
### `strips`
|
||||
- type: `integer`
|
||||
- default: `2`
|
||||
- usage: number of faders in the row, each fader will inherit its parent's properties and the following ones (where `i` is the fader's index in the row)
|
||||
|
|
@ -21,27 +21,27 @@ Multifader creates a row of vertical faders that respond to the same gestures.
|
|||
- `label`: `i`
|
||||
- `address`: same as the widget's with `/i` appended to it
|
||||
|
||||
### `start`
|
||||
### `start`
|
||||
- type: `integer`
|
||||
- default: `0`
|
||||
- usage: first faders's index
|
||||
|
||||
### `traversing`
|
||||
### `traversing`
|
||||
- type: `boolean`
|
||||
- default: `true`
|
||||
- usage: enable traversing gestures
|
||||
|
||||
### `split`
|
||||
### `split`
|
||||
- type: `boolean`
|
||||
- default: `false`
|
||||
- usage: if `true`, the fader's index will be appended to the widget's osc `address`; if `false` it will be prepended to the widget's `preArgs`
|
||||
|
||||
### `color`
|
||||
### `color`
|
||||
- type: `string|array`
|
||||
- default: `auto`, inherited accent color
|
||||
- usage: can be an `array` of css color `strings`, which will be sequentially passed to the faders
|
||||
|
||||
### `options`
|
||||
### `options`
|
||||
- see fader's [`options`](sliders/#fader)
|
||||
|
||||
|
||||
|
|
@ -56,7 +56,7 @@ Multifader creates a row of vertical faders that respond to the same gestures.
|
|||
}
|
||||
```
|
||||
|
||||
### `matrix`
|
||||
### `matrix`
|
||||
- type: `array`
|
||||
- default: `[2,2]`
|
||||
- usage: defines the number of columns and and rows. Each cell will contain a toggle button that will inherit its parent's properties and the following ones (where `i` is the fader's index in the row)
|
||||
|
|
@ -64,34 +64,34 @@ Multifader creates a row of vertical faders that respond to the same gestures.
|
|||
- `label`: `i`
|
||||
- `address`: same as the widget's with `/i` appended to it
|
||||
|
||||
### `start`
|
||||
### `start`
|
||||
- type: `integer`
|
||||
- default: `0`
|
||||
- usage: first toggle's index
|
||||
|
||||
### `spacing`
|
||||
### `spacing`
|
||||
- type: `integer`
|
||||
- default: `0`
|
||||
- usage: adds space between widgets
|
||||
|
||||
### `traversing`
|
||||
### `traversing`
|
||||
- type: `boolean`
|
||||
- default: `true`
|
||||
- usage: enable traversing gestures
|
||||
|
||||
### `split`
|
||||
### `split`
|
||||
- type: `boolean`
|
||||
- default: `false`
|
||||
- usage: if `true`, the toggle's index will be appended to the widget's osc `address`; if `false` it will be prepended to the widget's `preArgs`
|
||||
|
||||
### `color`
|
||||
### `color`
|
||||
- type: `string|array`
|
||||
- default: `auto`, inherited accent color
|
||||
- usage: can be an `array` of css color `strings`, which will be sequentially passed to the toggles
|
||||
|
||||
|
||||
|
||||
### `options`
|
||||
### `options`
|
||||
- see toggle's [`options`](buttons/#toggle)
|
||||
|
||||
|
||||
|
|
@ -104,7 +104,7 @@ Multifader creates a row of vertical faders that respond to the same gestures.
|
|||
}
|
||||
```
|
||||
|
||||
### `matrix`
|
||||
### `matrix`
|
||||
- type: `array`
|
||||
- default: `[2,2]`
|
||||
- usage: defines the number of columns and and rows. Each cell will contain a push button that will inherit its parent's properties and the following ones (where `i` is the fader's index in the row)
|
||||
|
|
@ -112,32 +112,32 @@ Multifader creates a row of vertical faders that respond to the same gestures.
|
|||
- `label`: `i`
|
||||
- `address`: same as the widget's with `/i` appended to it
|
||||
|
||||
### `start`
|
||||
### `start`
|
||||
- type: `integer`
|
||||
- default: `0`
|
||||
- usage: first push's index
|
||||
|
||||
### `spacing`
|
||||
### `spacing`
|
||||
- type: `integer`
|
||||
- default: `0`
|
||||
- usage: adds space between widgets
|
||||
|
||||
### `traversing`
|
||||
### `traversing`
|
||||
- type: `boolean`
|
||||
- default: `true`
|
||||
- usage: enable traversing gestures
|
||||
|
||||
### `split`
|
||||
### `split`
|
||||
- type: `boolean`
|
||||
- default: `false`
|
||||
- usage: if `true`, the push's index will be appended to the widget's osc `address`; if `false` it will be prepended to the widget's `preArgs`
|
||||
|
||||
### `color`
|
||||
### `color`
|
||||
- type: `string|array`
|
||||
- default: `auto`, inherited accent color
|
||||
- usage: can be an `array` of css color `strings`, which will be sequentially passed to the pushes
|
||||
|
||||
### `options`
|
||||
### `options`
|
||||
- see push's [`options`](buttons/#push)
|
||||
|
||||
|
||||
|
|
@ -153,28 +153,28 @@ This one works pretty much like the multipush, excepts it looks like a piano key
|
|||
}
|
||||
```
|
||||
|
||||
### `keys`
|
||||
### `keys`
|
||||
- type: `integer`
|
||||
- default: `24`
|
||||
- usage: defines the number keys
|
||||
|
||||
### `start`
|
||||
### `start`
|
||||
- type: `integer`
|
||||
- default: `60`
|
||||
- usage: MIDI note number to start with (default is C4)
|
||||
|
||||
|
||||
### `traversing`
|
||||
### `traversing`
|
||||
- type: `boolean`
|
||||
- default: `true`
|
||||
- usage: enable traversing gestures
|
||||
|
||||
### `split`
|
||||
### `split`
|
||||
- type: `boolean`
|
||||
- default: `false`
|
||||
- usage: if `true`, the note's midi code will be appended to the widget's osc `address`; if `false` it will be prepended to the widget's `preArgs`
|
||||
|
||||
### `options`
|
||||
### `options`
|
||||
- see push's [`options`](buttons/#push)
|
||||
|
||||
### `css`
|
||||
|
|
|
|||
|
|
@ -13,35 +13,35 @@ Pads are multidimensional widgets that output multiple values.
|
|||
}
|
||||
```
|
||||
|
||||
### `input`
|
||||
### `input`
|
||||
- type: `boolean`
|
||||
- default: `true`
|
||||
- usage: set to `false` to hide the built-in input
|
||||
|
||||
### `rangeX`
|
||||
### `rangeX`
|
||||
- type: `object`
|
||||
- default:
|
||||
`{"min":0,"max":1}`
|
||||
- usage: defines the `min` and `max` values for the `x` axis. Same as fader's [`range`](sliders/#fader)
|
||||
|
||||
### `rangeY`
|
||||
### `rangeY`
|
||||
- type: `object`
|
||||
- default:
|
||||
`{"min":0,"max":1}`
|
||||
- usage: defines the `min` and `max` values for the `y` axis. Same as fader's [`range`](sliders/#fader)
|
||||
|
||||
|
||||
### `logScaleX`
|
||||
### `logScaleX`
|
||||
- type: `boolean`
|
||||
- default: `false`
|
||||
- usage: set to `true` to use logarithmic scale for the `x` axis (log10)
|
||||
|
||||
### `logScaleY`
|
||||
### `logScaleY`
|
||||
- type: `boolean`
|
||||
- default: `false`
|
||||
- usage: set to `true` to use logarithmic scale for the `y` axis (log10)
|
||||
|
||||
### `snap`
|
||||
### `snap`
|
||||
- type: `boolean`
|
||||
- default: `false`
|
||||
- usage: by default, dragging the widget will modify it's value starting from its last value. Setting this to `true` will make it snap directly to the mouse/touch position.
|
||||
|
|
@ -51,12 +51,12 @@ Pads are multidimensional widgets that output multiple values.
|
|||
- default: `false`
|
||||
- usage: when set to `true`, the widget will go back to its initial value when released.
|
||||
|
||||
### `doubleTap`
|
||||
### `doubleTap`
|
||||
- type: `boolean`
|
||||
- default: `false`
|
||||
- usage: set to `true` to make the xy reset to its initial value when receiving a double tap
|
||||
|
||||
### `split`
|
||||
### `split`
|
||||
- type: `boolean|object`
|
||||
- default: `false`
|
||||
- usage:
|
||||
|
|
@ -75,7 +75,7 @@ Pads are multidimensional widgets that output multiple values.
|
|||
}
|
||||
```
|
||||
|
||||
### `points`
|
||||
### `points`
|
||||
- type: `integer|array`
|
||||
- default: `2`
|
||||
- usage: defines the number of points on the pad. Can be an `array` of `strings` that will be used as labels for the points (ex: `['A', 'B']`)
|
||||
|
|
@ -85,30 +85,30 @@ Pads are multidimensional widgets that output multiple values.
|
|||
- default: `15`
|
||||
- usage: defines the points's size
|
||||
|
||||
### `rangeX`
|
||||
### `rangeX`
|
||||
- type: `object`
|
||||
- default:
|
||||
`{"min":0,"max":1}`
|
||||
- usage: defines the `min` and `max` values for the `x` axis. Same as fader's [`range`](sliders/#fader)
|
||||
|
||||
### `rangeY`
|
||||
### `rangeY`
|
||||
- type: `object`
|
||||
- default:
|
||||
`{"min":0,"max":1}`
|
||||
- usage: defines the `min` and `max` values for the `y` axis. Same as fader's [`range`](sliders/#fader)
|
||||
|
||||
|
||||
### `logScaleX`
|
||||
### `logScaleX`
|
||||
- type: `boolean`
|
||||
- default: `false`
|
||||
- usage: set to `true` to use logarithmic scale for the `x` axis (log10)
|
||||
|
||||
### `logScaleY`
|
||||
### `logScaleY`
|
||||
- type: `boolean`
|
||||
- default: `false`
|
||||
- usage: set to `true` to use logarithmic scale for the `y` axis (log10)
|
||||
|
||||
### `split`
|
||||
### `split`
|
||||
- type: `boolean|object`
|
||||
- default: `false`
|
||||
- usage:
|
||||
|
|
@ -116,7 +116,7 @@ Pads are multidimensional widgets that output multiple values.
|
|||
- can be set as an object to specify a different `address` : `['/0/x', '/0/y', '/1/x', '/2/y']`
|
||||
- note: the widget will only respond to its original osc address, not to the splitted version
|
||||
|
||||
### `snap`
|
||||
### `snap`
|
||||
- type: `boolean`
|
||||
- default: `false`
|
||||
- usage: by default, the points are dragged from their initial position; if set to `true`, touching anywhere on the widget's surface will make them snap to the touching coordinates (one per touch).
|
||||
|
|
@ -135,20 +135,20 @@ RGB is a variant of XY, it outputs rgb values between 0 and 255.
|
|||
}
|
||||
```
|
||||
|
||||
### `input`
|
||||
### `input`
|
||||
- type: `boolean`
|
||||
- default: `true`
|
||||
- usage: set to `false` to hide the built-in input
|
||||
|
||||
### `precision`
|
||||
### `precision`
|
||||
- default:`0`
|
||||
|
||||
### `snap`
|
||||
### `snap`
|
||||
- type: `boolean`
|
||||
- default: `false`
|
||||
- usage: by default, dragging the widget will modify it's value starting from its last value. Setting this to true will make it snap directly to the mouse/touch position.
|
||||
|
||||
### `split`
|
||||
### `split`
|
||||
- type: `boolean|object`
|
||||
- default: `false`
|
||||
- usage:
|
||||
|
|
|
|||
|
|
@ -10,17 +10,17 @@ Plots are tools that display other widgets' state or incomming osc messages. The
|
|||
}
|
||||
```
|
||||
|
||||
### `widgetId`
|
||||
### `widgetId`
|
||||
- type: `string`
|
||||
- default: `empty`
|
||||
- usage: a widget's `id` whose value will be mapped to the led's color opacity
|
||||
|
||||
### `range`
|
||||
### `range`
|
||||
- type: `object`
|
||||
- default: `{"min":0,"max":1}`
|
||||
- usage: defines the `min` and `max` value the led's intensity will be mapped to
|
||||
|
||||
### `logScale`
|
||||
### `logScale`
|
||||
- type: `boolean`
|
||||
- default: `false`
|
||||
- usage: set to true to use logarithmic scaling
|
||||
|
|
@ -38,7 +38,12 @@ This one is like the `led` except it takes either three arguments (red, green an
|
|||
|
||||
## Plot
|
||||
|
||||
The plot receives an array of [x,y] coordinates and draws them on a chart with linear or logarithmic interpolation.
|
||||
The plot receives an array of coordinates and draws them on a chart. Coordinates can be :
|
||||
- `y` values evenly spaced on the `x` axis
|
||||
- `[x, y]` coordinates arrays
|
||||
|
||||
!!! info
|
||||
Coordinates also can be sent as a stringified array (`[]`). A stringified object can also be sent to change specific points' coordinates (e.g. `{0:1, 4:0}` will change the 1st and 5th points' coordinates) .
|
||||
|
||||
```js
|
||||
{
|
||||
|
|
@ -47,16 +52,17 @@ The plot receives an array of [x,y] coordinates and draws them on a chart with
|
|||
}
|
||||
```
|
||||
|
||||
### `points`
|
||||
### `points`
|
||||
- type: `array|string`
|
||||
- default: `[]`
|
||||
- usage:
|
||||
- as a `string`: a widget's `id` whose multiple values will be displayed on the `y` axis, evenly spaced on the `x` axis (only *[matrices](matrices.md)* and *[pads](pads.md)* will work)
|
||||
- as an `array`: each element must be an `array` of `[x,y]` coordinates, where `x` and `y` can either be a:
|
||||
- `number`: constant values
|
||||
- `string`: a widget's `id` whose value will be used
|
||||
- as a `string`: a widget's `id` whose values will be used
|
||||
- as an `array`: where items can be
|
||||
- `number`
|
||||
- `string` (widget's `id`)
|
||||
- `[x, y]`: array of `number` or `string`
|
||||
|
||||
### `range`
|
||||
### `range`
|
||||
- type: `object`
|
||||
- default:
|
||||
`{
|
||||
|
|
@ -65,20 +71,25 @@ The plot receives an array of [x,y] coordinates and draws them on a chart with
|
|||
}`
|
||||
- usage: defines the `min` and `max` values for the `x` and `y` axis
|
||||
|
||||
### `logScaleX`
|
||||
### `bars`
|
||||
- type: `boolean`
|
||||
- default: `false`
|
||||
- usage: set to `true` to use draw bars instead (disables `logScaleX` and forces `x-axis` even spacing)
|
||||
|
||||
### `logScaleX`
|
||||
- type: `boolean`
|
||||
- default: `false`
|
||||
- usage: set to `true` to use logarithmic scale for the `x` axis (log10)
|
||||
|
||||
### `logScaleY`
|
||||
### `logScaleY`
|
||||
- type: `boolean`
|
||||
- default: `false`
|
||||
- usage: set to `true` to use logarithmic scale for the `y` axis (log10)
|
||||
|
||||
### `smooth`
|
||||
### `smooth`
|
||||
- type: `boolean`
|
||||
- default: `false`
|
||||
- usage: set to true to make the line smooth. Float values are also acceptable (works fine between 0 and 0.5)
|
||||
- usage: set to `true` to make the line smooth. Float values are also acceptable (works fine between 0 and 0.5)
|
||||
|
||||
### `origin`
|
||||
- type: `number`
|
||||
|
|
@ -96,7 +107,7 @@ The Eq receives an array of filter objects and draws their frequency response be
|
|||
}
|
||||
```
|
||||
|
||||
### `filters`
|
||||
### `filters`
|
||||
- type: `array`
|
||||
- default: `[]`
|
||||
- usage:
|
||||
|
|
@ -118,18 +129,18 @@ The Eq receives an array of filter objects and draws their frequency response be
|
|||
- default: `128`
|
||||
- usage: defines the number of points used to compute the frequency response
|
||||
|
||||
### `rangeY`
|
||||
### `rangeY`
|
||||
- type: `object`
|
||||
- default:
|
||||
`{"min":-20,"max":20}`
|
||||
- usage: defines the `min` and `max` values for the `y` axis (dB level)
|
||||
|
||||
### `logScaleX`
|
||||
### `logScaleX`
|
||||
- type: `boolean`
|
||||
- default: `false`
|
||||
- usage: set to `true` to use logarithmic scale for the `x` axis (log10)
|
||||
|
||||
### `smooth`
|
||||
### `smooth`
|
||||
- type: `boolean`
|
||||
- default: `false`
|
||||
- usage: set to true to make the line smooth. Float values are also acceptable (works fine between 0 and 0.5)
|
||||
|
|
@ -150,27 +161,27 @@ The visualizer displays the evolution in time of a received value (through osc)
|
|||
}
|
||||
```
|
||||
|
||||
### `widgetId`
|
||||
### `widgetId`
|
||||
- type: `string`
|
||||
- default: `empty`
|
||||
- usage: a widget's `id` whose value will be displayed (thus bypassing the incoming osc)
|
||||
|
||||
### `duration`
|
||||
### `duration`
|
||||
- type: `number`
|
||||
- default: `1`
|
||||
- usage: window size in seconds
|
||||
|
||||
### `range`
|
||||
### `range`
|
||||
- type: `object`
|
||||
- default: `{"min":0,"max":1}`
|
||||
- usage: defines the `min` and `max` values for the `y` axis
|
||||
|
||||
### `logScale`
|
||||
### `logScale`
|
||||
- type: `boolean`
|
||||
- default: `false`
|
||||
- usage: set to `true` use logarithmic scaling (log10)
|
||||
|
||||
### `smooth`
|
||||
### `smooth`
|
||||
- type: `boolean`
|
||||
- default: `false`
|
||||
- usage: set to true to make the line smooth. Float values are also acceptable (works fine between 0 and 0.5)
|
||||
|
|
@ -191,12 +202,12 @@ Text displays incoming values (via osc) as text. Sending a message with no argum
|
|||
}
|
||||
```
|
||||
|
||||
### `widgetId`
|
||||
### `widgetId`
|
||||
- type: `string`
|
||||
- default: `empty`
|
||||
- usage: a widget's `id` whose value will be displayed
|
||||
|
||||
### `vertical`
|
||||
### `vertical`
|
||||
- type: `boolean`
|
||||
- default: `false`
|
||||
- usage: set to `true` display vertically
|
||||
|
|
@ -212,18 +223,65 @@ Meter displays incoming numerical values (via osc) as a gauge level
|
|||
}
|
||||
```
|
||||
|
||||
### `widgetId`
|
||||
### `widgetId`
|
||||
- type: `object`
|
||||
- default: `empty`
|
||||
- usage: a widget's `id` whose value will be displayed
|
||||
|
||||
### `horizontal`
|
||||
### `horizontal`
|
||||
- type: `boolean`
|
||||
- default: `false`
|
||||
- usage: set to `true` to display the meter horizontally
|
||||
|
||||
### `range`
|
||||
### `range`
|
||||
- see fader's [`range`](sliders/#fader)
|
||||
|
||||
### `logScale`
|
||||
### `logScale`
|
||||
- see fader's [`logScale`](sliders/#fader)
|
||||
|
||||
|
||||
## Image
|
||||
|
||||
Image displays an image from a file path/url or from a base64 encoded image string. Sending an empty message resets the widget to its initial `value`.
|
||||
|
||||
```js
|
||||
{
|
||||
type:'image',
|
||||
// etc
|
||||
}
|
||||
```
|
||||
|
||||
### `size`
|
||||
- type: `string`
|
||||
- default: `cover`
|
||||
- usage: css [background-size](https://www.w3schools.com/CSSref/css3_pr_background-size.asp)
|
||||
|
||||
|
||||
### `position`
|
||||
- type: `string`
|
||||
- default: `cover`
|
||||
- usage: css [background-position](https://www.w3schools.com/CSSref/pr_background-position.asp)
|
||||
|
||||
|
||||
### `repeat`
|
||||
- type: `string`
|
||||
- default: `no-repeat`
|
||||
- usage: css [background-repeat](https://www.w3schools.com/CSSref/pr_background-repeat.asp)
|
||||
|
||||
|
||||
### `border`
|
||||
- type: `boolean`
|
||||
- default: `false`
|
||||
- usage: set to `true` to disable the image's borders and background-color.
|
||||
|
||||
### `cache`
|
||||
- type: `boolean`
|
||||
- default: `true`
|
||||
- usage: set to `false` to disable image caching (forces file reload when updating or editing the widget). When `true`, sending `'reload'` to the widget reloads its image without changing its value.
|
||||
|
||||
### `value`
|
||||
- type: `string`
|
||||
- default: `empty`
|
||||
- usage : initial image
|
||||
- file url or absolute path
|
||||
- [base64 encoded image](https://duckduckgo.com/?q=base64+encode+image&ia=web) : `data:image/...`
|
||||
|
|
|
|||
|
|
@ -12,37 +12,37 @@ Sliders are unidimensional widgets that output one value at a time.
|
|||
}
|
||||
```
|
||||
|
||||
### `horizontal`
|
||||
### `horizontal`
|
||||
- type: `boolean`
|
||||
- default: `false`
|
||||
- usage: set to `true` to display the fader horizontally
|
||||
|
||||
### `alignRight`
|
||||
### `alignRight`
|
||||
- type: `boolean`
|
||||
- default: `false`
|
||||
- usage: set to `true` to invert the pip's and fader's position
|
||||
|
||||
### `pips`
|
||||
### `pips`
|
||||
- type: `boolean`
|
||||
- default: `true`
|
||||
- usage: set to `false` to hide the scale
|
||||
|
||||
### `input`
|
||||
### `input`
|
||||
- type: `boolean`
|
||||
- default: `true`
|
||||
- usage: set to `false` to hide the built-in input
|
||||
|
||||
### `compact`
|
||||
### `compact`
|
||||
- type: `boolean`
|
||||
- default: `false`
|
||||
- usage: set to `true` to display a compact alternative for the widget. Disables default mouse/touch focusing on the value display (right-click/long-touch still triggers it).
|
||||
|
||||
### `dashed`
|
||||
### `dashed`
|
||||
- type: `boolean`
|
||||
- default: `false`
|
||||
- usage: set to `true` to display a dashed gauge
|
||||
|
||||
### `range`
|
||||
### `range`
|
||||
- type: `object`
|
||||
- default: `{"min":0,"max":1}`
|
||||
- usage: `range` defines the breakpoints of the fader's scale
|
||||
|
|
@ -62,19 +62,19 @@ range: {
|
|||
- default: `auto`
|
||||
- usage: `origin` defines the starting point's value of the fader's gauge
|
||||
|
||||
### `logScale`
|
||||
### `logScale`
|
||||
- type: `boolean`
|
||||
- default: `false`
|
||||
- usage: set to `true` use logarithmic scaling between breakpoints (log10)
|
||||
|
||||
|
||||
### `unit`
|
||||
### `unit`
|
||||
- type: `string`
|
||||
- default: `empty`
|
||||
- usage: `unit` will be appended to the displayed widget's value (it doesn't affect osc messages)
|
||||
|
||||
|
||||
### `snap`
|
||||
### `snap`
|
||||
- type: `boolean`
|
||||
- default: `false`
|
||||
- usage: by default, dragging the widget will modify it's value starting from its last value. Setting this to `true` will make it snap directly to the mouse/touch position.
|
||||
|
|
@ -85,19 +85,19 @@ range: {
|
|||
- usage: when set to `true`, the widget will go back to its initial value when released.
|
||||
|
||||
|
||||
### `doubleTap`
|
||||
### `doubleTap`
|
||||
- type: `boolean`
|
||||
- default: `false`
|
||||
- usage: set to `true` to make the fader reset to its initial value when receiving a double tap
|
||||
|
||||
### `meter`
|
||||
### `meter`
|
||||
- type: `boolean`
|
||||
- default: `false`
|
||||
- usage: set to true to display a vu-meter next in the fader
|
||||
- the meter's `id` will be the same as the widget's with `/meter` appended to it
|
||||
- the meter's `address `will be the same as the widget's with `/meter` appended to it
|
||||
|
||||
### `meterAddress`
|
||||
### `meterAddress`
|
||||
- type: `boolean`
|
||||
- default: `empty`
|
||||
- usage: overrides the `meter`'s osc address
|
||||
|
|
@ -121,17 +121,17 @@ range: {
|
|||
```
|
||||
|
||||
|
||||
### `pips`
|
||||
### `pips`
|
||||
- type: `boolean`
|
||||
- default: `true`
|
||||
- usage: set to `false` to hide the scale
|
||||
|
||||
### `input`
|
||||
### `input`
|
||||
- type: `boolean`
|
||||
- default: `true`
|
||||
- usage: set to `false` to hide the built-in input
|
||||
|
||||
### `compact`
|
||||
### `compact`
|
||||
- type: `boolean`
|
||||
- default: `false`
|
||||
- usage: set to `true` to display a compact alternative for the widget. Disables default mouse/touch focusing on the value display (right-click/long-touch still triggers it).
|
||||
|
|
@ -141,7 +141,7 @@ range: {
|
|||
- default: `270`
|
||||
- usage: `angle` defines the angle's width of the knob, in degrees
|
||||
|
||||
### `range`
|
||||
### `range`
|
||||
- type: `object`
|
||||
- default: `{"min":0,"max":1}`
|
||||
- usage: `range` defines the breakpoints of the fader's scale
|
||||
|
|
@ -161,19 +161,19 @@ range: {
|
|||
- default: `auto`
|
||||
- usage: `origin` defines the starting point's value of the knob's gauge
|
||||
|
||||
### `logScale`
|
||||
### `logScale`
|
||||
- type: `boolean`
|
||||
- default: `false`
|
||||
- usage: set to `true` use logarithmic scaling between breakpoints
|
||||
|
||||
|
||||
### `unit`
|
||||
### `unit`
|
||||
- type: `string`
|
||||
- default: `empty`
|
||||
- usage: `unit` will be appended to the displayed widget's value (it doesn't affect osc messages)
|
||||
|
||||
|
||||
### `snap`
|
||||
### `snap`
|
||||
- type: `boolean`
|
||||
- default: `false`
|
||||
- usage: by default, dragging the widget *vertically* will modify it's value starting from its last value. Setting this to `true` will make it snap directly to the mouse/touch position.
|
||||
|
|
@ -183,7 +183,7 @@ range: {
|
|||
- default: `false`
|
||||
- usage: when set to `true`, the widget will go back to its initial value when released.
|
||||
|
||||
### `doubleTap`
|
||||
### `doubleTap`
|
||||
- type: `boolean`
|
||||
- default: `false`
|
||||
- usage: set to `true` to make the knob reset to its initial value when receiving a double tap
|
||||
|
|
@ -231,12 +231,12 @@ An endless knob that only responds to rotative gestures.
|
|||
- can be an `object` if the type needs to be specified (see [preArgs](./widgets.md#preargs))
|
||||
|
||||
|
||||
### `snap`
|
||||
### `snap`
|
||||
- type: `boolean`
|
||||
- default: `false`
|
||||
- usage: by default, dragging the widget will modify it's value starting from its last value. Setting this to `true` will make it snap directly to the mouse/touch position.
|
||||
|
||||
### `doubleTap`
|
||||
### `doubleTap`
|
||||
- type: `boolean`
|
||||
- default: `false`
|
||||
- usage: set to `true` to make the encoder reset to its initial value when receiving a double tap
|
||||
|
|
@ -245,3 +245,23 @@ An endless knob that only responds to rotative gestures.
|
|||
```
|
||||
--color-knob:color;
|
||||
```
|
||||
|
||||
|
||||
## Range
|
||||
|
||||
A range is a fader with two handles. To move the range (both handles at once), hold the `shift` key or use two fingers.
|
||||
|
||||
```js
|
||||
{
|
||||
type:'range',
|
||||
// etc
|
||||
}
|
||||
```
|
||||
|
||||
### `split`
|
||||
- type: `boolean|object`
|
||||
- default: `false`
|
||||
- usage:
|
||||
- set to `true` to send separate osc messages for `low` and `high` handles. The `address` will be the same as the widget's with `/low` or `/high` appended to it
|
||||
- can be set as an object to specify a different `address` : `['/osc_address_low', '/osc_address_high']`
|
||||
- note: the widget will only respond to its original osc address, not to the splitted version
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ The switcher looks like the [`switch`](buttons/#switch). Each of its possible va
|
|||
}
|
||||
```
|
||||
|
||||
### `linkedWidgets`
|
||||
### `linkedWidgets`
|
||||
- type: `array|string`
|
||||
- default:
|
||||
`empty`
|
||||
|
|
@ -25,7 +25,7 @@ The switcher looks like the [`switch`](buttons/#switch). Each of its possible va
|
|||
- as an `array`: a list of widget `id` `strings`
|
||||
|
||||
|
||||
### `values`
|
||||
### `values`
|
||||
- type: `array|object`
|
||||
- default: `["A", "B"]`
|
||||
- usage:
|
||||
|
|
|
|||
|
|
@ -4,16 +4,16 @@ All widgets share a set of generic properties described below.
|
|||
|
||||
## Basics
|
||||
|
||||
### `type`
|
||||
### `type`
|
||||
- type: `string`
|
||||
- default: `fader`
|
||||
|
||||
### `id`
|
||||
### `id`
|
||||
- type: `string`
|
||||
- default: generated unique 'widget_n'
|
||||
- usage: widgets sharing the same `id` will act as clones and update each other's value(s) without sending extra osc messages.
|
||||
|
||||
### `linkId`
|
||||
### `linkId`
|
||||
- type: `string`
|
||||
- default: `empty`
|
||||
- usage: widgets sharing the same `linkId` update each other's value(s) AND send their respective osc messages.
|
||||
|
|
@ -21,14 +21,14 @@ All widgets share a set of generic properties described below.
|
|||
|
||||
## Style
|
||||
|
||||
### `label`
|
||||
### `label`
|
||||
- type: `string|false`
|
||||
- default: `auto`, which displays `id`
|
||||
- usage:
|
||||
- set to `false` to hide completely
|
||||
- insert icons from [FontAwesome](http://fontawesome.io/icons/) using the prefix `^` followed by the icon's name : `made with ^heart`, etc
|
||||
- insert icons from [FontAwesome](https://fontawesome.com/icons?d=gallery&s=solid&m=free) using the prefix `^` followed by the icon's name : `made with ^heart`, etc
|
||||
|
||||
### `top` / `left`
|
||||
### `top` / `left`
|
||||
- type: `number|percentage`
|
||||
- default: `auto`
|
||||
- usage:
|
||||
|
|
@ -36,11 +36,11 @@ All widgets share a set of generic properties described below.
|
|||
- otherwise, the widget will be absolutely positioned
|
||||
|
||||
|
||||
### `width` / `height`
|
||||
### `width` / `height`
|
||||
- type: `number|percentage`
|
||||
- default: `auto`
|
||||
|
||||
### `color`
|
||||
### `color`
|
||||
- type: `string`
|
||||
- default: `auto`, inherited accent color
|
||||
- usage: any valid `css` color code is valid, this will change the default accent color for the widget and all its children
|
||||
|
|
@ -66,9 +66,11 @@ All widgets share a set of generic properties described below.
|
|||
|
||||
|
||||
### `precision`
|
||||
- type: `integer`
|
||||
- type: `integer|string`
|
||||
- default: `2`
|
||||
- usage: the `precision` property defines the number of decimals to display and to send. Set to `0` to send `integers` only.
|
||||
- usage: the `precision` property defines the number of decimals to display and to send.
|
||||
- set to `0` to send `integers` only.
|
||||
- a specific data type can be specified by appending a valid osc type tag to the precision value, for example : `3d` will make the widget send double precision numbers rounded to three decimals
|
||||
|
||||
### `target`
|
||||
- type: `array`
|
||||
|
|
@ -100,7 +102,7 @@ All widgets share a set of generic properties described below.
|
|||
- default: `[]`
|
||||
- usage:
|
||||
- each element of the `array` defines a constant value that will be prepended to the osc message
|
||||
- values can be defined as objects if the type needs to be specified (ie different from the default implied by the `precision`)
|
||||
- values can be defined as objects if the osc data type needs to be specified (ie different from the default implied by the `precision` option)
|
||||
- example:
|
||||
```js
|
||||
preArgs: [
|
||||
|
|
|
|||
|
Before Width: | Height: | Size: 78 KiB After Width: | Height: | Size: 62 KiB |
BIN
resources/images/logo-browserstack.png
Normal file
|
After Width: | Height: | Size: 11 KiB |
|
|
@ -1,101 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||
|
||||
<svg
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:cc="http://creativecommons.org/ns#"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
width="146.75555mm"
|
||||
height="146.75555mm"
|
||||
viewBox="0 0 520 519.99999"
|
||||
id="svg2"
|
||||
version="1.1"
|
||||
inkscape:version="0.92.1 r15371"
|
||||
enable-background="new"
|
||||
sodipodi:docname="logo-material.svg"
|
||||
inkscape:export-filename="/home/bordun/Ammd/open-stage-control/resources/images/logo.png"
|
||||
inkscape:export-xdpi="44.307693"
|
||||
inkscape:export-ydpi="44.307693">
|
||||
<defs
|
||||
id="defs4" />
|
||||
<sodipodi:namedview
|
||||
id="base"
|
||||
pagecolor="#000000"
|
||||
bordercolor="#666666"
|
||||
borderopacity="1.0"
|
||||
inkscape:pageopacity="0"
|
||||
inkscape:pageshadow="2"
|
||||
inkscape:zoom="0.60172068"
|
||||
inkscape:cx="365.73236"
|
||||
inkscape:cy="375.30189"
|
||||
inkscape:document-units="px"
|
||||
inkscape:current-layer="layer1"
|
||||
showgrid="false"
|
||||
fit-margin-top="0"
|
||||
fit-margin-left="0"
|
||||
fit-margin-right="0"
|
||||
fit-margin-bottom="0"
|
||||
inkscape:window-width="1024"
|
||||
inkscape:window-height="768"
|
||||
inkscape:window-x="0"
|
||||
inkscape:window-y="0"
|
||||
inkscape:window-maximized="0"
|
||||
showguides="true" />
|
||||
<metadata
|
||||
id="metadata7">
|
||||
<rdf:RDF>
|
||||
<cc:Work
|
||||
rdf:about="">
|
||||
<dc:format>image/svg+xml</dc:format>
|
||||
<dc:type
|
||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||
<dc:title />
|
||||
</cc:Work>
|
||||
</rdf:RDF>
|
||||
</metadata>
|
||||
<g
|
||||
inkscape:groupmode="layer"
|
||||
id="layer1"
|
||||
inkscape:label="Layer 1">
|
||||
<path
|
||||
style="color:#000000;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:medium;line-height:normal;font-family:sans-serif;font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-feature-settings:normal;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;letter-spacing:normal;word-spacing:normal;text-transform:none;writing-mode:lr-tb;direction:ltr;text-orientation:mixed;dominant-baseline:auto;baseline-shift:baseline;text-anchor:start;white-space:normal;shape-padding:0;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:0.505;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;vector-effect:none;fill:#fffbff;fill-opacity:0.79365081;fill-rule:nonzero;stroke:#ffffff;stroke-width:7.49999965;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate"
|
||||
d="m 261.27684,38.57666 c -138.98447,0 -252.0208589,113.03638 -252.0208589,252.02086 0,70.16669 28.8215489,133.70969 75.2362029,179.44335 L 108.65112,445.88194 C 68.506687,406.42298 43.635863,351.4771 43.635863,290.59752 c 0,-120.40349 97.237497,-217.640978 217.640977,-217.640979 120.4035,0 217.64098,97.237489 217.64098,217.640979 0,61.10926 -25.05967,116.23905 -65.47118,155.72937 l 24.15894,24.15893 c 46.68197,-45.76612 75.69579,-109.49245 75.69579,-179.8883 0,-138.98448 -113.04005,-252.02086 -252.02453,-252.02086 z"
|
||||
id="circle942"
|
||||
inkscape:connector-curvature="0"
|
||||
inkscape:transform-center-x="1.8122676"
|
||||
inkscape:transform-center-y="-32.620818" />
|
||||
<circle
|
||||
style="opacity:0.819;fill:#fbfbfb;fill-opacity:1;stroke:none;stroke-width:41.35679245;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:0.33160622"
|
||||
id="circle940"
|
||||
cx="261.27762"
|
||||
cy="290.5976"
|
||||
r="168.40112" />
|
||||
<path
|
||||
style="color:#000000;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:medium;line-height:normal;font-family:sans-serif;font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-feature-settings:normal;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;letter-spacing:normal;word-spacing:normal;text-transform:none;writing-mode:lr-tb;direction:ltr;text-orientation:mixed;dominant-baseline:auto;baseline-shift:baseline;text-anchor:start;white-space:normal;shape-padding:0;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;vector-effect:none;fill:#52a8ff;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:34.38120651;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate"
|
||||
d="m 261.27571,38.574572 c -138.98447,0 -252.0215348,113.037068 -252.0215348,252.021528 0,69.81688 28.5311308,133.08046 74.5395508,178.76343 L 107.95269,445.20057 C 68.216666,405.79166 43.638798,351.12389 43.638798,290.5961 c 0,-120.40348 97.233432,-217.639483 217.636912,-217.639483 60.52778,0 115.19555,24.580443 154.60444,64.316463 l 24.15896,-24.15896 C 394.35617,67.105818 331.09248,38.574572 261.27571,38.574572 Z"
|
||||
id="circle944"
|
||||
inkscape:connector-curvature="0" />
|
||||
<circle
|
||||
r="169.31087"
|
||||
cy="290.5976"
|
||||
cx="261.27762"
|
||||
id="circle938"
|
||||
style="opacity:1;fill:none;fill-opacity:1;stroke:#fff6ff;stroke-width:5.07821894;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
|
||||
<path
|
||||
style="opacity:1;fill:none;stroke:#52a8ff;stroke-width:35.16100311;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
|
||||
d="M 389.38926,163.59698 278.09817,275.90931"
|
||||
id="path956"
|
||||
inkscape:connector-curvature="0" />
|
||||
<path
|
||||
inkscape:transform-center-y="-32.620818"
|
||||
inkscape:transform-center-x="1.8122676"
|
||||
inkscape:connector-curvature="0"
|
||||
id="path4487"
|
||||
d="m 261.27684,38.57666 c -138.98447,0 -252.0208589,113.03638 -252.0208589,252.02086 0,70.16669 28.8215489,133.70969 75.2362029,179.44335 L 108.65112,445.88194 C 68.506687,406.42298 43.635863,351.4771 43.635863,290.59752 c 0,-120.40349 97.237497,-217.640978 217.640977,-217.640979 120.4035,0 217.64098,97.237489 217.64098,217.640979 0,61.10926 -25.05967,116.23905 -65.47118,155.72937 l 24.15894,24.15893 c 46.68197,-45.76612 75.69579,-109.49245 75.69579,-179.8883 0,-138.98448 -113.04005,-252.02086 -252.02453,-252.02086 z"
|
||||
style="color:#000000;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:medium;line-height:normal;font-family:sans-serif;font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-feature-settings:normal;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;letter-spacing:normal;word-spacing:normal;text-transform:none;writing-mode:lr-tb;direction:ltr;text-orientation:mixed;dominant-baseline:auto;baseline-shift:baseline;text-anchor:start;white-space:normal;shape-padding:0;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:0.819;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;vector-effect:none;fill:none;fill-opacity:0.33160622;fill-rule:nonzero;stroke:#989898;stroke-width:7.49999965;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate" />
|
||||
</g>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 8.2 KiB |
BIN
resources/images/logo-nobadge.png
Normal file
|
After Width: | Height: | Size: 12 KiB |
105
resources/images/logo-nobadge.svg
Normal file
|
After Width: | Height: | Size: 110 KiB |
|
Before Width: | Height: | Size: 264 KiB After Width: | Height: | Size: 264 KiB |
|
Before Width: | Height: | Size: 19 KiB After Width: | Height: | Size: 14 KiB |
|
Before Width: | Height: | Size: 9.1 KiB After Width: | Height: | Size: 109 KiB |
BIN
resources/images/mockup.xcf
Normal file
|
|
@ -1,20 +1,31 @@
|
|||
site_name: Open Stage Control
|
||||
repo_name: open-stage-control
|
||||
repo_url: https://github.com/jean-emmanuel/open-stage-control
|
||||
edit_uri: tree/master/resources/docs/
|
||||
copyright: "Open Stage Control is an <a href='http://ammd.net'>AMMD</a> software licensed under the <a href='https://github.com/jean-emmanuel/open-stage-control/blob/master/LICENSE'>GNU/GPLv3</a> License"
|
||||
site_description: "A libre desktop OSC bi-directionnal control surface application."
|
||||
|
||||
theme_dir: mkdocs-material/material
|
||||
|
||||
site_favicon: img/logo.png
|
||||
|
||||
extra:
|
||||
theme:
|
||||
name: 'material'
|
||||
custom_dir: 'mkdocs-material/material'
|
||||
feature:
|
||||
tabs: false
|
||||
logo: img/logo-material.svg
|
||||
tabs: true
|
||||
favicon: 'img/logo-nobadge.png?1'
|
||||
language: 'en'
|
||||
logo: 'img/logo-nobadge.svg'
|
||||
palette:
|
||||
primary: 'blue grey'
|
||||
accent: 'light blue'
|
||||
font:
|
||||
text: 'Roboto'
|
||||
code: 'Roboto Mono'
|
||||
|
||||
extra_css:
|
||||
- 'css/extra.css'
|
||||
|
||||
pages:
|
||||
- Open Stage Control: index.md
|
||||
- OSC Control Surface: index.md
|
||||
- Getting started: getting-started.md
|
||||
- User interface: interface.md
|
||||
- Editing sessions: editing-sessions.md
|
||||
|
|
@ -35,6 +46,8 @@ pages:
|
|||
- Remote control: extras/remote-control.md
|
||||
- Custom module: extras/custom-module.md
|
||||
- Midi: extras/midi.md
|
||||
- Examples: examples.md
|
||||
- Credits: credits.md
|
||||
|
||||
markdown_extensions:
|
||||
- markdown.extensions.admonition
|
||||
|
|
|
|||
|
|
@ -1,5 +1,8 @@
|
|||
var browserify = require('browserify'),
|
||||
licensify = require('licensify'),
|
||||
uglifyify = require('uglifyify'),
|
||||
through = require('through'),
|
||||
minimatch = require('minimatch').Minimatch,
|
||||
licensify = require('licensify'),
|
||||
exorcist = require('exorcist'),
|
||||
path = require('path'),
|
||||
babelify = require('babelify'),
|
||||
|
|
@ -7,16 +10,32 @@ var browserify = require('browserify'),
|
|||
fast = process.argv.indexOf('--fast') != -1,
|
||||
b
|
||||
|
||||
var ignoreList = ['**/mathjs/dist/math.min.js', '**/jquery.slim.min.js', '**/jquery.ui.js', '**/socket.io.slim.js'],
|
||||
ignoreWrapper = function(transform){
|
||||
return function(file, opts){
|
||||
if (
|
||||
ignoreList.some(function(pattern) {
|
||||
var match = minimatch(pattern)
|
||||
return match.match(file)
|
||||
})
|
||||
) {
|
||||
return through()
|
||||
} else {
|
||||
return transform(file, opts)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (prod) console.warn('\x1b[36m%s\x1b[0m', 'Building minified js bundle for production... This may take a while... ');
|
||||
|
||||
b = browserify(path.resolve(__dirname + '/../src/browser/js/browser.js'), {debug:!fast})
|
||||
b = browserify(path.resolve(__dirname + '/../src/browser/js/browser.js'), {debug:!fast, insertGlobals:fast, noParse: ignoreList})
|
||||
|
||||
b = b.transform(ignoreWrapper(babelify), {presets: ["env"]})
|
||||
|
||||
if (prod) b = b.transform(ignoreWrapper(uglifyify), {global: true})
|
||||
|
||||
b.plugin(licensify)
|
||||
|
||||
b = b.transform(babelify, {presets: ["env"]})
|
||||
|
||||
if (prod) b = b.transform('uglifyify', {global: true})
|
||||
|
||||
b = b.bundle()
|
||||
|
||||
|
|
|
|||
85
src/browser/js/app/dom.js
Normal file
|
|
@ -0,0 +1,85 @@
|
|||
var DomParserFragment,
|
||||
readyCallbacks = [],
|
||||
initState = false
|
||||
|
||||
module.exports = {
|
||||
|
||||
init: function() {
|
||||
|
||||
DomParserFragment = document.createRange()
|
||||
DomParserFragment.selectNode(document.body)
|
||||
|
||||
for (var i in readyCallbacks) {
|
||||
readyCallbacks[i]()
|
||||
}
|
||||
|
||||
initState = true
|
||||
|
||||
},
|
||||
|
||||
ready: function(callback) {
|
||||
if (initState) {
|
||||
callback()
|
||||
} else {
|
||||
readyCallbacks.push(callback)
|
||||
}
|
||||
},
|
||||
|
||||
dispatchEvent: function(element, name, data) {
|
||||
|
||||
var event = new CustomEvent(name, {
|
||||
detail: data,
|
||||
bubbles: true,
|
||||
cancelable: true
|
||||
})
|
||||
|
||||
element.dispatchEvent(event)
|
||||
|
||||
},
|
||||
|
||||
addEventListener: function(element, events, listener, capture) {
|
||||
|
||||
var eventsAsObject = typeof events == 'string' ? events.split(' ') : events
|
||||
|
||||
for (var i in eventsAsObject) {
|
||||
|
||||
element.addEventListener(eventsAsObject[i], listener, capture)
|
||||
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
get: function(a, b) {
|
||||
|
||||
var context = b ? a : document,
|
||||
selector = b || a
|
||||
|
||||
if (selector.indexOf('>') == 0) selector = ':scope ' + selector
|
||||
|
||||
var nodes = context.querySelectorAll(selector)
|
||||
return NodeList.prototype.forEach ? nodes : [...nodes]
|
||||
|
||||
},
|
||||
|
||||
create: function(html) {
|
||||
|
||||
return DomParserFragment.createContextualFragment(html.trim()).firstChild
|
||||
|
||||
},
|
||||
|
||||
each: function(context, selector, callback) {
|
||||
|
||||
var nodes = module.exports.get(context, selector)
|
||||
|
||||
nodes.forEach(callback)
|
||||
|
||||
return nodes
|
||||
|
||||
},
|
||||
|
||||
index: function(element) {
|
||||
var parent = element.parentNode
|
||||
return parent ? Array.prototype.indexOf.call(parent.children, element) : -1
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,59 +1,99 @@
|
|||
var correctPosition = function (m, parent){
|
||||
var pos = m.offset(),
|
||||
width = m.outerWidth(),
|
||||
height = m.outerHeight(),
|
||||
totalWidth = $('body').outerWidth(),
|
||||
totalHeight = $('body').outerHeight(),
|
||||
leftAdjust = parent=='body'?0:parent.outerWidth()-2
|
||||
class ContextMenu {
|
||||
|
||||
if (width + pos.left > totalWidth) {
|
||||
m.css({'margin-left':totalWidth-(width + pos.left + leftAdjust)})
|
||||
}
|
||||
if (height + pos.top > totalHeight) {
|
||||
m.css({'margin-top':totalHeight-(height + pos.top)})
|
||||
}
|
||||
}
|
||||
constructor(){
|
||||
|
||||
var ev = 'fake-click'
|
||||
this.menu = null
|
||||
this.event = 'fast-click'
|
||||
this.root = 'body'
|
||||
|
||||
|
||||
var menu = function(e,actions,parent){
|
||||
|
||||
var m = $('<div class="context-menu"></div>')
|
||||
if (parent=='body') {
|
||||
m.css({top:e.pageY+'px',left:e.pageX+'px'})
|
||||
}
|
||||
|
||||
for (let label in actions) {
|
||||
open(e, actions, parent) {
|
||||
|
||||
if (typeof actions[label] == 'object') {
|
||||
var menu = $('<div class="context-menu"></div>')
|
||||
|
||||
var item = $(`<div class="item has-sub" tabIndex="1">${label}</div>`).appendTo(m).on(ev,function(e){e.stopPropagation()})
|
||||
menu(e,actions[label],item)
|
||||
for (let label in actions) {
|
||||
|
||||
if (typeof actions[label] == 'object') {
|
||||
|
||||
var item = $(`<div class="item has-sub" tabIndex="1">${label}</div>`)
|
||||
.appendTo(menu)
|
||||
.on(this.event, function(e){e.stopPropagation()})
|
||||
|
||||
this.open(e,actions[label],item)
|
||||
|
||||
|
||||
} else {
|
||||
} else {
|
||||
|
||||
$(`<div class="item">${label}</div>`).on(this.event,()=>{
|
||||
actions[label]()
|
||||
this.close()
|
||||
}).appendTo(menu)
|
||||
}
|
||||
|
||||
$(`<div class="item">${label}</div>`).on(ev + '.editor',function(){
|
||||
var callback = actions[label]
|
||||
return function(e){
|
||||
callback()
|
||||
$('.context-menu').remove()
|
||||
}
|
||||
}()).appendTo(m)
|
||||
}
|
||||
|
||||
if (parent) menu.appendTo(parent)
|
||||
|
||||
if (!parent) {
|
||||
|
||||
this.menu = menu
|
||||
|
||||
menu.appendTo(this.root)
|
||||
|
||||
menu.find('.item').hover(function(){
|
||||
$(this).siblings().removeClass('focus').find('.focus').removeClass('focus')
|
||||
$(this).addClass('focus')
|
||||
}, function(){
|
||||
if (!$(this).hasClass('has-sub')) $(this).removeClass('focus')
|
||||
})
|
||||
|
||||
menu.css({
|
||||
top: e.pageY + 'px',
|
||||
left: e.pageX + 'px'
|
||||
})
|
||||
|
||||
this.correctPosition(menu)
|
||||
|
||||
menu.find('.context-menu').each((i, m)=>{
|
||||
this.correctPosition($(m), $(m).parent())
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
m.appendTo(parent)
|
||||
close() {
|
||||
|
||||
if (this.menu) {
|
||||
|
||||
this.menu.remove()
|
||||
this.menu = null
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
correctPosition(menu, parent) {
|
||||
|
||||
var pos = menu.offset(),
|
||||
width = menu.outerWidth(),
|
||||
height = menu.outerHeight(),
|
||||
totalWidth = $(this.root).outerWidth(),
|
||||
totalHeight = $(this.root).outerHeight(),
|
||||
leftAdjust = !parent ? 0 : parent.outerWidth() - 2
|
||||
|
||||
if (width + pos.left > totalWidth) {
|
||||
menu.css({'margin-left': totalWidth - (width + pos.left + leftAdjust)})
|
||||
}
|
||||
if (height + pos.top > totalHeight) {
|
||||
menu.css({'margin-top': totalHeight - (height + pos.top)})
|
||||
}
|
||||
|
||||
if (parent=='body') {
|
||||
correctPosition(m,parent)
|
||||
} else {
|
||||
parent.hover(function(){correctPosition(m,parent)})
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
module.exports = menu
|
||||
|
||||
module.exports = ContextMenu
|
||||
|
|
|
|||
|
|
@ -1,31 +1,29 @@
|
|||
var editObject = function(){editObject = require('./edit-objects').editObject; editObject(...arguments)},
|
||||
purgeStores = require('./purge'),
|
||||
{iconify} = require('../utils'),
|
||||
{iconify} = require('../ui/utils'),
|
||||
widgetManager = require('../managers/widgets'),
|
||||
resize = require('../events/resize'),
|
||||
stateManager = require('../managers/state'),
|
||||
parser = require('../parser')
|
||||
|
||||
var getObjectData = function(obj){
|
||||
var path = []
|
||||
|
||||
if (obj.hasClass('widget')) {
|
||||
return obj[0].abstract.props
|
||||
} else {
|
||||
return obj.closest('.widget')[0].abstract.props
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
var updateDom = function(container,data, remote) {
|
||||
var updateWidget = function(widget, options = {}) {
|
||||
|
||||
// save state
|
||||
var scroll = $('#sidepanel').scrollTop(),
|
||||
oldWidgets = container[0].abstract.hashes || [container[0].abstract.hash],
|
||||
wState = {},
|
||||
var sidepanel = DOM.get('#sidepanel')[0],
|
||||
scroll = sidepanel.scrollTop,
|
||||
oldWidgets = widget.childrenHashes.concat(widget.hash),
|
||||
oldValueProps = {},
|
||||
wScroll = {}
|
||||
|
||||
stateManager.incrementQueue()
|
||||
|
||||
for (let h of oldWidgets) {
|
||||
if (widgetManager.widgets[h] && widgetManager.widgets[h].getValue) {
|
||||
wState[widgetManager.widgets[h].getProp('id')] = widgetManager.widgets[h].getValue()
|
||||
if (widgetManager.widgets[h]) {
|
||||
let id = widgetManager.widgets[h].getProp('id'),
|
||||
value = widgetManager.widgets[h].getValue(),
|
||||
valueProp = widgetManager.widgets[h].getProp('value')
|
||||
|
||||
stateManager.pushValueState(id, value)
|
||||
if (valueProp !== '' && valueProp !== undefined) stateManager.pushValueOldProp(id, valueProp)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -36,29 +34,23 @@ var updateDom = function(container,data, remote) {
|
|||
}
|
||||
}
|
||||
|
||||
widgetManager.removeWidgets(oldWidgets)
|
||||
|
||||
// widget
|
||||
var newContainer = parser.parse([data], container[0].abstract.parentNode, container[0].abstract.parent)
|
||||
container.replaceWith(newContainer)
|
||||
var newWidget = parser.parse([widget.props], widget.parentNode, widget.parent)
|
||||
|
||||
if (data.type == 'tab') newContainer.trigger('tab-created')
|
||||
widget.container.parentNode.replaceChild(newWidget.container, widget.container)
|
||||
|
||||
if (container[0].abstract.parent && container[0].abstract.parent.registerHashes) {
|
||||
container[0].abstract.parent.registerHashes(true)
|
||||
}
|
||||
if (newWidget.getProp('type') == 'tab') newWidget.parent.trigger('tab-created', [{widget: widget}])
|
||||
if (newWidget.getProp('id') == 'root') DOM.get('.editor-root')[0].setAttribute('data-widget', newWidget.hash)
|
||||
|
||||
$('.editor-root').attr('data-widget', $('.root-container').attr('data-widget'))
|
||||
|
||||
newContainer.trigger('resize')
|
||||
|
||||
purgeStores(oldWidgets)
|
||||
resize.check(newWidget.container)
|
||||
|
||||
|
||||
// restore state
|
||||
for (let id in wState) {
|
||||
for (let w of widgetManager.getWidgetById(id)) {
|
||||
if (w.setValue) w.setValue(wState[id])
|
||||
}
|
||||
}
|
||||
stateManager.decrementQueue()
|
||||
|
||||
|
||||
// restore scroll states
|
||||
for (let id in wScroll) {
|
||||
|
|
@ -67,15 +59,15 @@ var updateDom = function(container,data, remote) {
|
|||
}
|
||||
}
|
||||
|
||||
if (!remote) {
|
||||
editObject(newContainer,data,true)
|
||||
if (!options.remote) {
|
||||
editObject(newWidget, {refresh: true})
|
||||
}
|
||||
|
||||
$('#sidepanel').scrollTop(scroll)
|
||||
sidepanel.scrollTop = scroll
|
||||
|
||||
|
||||
// return updated node
|
||||
return newContainer
|
||||
return newWidget
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -154,7 +146,6 @@ var incrementWidget = function(data, root){
|
|||
}
|
||||
|
||||
module.exports = {
|
||||
updateDom:updateDom,
|
||||
getObjectData:getObjectData,
|
||||
updateWidget:updateWidget,
|
||||
incrementWidget:incrementWidget
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,14 +1,13 @@
|
|||
var updateDom = require('./data-workers').updateDom,
|
||||
var {updateWidget} = require('./data-workers'),
|
||||
{widgets, categories} = require('../widgets/'),
|
||||
{icon} = require('../utils'),
|
||||
widgetManager = require('../managers/widgets'),
|
||||
{icon} = require('../ui/utils'),
|
||||
defaults = {}
|
||||
|
||||
for (var k in widgets) {
|
||||
defaults[k] = widgets[k].defaults()
|
||||
}
|
||||
|
||||
var ev = 'fake-click'
|
||||
|
||||
var editClean = function(){
|
||||
$('.editing').removeClass('editing')
|
||||
$('.widget.ui-resizable').resizable('destroy')
|
||||
|
|
@ -17,13 +16,16 @@ var editClean = function(){
|
|||
}
|
||||
|
||||
|
||||
var editObject = function(container, data, refresh){
|
||||
var editObject = function(widget, options = {}){
|
||||
|
||||
if (!refresh && (container.hasClass('editing') || $(`a[data-tab="#${container.attr('id')}"]`).hasClass('editing'))) return
|
||||
var container = $(widget.container),
|
||||
data = widget.props
|
||||
|
||||
if (!options.refresh && (container.hasClass('editing'))) return
|
||||
|
||||
editClean()
|
||||
|
||||
$(`[data-widget="${container.attr('data-widget')}"]`).addClass('editing')
|
||||
$(`[data-widget="${widget.hash}"]`).addClass('editing')
|
||||
|
||||
$('#editor').append('<div class="editor-container"></div>')
|
||||
|
||||
|
|
@ -111,10 +113,7 @@ var editObject = function(container, data, refresh){
|
|||
if (v==='') delete data[title]
|
||||
|
||||
try {
|
||||
var w = updateDom(container,data)
|
||||
if (title == 'value' && v != '') {
|
||||
w[0].abstract.setValue(v, {sync:true})
|
||||
}
|
||||
updateWidget(widget)
|
||||
wrapper.removeClass('error')
|
||||
} catch (err) {
|
||||
wrapper.addClass('error')
|
||||
|
|
@ -136,7 +135,7 @@ var editObject = function(container, data, refresh){
|
|||
|
||||
var editItem = function(i) {
|
||||
return function(){
|
||||
container.find('.widget').first().siblings().addBack().eq(i).trigger(ev)
|
||||
editObject(widgetManager.getWidgetByElement(container.find('.widget').first().siblings().addBack().eq(i)[0]))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -147,12 +146,12 @@ var editObject = function(container, data, refresh){
|
|||
.appendTo(list)
|
||||
.click(editItem(i))
|
||||
|
||||
var remove = $('<span><i class="fa fa-remove"></i></span>')
|
||||
var remove = $('<span><i class="fa fa-times"></i></span>')
|
||||
.appendTo(item)
|
||||
.click(function(e){
|
||||
e.stopPropagation()
|
||||
data.widgets.splice($(this).parent().attr('data-index'),1)
|
||||
updateDom(container,data)
|
||||
updateWidget(widget)
|
||||
})
|
||||
}
|
||||
|
||||
|
|
@ -166,7 +165,7 @@ var editObject = function(container, data, refresh){
|
|||
|
||||
data.widgets.splice(newIndex, 0, data.widgets.splice(prevIndex, 1)[0])
|
||||
|
||||
updateDom(container,data)
|
||||
updateWidget(widget)
|
||||
}
|
||||
})
|
||||
|
||||
|
|
@ -174,7 +173,7 @@ var editObject = function(container, data, refresh){
|
|||
data.widgets = data.widgets || []
|
||||
data.widgets.push({})
|
||||
|
||||
updateDom(container,data)
|
||||
updateWidget(widget)
|
||||
})
|
||||
|
||||
list.appendTo(wrapper)
|
||||
|
|
@ -193,7 +192,7 @@ var editObject = function(container, data, refresh){
|
|||
|
||||
var editItem = function(i) {
|
||||
return function(){
|
||||
container.find('.tablist li').first().siblings().addBack().eq(i).trigger(ev)
|
||||
editObject(widgetManager.getWidgetByElement(container.find('.tablist li').first().siblings().addBack().eq(i)[0]))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -202,12 +201,12 @@ var editObject = function(container, data, refresh){
|
|||
.appendTo(list)
|
||||
.click(editItem(i))
|
||||
|
||||
var remove = $('<span><i class="fa fa-remove"></i></span>')
|
||||
var remove = $('<span><i class="fa fa-times"></i></span>')
|
||||
.appendTo(item)
|
||||
.click(function(e){
|
||||
e.stopPropagation()
|
||||
data.tabs.splice($(this).parent().attr('data-index'),1)
|
||||
updateDom(container,data)
|
||||
updateWidget(widget)
|
||||
})
|
||||
}
|
||||
|
||||
|
|
@ -221,7 +220,7 @@ var editObject = function(container, data, refresh){
|
|||
|
||||
data.tabs.splice(newIndex, 0, data.tabs.splice(prevIndex, 1)[0])
|
||||
|
||||
updateDom(container,data)
|
||||
updateWidget(widget)
|
||||
}
|
||||
})
|
||||
|
||||
|
|
@ -229,7 +228,7 @@ var editObject = function(container, data, refresh){
|
|||
data.tabs = data.tabs || []
|
||||
data.tabs.push({})
|
||||
|
||||
updateDom(container,data)
|
||||
updateWidget(widget)
|
||||
})
|
||||
|
||||
list.appendTo(wrapper)
|
||||
|
|
@ -250,7 +249,7 @@ var editObject = function(container, data, refresh){
|
|||
stop: function( event, ui ) {
|
||||
if (handleTarget.hasClass('ui-resizable-se') || handleTarget.hasClass('ui-resizable-s')) data.height = Math.round((Math.max(ui.size.height,1)) / (GRIDWIDTH * PXSCALE)) * GRIDWIDTH
|
||||
if (handleTarget.hasClass('ui-resizable-se') || handleTarget.hasClass('ui-resizable-e')) data.width = Math.round(ui.size.width / (GRIDWIDTH * PXSCALE)) * GRIDWIDTH
|
||||
updateDom(container,data)
|
||||
updateWidget(widget)
|
||||
},
|
||||
grid: [GRIDWIDTH * PXSCALE, GRIDWIDTH * PXSCALE]
|
||||
})
|
||||
|
|
@ -268,7 +267,7 @@ var editObject = function(container, data, refresh){
|
|||
data.top = (ui.helper.position().top + container.parent().scrollTop())/PXSCALE
|
||||
data.left = (ui.helper.position().left + container.parent().scrollLeft())/PXSCALE
|
||||
ui.helper.remove()
|
||||
updateDom(container,data)
|
||||
updateWidget(widget)
|
||||
},
|
||||
handle:'.ui-draggable-handle, > .label',
|
||||
grid: [GRIDWIDTH * PXSCALE, GRIDWIDTH * PXSCALE],
|
||||
|
|
|
|||
|
|
@ -4,12 +4,6 @@ var Editor = class Editor {
|
|||
|
||||
constructor() {
|
||||
|
||||
$(document).ready(()=>{
|
||||
|
||||
init()
|
||||
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
enable() {
|
||||
|
|
|
|||
|
|
@ -1,177 +1,160 @@
|
|||
var {getObjectData, updateDom, incrementWidget} = require('./data-workers'),
|
||||
var {updateWidget, incrementWidget} = require('./data-workers'),
|
||||
{editObject, editClean} = require('./edit-objects'),
|
||||
createPopup = require('../utils').createPopup,
|
||||
{Popup} = require('../ui/utils'),
|
||||
{widgets, categories} = require('../widgets/'),
|
||||
widgetManager = require('../managers/widgets'),
|
||||
menu = require('./context-menu')
|
||||
ContextMenu = require('./context-menu')
|
||||
|
||||
|
||||
var menu = new ContextMenu()
|
||||
|
||||
var init = function(){
|
||||
var handleClick = function(event) {
|
||||
|
||||
$('body').off('.editor').on('fake-click fake-right-click',function(e,d){
|
||||
if (!EDITING) return
|
||||
|
||||
if (!EDITING) return
|
||||
menu.close()
|
||||
|
||||
// ignore mouse event when fired by a simulated touch event
|
||||
// already handled in drag.js
|
||||
// if (e.type=='mousedown' && e.originalEvent.sourceCapabilities.firesTouchEvents) return
|
||||
var eventData = event.detail,
|
||||
widget = widgetManager.getWidgetByElement(eventData.target, ':not(.not-editable)')
|
||||
|
||||
$('.context-menu').remove()
|
||||
if (!widget) return
|
||||
|
||||
if (e.target.classList.contains('not-editable')) return
|
||||
var container = widget.container,
|
||||
index = DOM.index(container),
|
||||
data = widget.props,
|
||||
type = widget.props.type == 'tab' ? 'tab' : 'widget'
|
||||
|
||||
var target = e.target.hasAttribute('data-widget') || e.target.classList.contains('widget') ?
|
||||
$(e.target).not('.not-editable') : $(e.target).closest('.widget:not(.not-editable)')
|
||||
editObject(widget)
|
||||
|
||||
if (!target.length) return
|
||||
if (event.type!='fast-right-click') return
|
||||
|
||||
var widget = widgetManager.widgets[target.attr('data-widget')]
|
||||
|
||||
if (!widget) return
|
||||
|
||||
var container = widget.container,
|
||||
parent = container.parent(),
|
||||
index = container.index(),
|
||||
data = getObjectData(container),
|
||||
type = widget.props.type == 'tab' ? 'tab' : 'widget'
|
||||
|
||||
editObject(container,data)
|
||||
|
||||
if (e.type!='fake-right-click') return
|
||||
|
||||
if (container.hasClass('root-container')) {
|
||||
menu(d,{
|
||||
'<i class="fa fa-plus"></i> Add tab': function(){
|
||||
data.tabs.push({})
|
||||
updateDom(container,data)
|
||||
}
|
||||
},'body')
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
var actions = {},
|
||||
clickX = Math.round((d.offsetX + d.target.scrollLeft) / (GRIDWIDTH * PXSCALE)) * GRIDWIDTH,
|
||||
clickY = Math.round((d.offsetY + d.target.scrollTop) / (GRIDWIDTH * PXSCALE)) * GRIDWIDTH
|
||||
// actions['<i class="fa fa-edit"></i> Edit'] = function(){editObject(container,data)}
|
||||
|
||||
if (parent.hasClass('panel')) {
|
||||
actions['<i class="fa fa-object-group"></i> Edit parent'] = function(){parent.trigger('fake-click')}
|
||||
}
|
||||
|
||||
if (type=='widget') actions['<i class="fa fa-copy"></i> Copy'] = function(){CLIPBOARD=JSON.stringify(data)}
|
||||
|
||||
if (type=='widget') actions['<i class="fa fa-cut"></i> Cut'] = function(){
|
||||
CLIPBOARD=JSON.stringify(data)
|
||||
var parentContainer = container.parents('.widget').first(),
|
||||
parentData = getObjectData(parentContainer)
|
||||
|
||||
parentData.widgets.splice(index,1)
|
||||
updateDom(parentContainer,parentData)
|
||||
}
|
||||
|
||||
if (((type=='widget' && widgets[data.type].defaults().widgets) || (type=='tab')) && (!data.tabs||!data.tabs.length)) {
|
||||
|
||||
if (CLIPBOARD!=null) {
|
||||
actions['<i class="fa fa-paste"></i> Paste'] = {
|
||||
'<i class="fa fa-plus-circle"></i> ID + 1':function(){
|
||||
data.widgets = data.widgets || []
|
||||
var newData = incrementWidget(JSON.parse(CLIPBOARD))
|
||||
|
||||
|
||||
if (!target.hasClass('tablink')) {
|
||||
newData.top = clickY
|
||||
newData.left= clickX
|
||||
} else {
|
||||
delete newData.top
|
||||
delete newData.left
|
||||
}
|
||||
|
||||
data.widgets.push(newData)
|
||||
updateDom(container,data)
|
||||
},
|
||||
'<i class="fa fa-clone"></i> Clone':function(){
|
||||
data.widgets = data.widgets || []
|
||||
var newData = JSON.parse(CLIPBOARD)
|
||||
if (!target.hasClass('tablink')) {
|
||||
newData.top = clickY
|
||||
newData.left= clickX
|
||||
} else {
|
||||
delete newData.top
|
||||
delete newData.left
|
||||
}
|
||||
data.widgets.push(newData)
|
||||
updateDom(container,data)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
actions['<i class="fa fa-plus"></i> Add widget'] = {}
|
||||
for (let category in categories) {
|
||||
actions['<i class="fa fa-plus"></i> Add widget'][category] = {}
|
||||
for (let t in categories[category]) {
|
||||
let wtype = categories[category][t]
|
||||
actions['<i class="fa fa-plus"></i> Add widget'][category][wtype] = function(){
|
||||
data.widgets = data.widgets || []
|
||||
var newData = {type:wtype}
|
||||
if (!target.hasClass('tablink')) {
|
||||
newData.top = clickY
|
||||
newData.left= clickX
|
||||
}
|
||||
data.widgets.push(newData)
|
||||
updateDom(container,data)
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
if (((type=='widget' && widgets[data.type].defaults().tabs) || (type=='tab')) && (!data.widgets||!data.widgets.length)) {
|
||||
|
||||
actions['<i class="fa fa-plus"></i> Add tab'] = function(){
|
||||
data.tabs = data.tabs || []
|
||||
if (container.classList.contains('root-container')) {
|
||||
menu.open(eventData,{
|
||||
'<i class="fa fa-plus"></i> Add tab': function(){
|
||||
data.tabs.push({})
|
||||
updateDom(container,data)
|
||||
updateWidget(widget)
|
||||
}
|
||||
})
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
var actions = {},
|
||||
clickX = Math.round((eventData.offsetX + eventData.target.scrollLeft) / (GRIDWIDTH * PXSCALE)) * GRIDWIDTH,
|
||||
clickY = Math.round((eventData.offsetY + eventData.target.scrollTop) / (GRIDWIDTH * PXSCALE)) * GRIDWIDTH
|
||||
|
||||
if (widget.parent != widgetManager) {
|
||||
actions['<i class="fa fa-object-group"></i> Edit parent'] = function(){editObject(widget.parent)}
|
||||
}
|
||||
|
||||
if (type=='widget') actions['<i class="fa fa-copy"></i> Copy'] = function(){CLIPBOARD=JSON.stringify(data)}
|
||||
|
||||
if (type=='widget') actions['<i class="fa fa-cut"></i> Cut'] = function(){
|
||||
CLIPBOARD=JSON.stringify(data)
|
||||
widget.parent.props.widgets.splice(index,1)
|
||||
updateWidget(widget.parent)
|
||||
}
|
||||
|
||||
if (((type=='widget' && widgets[data.type].defaults().widgets) || (type=='tab')) && (!data.tabs||!data.tabs.length)) {
|
||||
|
||||
if (CLIPBOARD!=null) {
|
||||
actions['<i class="fa fa-paste"></i> Paste'] = {
|
||||
'<i class="fa fa-plus-circle"></i> ID + 1':function(){
|
||||
data.widgets = data.widgets || []
|
||||
var newData = incrementWidget(JSON.parse(CLIPBOARD))
|
||||
|
||||
|
||||
if (!eventData.target.classList.contains('tablink')) {
|
||||
newData.top = clickY
|
||||
newData.left= clickX
|
||||
} else {
|
||||
delete newData.top
|
||||
delete newData.left
|
||||
}
|
||||
|
||||
data.widgets.push(newData)
|
||||
updateWidget(widget)
|
||||
},
|
||||
'<i class="fa fa-clone"></i> Clone':function(){
|
||||
data.widgets = data.widgets || []
|
||||
var newData = JSON.parse(CLIPBOARD)
|
||||
if (!eventData.target.classList.contains('tablink')) {
|
||||
newData.top = clickY
|
||||
newData.left= clickX
|
||||
} else {
|
||||
delete newData.top
|
||||
delete newData.left
|
||||
}
|
||||
data.widgets.push(newData)
|
||||
updateWidget(widget)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
actions['<i class="fa fa-trash"></i> Delete'] = function(){
|
||||
var popup = createPopup('Are you sure ?',`
|
||||
actions['<i class="fa fa-plus"></i> Add widget'] = {}
|
||||
for (let category in categories) {
|
||||
actions['<i class="fa fa-plus"></i> Add widget'][category] = {}
|
||||
for (let t in categories[category]) {
|
||||
let wtype = categories[category][t]
|
||||
actions['<i class="fa fa-plus"></i> Add widget'][category][wtype] = function(){
|
||||
data.widgets = data.widgets || []
|
||||
var newData = {type:wtype}
|
||||
if (!eventData.target.classList.contains('tablink')) {
|
||||
newData.top = clickY
|
||||
newData.left= clickX
|
||||
}
|
||||
data.widgets.push(newData)
|
||||
updateWidget(widget)
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
if (((type=='widget' && widgets[data.type].defaults().tabs) || (type=='tab')) && (!data.widgets||!data.widgets.length)) {
|
||||
|
||||
actions['<i class="fa fa-plus"></i> Add tab'] = function(){
|
||||
data.tabs = data.tabs || []
|
||||
data.tabs.push({})
|
||||
updateWidget(widget)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
actions['<i class="fa fa-trash"></i> Delete'] = function(){
|
||||
var popup = new Popup({
|
||||
title: 'Are you sure ?',
|
||||
content:`
|
||||
<div class="actions">
|
||||
<a class="btn warning confirm-delete">DELETE</a>
|
||||
<a class="btn cancel-delete">CANCEL</a>
|
||||
</div>
|
||||
`)
|
||||
$('.confirm-delete').click(function(){
|
||||
popup.close()
|
||||
var parentContainer = container.parents('.widget').first(),
|
||||
parentData = getObjectData(parentContainer)
|
||||
</div>`,
|
||||
closable: false,
|
||||
escKey: true,
|
||||
enterKey: function(){DOM.get(this.html, '.confirm-delete')[0].click()}
|
||||
})
|
||||
|
||||
DOM.get(popup.html, '.confirm-delete')[0].addEventListener('click', function(){
|
||||
popup.close()
|
||||
|
||||
if (widget.props.type != 'tab') {
|
||||
parentData.widgets.splice(index,1)
|
||||
} else {
|
||||
parentData.tabs.splice(index,1)
|
||||
}
|
||||
if (widget.props.type != 'tab') {
|
||||
widget.parent.props.widgets.splice(index,1)
|
||||
} else {
|
||||
widget.parent.props.tabs.splice(index,1)
|
||||
}
|
||||
|
||||
updateDom(parentContainer,parentData)
|
||||
})
|
||||
$('.cancel-delete').click(function(){
|
||||
popup.close()
|
||||
})
|
||||
$(document).on('keydown.popup', function(e){
|
||||
if (e.keyCode==13) $('.confirm-delete').click()
|
||||
})
|
||||
updateWidget(widget.parent)
|
||||
})
|
||||
|
||||
DOM.get(popup.html, '.cancel-delete')[0].addEventListener('click', function(){
|
||||
popup.close()
|
||||
})
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
menu(d,actions,'body')
|
||||
|
||||
})
|
||||
menu.open(eventData, actions)
|
||||
|
||||
}
|
||||
|
||||
module.exports = init
|
||||
document.addEventListener('fast-right-click', handleClick)
|
||||
document.addEventListener('fast-click', handleClick)
|
||||
|
|
|
|||
|
|
@ -1,14 +0,0 @@
|
|||
var widgetManager = require('../managers/widgets')
|
||||
|
||||
module.exports = function(hashes) {
|
||||
// prune widget stores
|
||||
for (let i in hashes) {
|
||||
if (
|
||||
widgetManager.widgets[hashes[i]]
|
||||
) {
|
||||
widgetManager.removeWidget(hashes[i])
|
||||
}
|
||||
}
|
||||
widgetManager.purge()
|
||||
|
||||
}
|
||||
49
src/browser/js/app/events/click.js
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
var {fix, getElementOffset} = require('./utils'),
|
||||
supportsPassive = require('./supports-passive')
|
||||
|
||||
var longTouchTimer = false,
|
||||
clearLongTouchTimer = function() {
|
||||
if (longTouchTimer) {
|
||||
clearTimeout(longTouchTimer)
|
||||
longTouchTimer = false
|
||||
}
|
||||
}
|
||||
|
||||
document.body.setAttribute('oncontextmenu', 'return false')
|
||||
|
||||
document.addEventListener('mousedown', (event)=>{
|
||||
|
||||
if (event.sourceCapabilities && event.sourceCapabilities.firesTouchEvents) return
|
||||
if (event.button == 2) event.preventDefault()
|
||||
|
||||
var e = fix(event)
|
||||
|
||||
var name = event.button == 2 ? 'fast-right-click' : 'fast-click'
|
||||
|
||||
DOM.dispatchEvent(e.target, name, e)
|
||||
|
||||
})
|
||||
|
||||
document.addEventListener('touchstart', (event)=>{
|
||||
|
||||
var e = fix(event.changedTouches[0])
|
||||
|
||||
DOM.dispatchEvent(e.target, 'fast-click', e)
|
||||
|
||||
longTouchTimer = setTimeout(()=>{
|
||||
|
||||
var off = getElementOffset(e.target)
|
||||
|
||||
e.offsetX = e.pageX - off.left
|
||||
e.offsetY = e.pageY - off.top
|
||||
|
||||
DOM.dispatchEvent(e.target, 'fast-right-click', e)
|
||||
|
||||
clearLongTouchTimer()
|
||||
|
||||
}, 600)
|
||||
|
||||
}, supportsPassive ? { passive: true } : false)
|
||||
|
||||
|
||||
DOM.addEventListener(document, 'touchend touchmove touchcancel', clearLongTouchTimer)
|
||||
276
src/browser/js/app/events/drag.js
Normal file
|
|
@ -0,0 +1,276 @@
|
|||
const {fix, normalizeDragEvent, resetEventOffset, Touch} = require('./utils')
|
||||
|
||||
var targets = {},
|
||||
previousPointers = {}
|
||||
|
||||
function pointerDownHandler(event) {
|
||||
|
||||
if (!event.multitouch) {
|
||||
for (var i in targets) {
|
||||
if (targets[i] == event.target) return
|
||||
}
|
||||
}
|
||||
|
||||
targets[event.pointerId] = event.target
|
||||
|
||||
normalizeDragEvent(event)
|
||||
|
||||
previousPointers[event.pointerId] = event
|
||||
|
||||
triggerWidgetEvent(targets[event.pointerId], 'draginit', event)
|
||||
|
||||
}
|
||||
|
||||
function pointerMoveHandler(event) {
|
||||
|
||||
normalizeDragEvent(event, previousPointers[event.pointerId])
|
||||
|
||||
event.stopPropagation = true
|
||||
|
||||
if (event.traversing) {
|
||||
|
||||
var previousTarget = targets[event.pointerId],
|
||||
target = event instanceof Touch ?
|
||||
document.elementFromPoint(event.clientX, event.clientY)
|
||||
: event.target
|
||||
|
||||
if (target) target = target.closest('.drag-event')
|
||||
|
||||
if (target && event instanceof Touch) {
|
||||
resetEventOffset(event, target)
|
||||
}
|
||||
|
||||
if (previousTarget !== target) {
|
||||
triggerWidgetEvent(previousTarget, 'dragend', event)
|
||||
}
|
||||
|
||||
|
||||
if (target) {
|
||||
if (event.traversingContainer.contains(target)) {
|
||||
triggerWidgetEvent(target, previousTarget !== target ? 'draginit' : 'drag', event)
|
||||
}
|
||||
}
|
||||
|
||||
targets[event.pointerId] = target
|
||||
|
||||
|
||||
} else {
|
||||
triggerWidgetEvent(targets[event.pointerId], 'drag', event)
|
||||
}
|
||||
|
||||
previousPointers[event.pointerId] = event
|
||||
|
||||
}
|
||||
|
||||
function pointerUpHandler(event) {
|
||||
|
||||
normalizeDragEvent(event, previousPointers[event.pointerId])
|
||||
|
||||
triggerWidgetEvent(targets[event.pointerId], 'dragend', event)
|
||||
|
||||
delete targets[event.pointerId]
|
||||
delete previousPointers[event.pointerId]
|
||||
|
||||
}
|
||||
|
||||
|
||||
// Move / Up Filter
|
||||
|
||||
function pointerMoveFilter(event) {
|
||||
|
||||
if (targets[event.pointerId] !== undefined) {
|
||||
pointerMoveHandler.call(targets[event.pointerId], event)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function pointerUpFilter(event) {
|
||||
|
||||
if (targets[event.pointerId] !== undefined) {
|
||||
pointerUpHandler.call(targets[event.pointerId], event)
|
||||
delete targets[event.pointerId]
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// Mouse events wrappers
|
||||
|
||||
function mouseDownHandler(event) {
|
||||
if ((event.sourceCapabilities && event.sourceCapabilities.firesTouchEvents) || event.button == 2) return
|
||||
event.pointerId = 'mouse'
|
||||
pointerDownHandler(event)
|
||||
}
|
||||
|
||||
function mouseMultiWrapper(event) {
|
||||
event.multitouch = true
|
||||
mouseDownHandler(event)
|
||||
}
|
||||
|
||||
function mouseMoveCapture(event) {
|
||||
event.pointerId = 'mouse'
|
||||
event.inertia = event.ctrlKey ? 10 : 1
|
||||
pointerMoveFilter(event)
|
||||
}
|
||||
|
||||
function mouseUpCapture(event){
|
||||
if ((event.sourceCapabilities && event.sourceCapabilities.firesTouchEvents) || event.button == 2) return
|
||||
event.pointerId = 'mouse'
|
||||
pointerUpFilter(event)
|
||||
}
|
||||
|
||||
|
||||
// Touch events wrappers
|
||||
|
||||
function touchMultiWrapper(event) {
|
||||
event.multitouch = true
|
||||
touchDownHandler(event)
|
||||
}
|
||||
|
||||
function touchDownHandler(event) {
|
||||
event.preventDefault()
|
||||
for (var i in event.changedTouches) {
|
||||
if (isNaN(i) || !event.changedTouches[i]) continue
|
||||
var touchEvent = event.changedTouches[i]
|
||||
|
||||
if (event.traversing) {
|
||||
touchEvent.traversing = event.traversing
|
||||
touchEvent.traversingContainer = event.traversingContainer
|
||||
}
|
||||
|
||||
touchEvent.pointerId = touchEvent.identifier
|
||||
pointerDownHandler(touchEvent)
|
||||
}
|
||||
}
|
||||
|
||||
function touchMoveCapture(event) {
|
||||
for (var i in event.changedTouches) {
|
||||
if (isNaN(i) || !event.changedTouches[i]) continue
|
||||
var touchEvent = event.changedTouches[i]
|
||||
|
||||
var fingers = 0
|
||||
for (var j in event.touches) {
|
||||
if (event.touches[j].target && event.touches[j].target.isSameNode(touchEvent.target)) {
|
||||
fingers += 1
|
||||
if (fingers == 2) {
|
||||
touchEvent.inertia = 10
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
touchEvent.pointerId = touchEvent.identifier
|
||||
pointerMoveFilter(touchEvent)
|
||||
}
|
||||
}
|
||||
|
||||
function touchUpCapture(event) {
|
||||
for (var i in event.changedTouches) {
|
||||
if (isNaN(i) || !event.changedTouches[i]) continue
|
||||
var touchEvent = event.changedTouches[i]
|
||||
touchEvent.pointerId = touchEvent.identifier
|
||||
pointerUpFilter(touchEvent)
|
||||
}
|
||||
}
|
||||
|
||||
// Callback trigger
|
||||
|
||||
function triggerWidgetEvent(target, name, event) {
|
||||
if (target !== null && target._drag_widget) {
|
||||
target._drag_widget.trigger(name, [event])
|
||||
} else if (target !== null) {
|
||||
triggerWidgetEvent(target.closest('.drag-event'), name, event)
|
||||
}
|
||||
}
|
||||
|
||||
// init
|
||||
|
||||
DOM.ready(()=>{
|
||||
|
||||
document.addEventListener('mousemove', mouseMoveCapture, true)
|
||||
document.addEventListener('mouseup', mouseUpCapture, true)
|
||||
document.addEventListener('touchmove', touchMoveCapture, true)
|
||||
DOM.addEventListener(document, 'touchend touchcancel', touchUpCapture, true)
|
||||
|
||||
})
|
||||
|
||||
module.exports = {
|
||||
|
||||
setup: function(options) {
|
||||
|
||||
if (
|
||||
this._customBindings['drag'].bindings !== 0 ||
|
||||
this._customBindings['draginit'].bindings !== 0 ||
|
||||
this._customBindings['dragend'].bindings !== 0 ||
|
||||
!options
|
||||
) {
|
||||
return
|
||||
}
|
||||
|
||||
var {element, multitouch} = options
|
||||
|
||||
element._drag_widget = this
|
||||
element.style.touchAction = 'none'
|
||||
element.classList.add('drag-event')
|
||||
|
||||
if (multitouch) {
|
||||
element.addEventListener('touchstart', touchMultiWrapper, false)
|
||||
element.addEventListener('mousedown', mouseMultiWrapper)
|
||||
} else {
|
||||
element.addEventListener('touchstart', touchDownHandler, false)
|
||||
element.addEventListener('mousedown', mouseDownHandler)
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
teardown: function(options) {
|
||||
|
||||
if (
|
||||
this._customBindings['drag'].bindings !== 0 ||
|
||||
this._customBindings['draginit'].bindings !== 0 ||
|
||||
this._customBindings['dragend'].bindings !== 0 ||
|
||||
!options
|
||||
) {
|
||||
return
|
||||
}
|
||||
|
||||
delete element._drag_widget
|
||||
element.style.touchAction = ''
|
||||
element.classList.remove('drag-event')
|
||||
|
||||
if (multitouch) {
|
||||
element.removeEventListener('touchstart', touchMultiWrapper, false)
|
||||
element.removeEventListener('mousedown', mouseMultiWrapper)
|
||||
} else {
|
||||
element.removeEventListener('touchstart', touchDownHandler, false)
|
||||
element.removeEventListener('mousedown', mouseDownHandler)
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
enableTraversingGestures: function(element) {
|
||||
|
||||
function makeEventTraversing(event) {
|
||||
if (event.ctrlKey) return
|
||||
event.traversing = true
|
||||
if (!event.traversingContainer) event.traversingContainer = element
|
||||
}
|
||||
|
||||
element.addEventListener('mousedown', makeEventTraversing, true)
|
||||
element.addEventListener('touchstart', makeEventTraversing, true)
|
||||
|
||||
element.addEventListener('disableTraversingGestures', ()=>{
|
||||
|
||||
element.removeEventListener('mousedown', makeEventTraversing, true)
|
||||
element.removeEventListener('touchstart', makeEventTraversing, true)
|
||||
|
||||
})
|
||||
|
||||
},
|
||||
|
||||
disableTraversingGestures: function(element) {
|
||||
|
||||
DOM.dispatchEvent(element, 'disableTraversingGestures')
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
95
src/browser/js/app/events/event-emitter.js
Normal file
|
|
@ -0,0 +1,95 @@
|
|||
var WolfyEventEmitter = require('wolfy87-eventemitter'),
|
||||
customEvents = {}
|
||||
|
||||
customEvents['draginit'] = customEvents['drag'] = customEvents['dragend'] = require('./drag')
|
||||
customEvents['resize'] = require('./resize')
|
||||
|
||||
module.exports = class EventEmitter extends WolfyEventEmitter {
|
||||
|
||||
constructor() {
|
||||
|
||||
super()
|
||||
|
||||
this._customBindings = {}
|
||||
|
||||
for (var evt in customEvents) {
|
||||
this._customBindings[evt] = {
|
||||
bindings: 0
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
emitEvent(evt, args) {
|
||||
|
||||
// Event bubbling
|
||||
|
||||
super.emitEvent(evt, args)
|
||||
|
||||
if (args[0] && !args[0].stopPropagation) {
|
||||
if (this.parent) this.parent.emitEvent(evt, args)
|
||||
}
|
||||
|
||||
return this
|
||||
|
||||
}
|
||||
|
||||
addListener(evt, listener, options) {
|
||||
|
||||
// Custom event setup
|
||||
|
||||
var eventName = typeof evt == 'string' ? evt.split('.')[0] : ''
|
||||
|
||||
if (
|
||||
customEvents.hasOwnProperty(eventName) &&
|
||||
typeof customEvents[eventName].setup === 'function'
|
||||
) {
|
||||
if (this._customBindings[eventName].bindings === 0) {
|
||||
this._customBindings[eventName].options = options
|
||||
customEvents[eventName].setup.call(this, options)
|
||||
}
|
||||
this._customBindings[eventName].bindings += 1
|
||||
}
|
||||
|
||||
super.addListener(evt, listener)
|
||||
|
||||
return this
|
||||
|
||||
}
|
||||
|
||||
removeListener(evt, listener) {
|
||||
|
||||
// Custom event teardown
|
||||
|
||||
var eventName = typeof evt == 'string' ? evt.split('.')[0] : ''
|
||||
|
||||
if (
|
||||
customEvents.hasOwnProperty(eventName) &&
|
||||
typeof customEvents[eventName].teardown === 'function' &&
|
||||
this._customBindings[eventName].bindings !== 0
|
||||
) {
|
||||
this._customBindings[eventName].bindings -= 1
|
||||
if (this._customBindings[eventName].bindings === 0 || !listener) {
|
||||
var options = this._customBindings[eventName].options
|
||||
customEvents[eventName].teardown.call(this, options)
|
||||
}
|
||||
}
|
||||
|
||||
// Remove all listeners is none specified
|
||||
|
||||
if (listener) {
|
||||
|
||||
super.removeListener(evt, listener)
|
||||
|
||||
} else {
|
||||
|
||||
this.removeEvent(evt)
|
||||
|
||||
}
|
||||
|
||||
return this
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
64
src/browser/js/app/events/resize.js
Normal file
|
|
@ -0,0 +1,64 @@
|
|||
var elements = []
|
||||
|
||||
function checkResizes(context){
|
||||
// Iterate over all elements to which the 'resize' event is bound.
|
||||
var resizedElems = [],
|
||||
cachedStyles = []
|
||||
for (var i = elements.length - 1; i >= 0; i--) {
|
||||
var elem = elements[i]
|
||||
|
||||
if (!context.contains(elem)) continue
|
||||
|
||||
var style = window.getComputedStyle(elem),
|
||||
width = parseInt(style['width']) - parseInt(style['padding-left']) - parseInt(style['padding-right']),
|
||||
height = parseInt(style['height']) - parseInt(style['padding-top']) - parseInt(style['padding-bottom'])
|
||||
|
||||
if (!width || !height) continue
|
||||
|
||||
// If element size has changed since the last time, update the element
|
||||
// data store and trigger the 'resize' event.
|
||||
if (width != elem.resizedataw || height != elem.resizedatah) {
|
||||
elem.resizedataw = width
|
||||
elem.resizedatah = height
|
||||
resizedElems.push(elem)
|
||||
cachedStyles.push(style)
|
||||
}
|
||||
}
|
||||
for (var i = resizedElems.length - 1; i >= 0; i--) {
|
||||
resizedElems[i]._resize_widget.trigger('resize', [{
|
||||
width: resizedElems[i].resizedataw,
|
||||
height: resizedElems[i].resizedatah,
|
||||
style:cachedStyles[i],
|
||||
stopPropagation: true
|
||||
}])
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
window.addEventListener('resize', ()=>{checkResizes(document)})
|
||||
|
||||
module.exports = {
|
||||
|
||||
setup: function(options) {
|
||||
|
||||
if (!options) return
|
||||
if (elements.indexOf(options.element) == -1) {
|
||||
elements.push(options.element)
|
||||
options.element._resize_widget = this
|
||||
}
|
||||
|
||||
},
|
||||
teardown: function(options) {
|
||||
|
||||
if (!options) return
|
||||
|
||||
if (elements.indexOf(options.element) != -1) {
|
||||
elements.splice(elements.indexOf(options.element), 1)
|
||||
delete options.element._resize_widget
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
check: checkResizes
|
||||
|
||||
}
|
||||
15
src/browser/js/app/events/supports-passive.js
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
// https://github.com/WICG/EventListenerOptions/blob/gh-pages/explainer.md#feature-detection
|
||||
|
||||
var supportsPassive = false;
|
||||
|
||||
try {
|
||||
var opts = Object.defineProperty({}, 'passive', {
|
||||
get: function() {
|
||||
supportsPassive = true;
|
||||
}
|
||||
});
|
||||
window.addEventListener("testPassive", null, opts);
|
||||
window.removeEventListener("testPassive", null, opts);
|
||||
} catch (e) {}
|
||||
|
||||
module.exports = supportsPassive
|
||||
95
src/browser/js/app/events/utils.js
Normal file
|
|
@ -0,0 +1,95 @@
|
|||
const Touch = window.Touch || class Touch {}
|
||||
|
||||
module.exports = {
|
||||
|
||||
fix: function(e) {
|
||||
|
||||
return {
|
||||
|
||||
target: e.target,
|
||||
offsetX: e.offsetX,
|
||||
offsetY: e.offsetY,
|
||||
pageX: e.pageX,
|
||||
pageY: e.pageY,
|
||||
movementX: e.movementX,
|
||||
movementY: e.movementY,
|
||||
pointerId: e.pointerId,
|
||||
pointerType: e.pointerType,
|
||||
button: e.button,
|
||||
ctrlKey: e.ctrlKey,
|
||||
shiftKey: e.shiftKey
|
||||
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
normalizeDragEvent: function(event, previousEvent) {
|
||||
|
||||
if (event.movementX === undefined) {
|
||||
|
||||
event.movementX = previousEvent ? event.pageX - previousEvent.pageX : 0
|
||||
event.movementY = previousEvent ? event.pageY - previousEvent.pageY : 0
|
||||
|
||||
}
|
||||
|
||||
if (event instanceof Touch && !previousEvent) {
|
||||
|
||||
module.exports.resetEventOffset(event, event.target)
|
||||
|
||||
} else if (event instanceof Touch && previousEvent) {
|
||||
|
||||
event.offsetX = previousEvent.offsetX + event.movementX
|
||||
event.offsetY = previousEvent.offsetY + event.movementY
|
||||
|
||||
}
|
||||
|
||||
if (event.inertia === undefined) {
|
||||
|
||||
event.inertia = 1
|
||||
|
||||
}
|
||||
|
||||
if (previousEvent && previousEvent.traversing) {
|
||||
|
||||
event.traversing = previousEvent.traversing
|
||||
event.traversingContainer = previousEvent.traversingContainer
|
||||
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
resetEventOffset: function(event, target) {
|
||||
|
||||
var off = module.exports.getElementOffset(target)
|
||||
|
||||
event.offsetX = event.pageX - off.left
|
||||
event.offsetY = event.pageY - off.top
|
||||
|
||||
},
|
||||
|
||||
getElementOffset: function(element) {
|
||||
|
||||
var offsetLeft = 0,
|
||||
offsetTop = 0
|
||||
|
||||
if (element) {
|
||||
do {
|
||||
if (!isNaN(element.offsetLeft)) {
|
||||
offsetLeft += element.offsetLeft - element.scrollLeft
|
||||
}
|
||||
if (!isNaN(element.offsetTop)) {
|
||||
offsetTop += element.offsetTop - element.scrollTop
|
||||
}
|
||||
} while (element = element.offsetParent)
|
||||
}
|
||||
|
||||
return {
|
||||
left: offsetLeft,
|
||||
top: offsetTop
|
||||
}
|
||||
},
|
||||
|
||||
Touch: Touch
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -4,6 +4,7 @@ location.search.replace(/[?&]+([^=&]+)=([^&]*)/gi, (s,k,v)=>{
|
|||
})
|
||||
|
||||
window.PACKAGE = require('../../../../app/package.json')
|
||||
document.title = PACKAGE.productName + ' v' + PACKAGE.version
|
||||
|
||||
window.LOADING = null
|
||||
|
||||
|
|
@ -15,6 +16,7 @@ window.EDITING = false
|
|||
window.GRIDWIDTH = 10
|
||||
|
||||
|
||||
window.CANVAS_FRAMERATE = parseFloat(ARGV.framerate || 60)
|
||||
window.CANVAS_SCALING = parseFloat(ARGV.forceHdpi) || ( ARGV.hdpi ? window.devicePixelRatio : 1 )
|
||||
window.INITIALZOOM = ARGV.zoom ? ARGV.zoom : 1
|
||||
window.PXSCALE = INITIALZOOM
|
||||
|
|
@ -25,10 +27,10 @@ window.DOUBLE_TAP_TIME = ARGV.doubletap ? ARGV.doubletap : 375
|
|||
|
||||
window.JSON.parseFlex = require('json5').parse
|
||||
|
||||
window.DOM = require('./dom')
|
||||
|
||||
window.$ = require('jquery/dist/jquery.slim.min.js')
|
||||
|
||||
require('../libs/jquery.ui')
|
||||
require('../libs/jquery.drag')
|
||||
require('../libs/jquery.resize')
|
||||
|
||||
require('cardinal-spline-js/curve.js')
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
var utils = require('../utils'),
|
||||
icon = utils.icon,
|
||||
var utils = require('../ui/utils'),
|
||||
osc = require('../osc'),
|
||||
session = require('../managers/session'),
|
||||
widgetManager = require('../managers/widgets'),
|
||||
state = require('../managers/state'),
|
||||
editor = require('../editor/')
|
||||
|
||||
|
|
@ -35,7 +35,7 @@ var callbacks = module.exports = {
|
|||
|
||||
sessionNew: function(){
|
||||
|
||||
session.new()
|
||||
session.create()
|
||||
|
||||
},
|
||||
|
||||
|
|
@ -60,16 +60,18 @@ var callbacks = module.exports = {
|
|||
},
|
||||
|
||||
error: function(data){
|
||||
utils.createPopup(icon('warning') + ' Error', data, true)
|
||||
new utils.Popup({title: utils.icon('exclamation-triangle') + ' Error', content: data, closable:true})
|
||||
},
|
||||
|
||||
reloadCss: function(){
|
||||
var queryString = '?reload=' + new Date().getTime()
|
||||
$('link[rel="stylesheet"][hot-reload]').each(function () {
|
||||
this.href = this.href.replace(/\?.*|$/, queryString)
|
||||
DOM.each(document, 'link[rel="stylesheet"][hot-reload]', (el)=>{
|
||||
el.href = el.href.replace(/\?.*|$/, queryString)
|
||||
})
|
||||
|
||||
setTimeout(()=>{
|
||||
$('canvas').trigger('resize',[0,0,true])
|
||||
var root = widgetManager.getWidgetById('root')[0]
|
||||
if (root) root.reCreateWidget()
|
||||
},100)
|
||||
|
||||
GRIDWIDTH = getComputedStyle(document.documentElement).getPropertyValue("--grid-width")
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ var Ipc = class Ipc {
|
|||
|
||||
constructor() {
|
||||
|
||||
this.socket = io.connect('/')
|
||||
this.socket = io.connect('/', {transports: ['websocket'], upgrade: false})
|
||||
this.socket.compress(false)
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,7 +2,8 @@ var ipc = require('../ipc/'),
|
|||
parser = require('../parser'),
|
||||
state = require('./state'),
|
||||
editor = require('../editor/'),
|
||||
{loading, createPopup, icon} = require('../utils'),
|
||||
lobby = require('../ui/lobby'),
|
||||
{loading, icon, Popup} = require('../ui/utils'),
|
||||
{saveAs} = require('file-saver')
|
||||
|
||||
|
||||
|
|
@ -16,11 +17,16 @@ var SessionManager = class SessionManager {
|
|||
|
||||
load(session, callback) {
|
||||
|
||||
$('#lobby').hide()
|
||||
$('#container').empty()
|
||||
var p = loading('Loading session file...')
|
||||
var container = DOM.get('#container')[0]
|
||||
|
||||
setTimeout(function(){
|
||||
container.classList.remove('show')
|
||||
container.innerHTML = ''
|
||||
|
||||
lobby.close()
|
||||
|
||||
var loader = loading('Loading session file...')
|
||||
|
||||
setTimeout(()=>{
|
||||
try {
|
||||
parser.reset()
|
||||
|
||||
|
|
@ -29,30 +35,28 @@ var SessionManager = class SessionManager {
|
|||
} else if (session[0].type == 'root'){
|
||||
this.session = session
|
||||
} else {
|
||||
throw 'Malformed session file'
|
||||
throw new Error('Malformed session file')
|
||||
}
|
||||
|
||||
parser.parse(this.session,$('#container'))
|
||||
parser.parse(this.session, DOM.get('#container')[0])
|
||||
} catch (err) {
|
||||
p.close()
|
||||
$('#lobby').show()
|
||||
createPopup(icon('warning')+' Parsing error', err,true)
|
||||
loader.close()
|
||||
lobby.open()
|
||||
new Popup({title:icon('exclamation-triangle')+' Parsing error', content: err, closable:true})
|
||||
throw err
|
||||
}
|
||||
|
||||
state.set(state.get(), false)
|
||||
$('#lobby').remove()
|
||||
editor.disable()
|
||||
$(window).resize()
|
||||
DOM.dispatchEvent(window, 'resize')
|
||||
|
||||
setTimeout(function(){
|
||||
p.close()
|
||||
if (!callback) return
|
||||
setTimeout(function(){
|
||||
callback()
|
||||
},25)
|
||||
},25)
|
||||
},25)
|
||||
setTimeout(()=>{
|
||||
loader.close()
|
||||
container.classList.add('show')
|
||||
if (callback) callback()
|
||||
}, 25)
|
||||
|
||||
}, 25)
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -69,83 +73,60 @@ var SessionManager = class SessionManager {
|
|||
|
||||
list(data) {
|
||||
|
||||
var lobby = $(`
|
||||
<div class="main">
|
||||
<div class="header">
|
||||
${PACKAGE.productName}
|
||||
</div>
|
||||
<div class="list"></div>
|
||||
<div class="footer"></div>
|
||||
</div>`),
|
||||
list = lobby.find('.list'),
|
||||
footer = lobby.find('.footer'),
|
||||
self = this
|
||||
|
||||
for (let i in data) {
|
||||
|
||||
var max = 50
|
||||
var path = data[i],
|
||||
file = path.split('\\').pop().split('/').pop(),
|
||||
length = data[i].length
|
||||
|
||||
path = path.replace(file,'')
|
||||
|
||||
if (length > max - 3) {
|
||||
path = path.substr(0,Math.floor((path.length)/2)-(length-max)/2) + '...' + path.substr(Math.ceil((path.length)/2)+(length-max)/2, path.length)
|
||||
}
|
||||
|
||||
if (!READ_ONLY) {
|
||||
}
|
||||
list.append(`
|
||||
lobby.list.appendChild(DOM.create(`
|
||||
<a href="#" tabIndex="0" class="btn load" data-session="${data[i]}">
|
||||
${file} <em style="opacity:0.45">(${path})</em>
|
||||
${READ_ONLY? '' : '<span>'+icon('remove')+'</span>'}
|
||||
${READ_ONLY? '' : '<span>'+icon('times')+'</span>'}
|
||||
</a>
|
||||
`)
|
||||
`))
|
||||
|
||||
}
|
||||
|
||||
lobby.find('.load').click(function(e){
|
||||
lobby.list.addEventListener('click', function(e){
|
||||
e.preventDefault()
|
||||
e.stopPropagation()
|
||||
ipc.send('sessionOpen',{path:$(this).data('session')})
|
||||
}).on('mousedown touchstart', function(e){
|
||||
if (e.type == 'mousedown') e.preventDefault()
|
||||
$(this).blur()
|
||||
if (e.target.hasAttribute('data-session')) {
|
||||
ipc.send('sessionOpen',{path:e.target.getAttribute('data-session')})
|
||||
} else if (!READ_ONLY && e.target.tagName == 'SPAN') {
|
||||
ipc.send('sessionRemoveFromHistory',e.target.parentNode.getAttribute('data-session'))
|
||||
lobby.list.removeChild(e.target.parentNode)
|
||||
}
|
||||
})
|
||||
|
||||
if (!READ_ONLY) {
|
||||
|
||||
lobby.find('a span').click(function(e){
|
||||
e.stopPropagation()
|
||||
ipc.send('sessionRemoveFromHistory',$(this).parent().data('session'))
|
||||
$(this).parents('a').remove()
|
||||
var brw = lobby.footer.appendChild(DOM.create('<a href="#" tabindex="0" class="btn browse">'+icon('folder-open')+' Browse</a>'))
|
||||
var nws = lobby.footer.appendChild(DOM.create('<a href="#" tabindex="0" class="btn new">'+icon('file')+' New</a>'))
|
||||
|
||||
brw.addEventListener('click', (e)=>{
|
||||
this.browse()
|
||||
})
|
||||
|
||||
footer.append('<a href="#" tabindex="0" class="btn browse">'+icon('folder-open')+' Browse</a>')
|
||||
footer.append('<a href="#" tabindex="0" class="btn new">'+icon('file-o')+' New</a>')
|
||||
nws.addEventListener('click', (e)=>{
|
||||
this.create()
|
||||
})
|
||||
|
||||
lobby.find('.browse').click((e)=>{
|
||||
e.stopPropagation()
|
||||
self.browse()
|
||||
}).on('mousedown touchstart', function(e){
|
||||
if (e.type == 'mousedown') e.preventDefault()
|
||||
$(this).blur()
|
||||
})
|
||||
lobby.find('.new').click(function(e){
|
||||
e.stopPropagation()
|
||||
self.create()
|
||||
}).on('mousedown touchstart', function(e){
|
||||
if (e.type == 'mousedown') e.preventDefault()
|
||||
$(this).blur()
|
||||
})
|
||||
}
|
||||
|
||||
$('#lobby').append(lobby)
|
||||
|
||||
setTimeout(()=>{
|
||||
lobby.addClass('loaded')
|
||||
DOM.addEventListener(lobby.html, 'mousedown touchstart', function(e){
|
||||
if (e.type == 'mousedown') e.preventDefault()
|
||||
e.target.blur()
|
||||
})
|
||||
|
||||
lobby.open()
|
||||
|
||||
}
|
||||
|
||||
open(data) {
|
||||
|
|
@ -158,9 +139,10 @@ var SessionManager = class SessionManager {
|
|||
|
||||
browse() {
|
||||
|
||||
var prompt = $('<input type="file" accept=".js, .json"/>')
|
||||
var prompt = DOM.create('<input type="file" accept=".js, .json"/>')
|
||||
|
||||
prompt.click()
|
||||
prompt.on('change',function(e){
|
||||
prompt.addEventListener('change',function(e){
|
||||
var reader = new FileReader(),
|
||||
file = e.target.files[0]
|
||||
|
||||
|
|
@ -177,9 +159,8 @@ var SessionManager = class SessionManager {
|
|||
|
||||
create() {
|
||||
this.load([{}],function(){
|
||||
$('.enable-editor').click()
|
||||
$('#open-toggle').trigger('fake-click')
|
||||
$('.editor-root').trigger('fake-click')
|
||||
require('../ui/sidepanel').open()
|
||||
editor.enable()
|
||||
})
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -8,6 +8,11 @@ var StateManager = class StateManager {
|
|||
|
||||
this.state = []
|
||||
|
||||
this.valueStateQueue = {}
|
||||
this.valueOldPropQueue = {}
|
||||
this.valueNewPropQueue = {}
|
||||
this.queueCounter = 0
|
||||
|
||||
}
|
||||
|
||||
get() {
|
||||
|
|
@ -69,15 +74,14 @@ var StateManager = class StateManager {
|
|||
|
||||
load() {
|
||||
|
||||
var prompt = $('<input type="file" accept=".state"/>')
|
||||
var prompt = DOM.create('<input type="file" accept=".state"/>')
|
||||
|
||||
prompt.click()
|
||||
|
||||
prompt.on('change',function(e){
|
||||
prompt.addEventListener('change',function(e){
|
||||
|
||||
var reader = new FileReader()
|
||||
|
||||
reader.onloadend = function(e) {
|
||||
reader.onloadend = (e)=>{
|
||||
|
||||
var preset = e.target.result
|
||||
this.set(JSON.parse(preset),true)
|
||||
|
|
@ -119,6 +123,49 @@ var StateManager = class StateManager {
|
|||
|
||||
}
|
||||
|
||||
pushValueState(id, value) {
|
||||
this.valueStateQueue[id] = value
|
||||
}
|
||||
|
||||
pushValueOldProp(id, value) {
|
||||
this.valueOldPropQueue[id] = typeof value == 'object' ? JSON.stringify(value) : value
|
||||
}
|
||||
|
||||
pushValueNewProp(id, value) {
|
||||
this.valueNewPropQueue[id] = typeof value == 'object' ? JSON.stringify(value) : value
|
||||
if (this.queueCounter == 0) this.flush()
|
||||
}
|
||||
|
||||
flush(){
|
||||
for (let id in this.valueStateQueue) {
|
||||
if (this.valueStateQueue[id] !== undefined) {
|
||||
for (let w of widgetManager.getWidgetById(id)) {
|
||||
w.setValue(this.valueStateQueue[id])
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (let id in this.valueNewPropQueue) {
|
||||
if (this.valueNewPropQueue[id] != this.valueOldPropQueue[id]) {
|
||||
for (let w of widgetManager.getWidgetById(id)) {
|
||||
w.setValue(w.getProp('value'), {sync: true})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this.valueStateQueue = {}
|
||||
this.valueOldPropQueue = {}
|
||||
this.valueNewPropQueue = {}
|
||||
}
|
||||
|
||||
incrementQueue() {
|
||||
this.queueCounter++
|
||||
}
|
||||
|
||||
decrementQueue() {
|
||||
this.queueCounter--
|
||||
if (this.queueCounter == 0) this.flush()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,9 +1,12 @@
|
|||
var ipc = require('../ipc/')
|
||||
var EventEmitter = require('../events/event-emitter'),
|
||||
ipc = require('../ipc/')
|
||||
|
||||
var WidgetManager = class WidgetManager {
|
||||
var WidgetManager = class WidgetManager extends EventEmitter {
|
||||
|
||||
constructor() {
|
||||
|
||||
super()
|
||||
|
||||
this.widgets = {}
|
||||
|
||||
this.addressRoute = {}
|
||||
|
|
@ -14,48 +17,19 @@ var WidgetManager = class WidgetManager {
|
|||
|
||||
this.preArgsSeparator = '||||'
|
||||
|
||||
$(document).ready(()=>{
|
||||
|
||||
$('body').off('change.global').on('change.global',(e)=>{
|
||||
|
||||
var {id, widget, linkId, fromExternal, options} = e,
|
||||
widgetsById = this.getWidgetById(id),
|
||||
widgetsByLinkId = this.getWidgetByLinkId(linkId)
|
||||
|
||||
// Widget that share the same id will update each other
|
||||
// without sending any extra osc message
|
||||
if (widgetsById.length>1) {
|
||||
var v = widget.getValue()
|
||||
for (let i in widgetsById) {
|
||||
if (widgetsById[i].hash != widget.hash && widgetsById[i].setValue) {
|
||||
widgetsById[i].setValue(v,{send:false,sync:false})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// widgets that share the same linkId will update each other.
|
||||
// Updated widgets will send osc messages normally
|
||||
if (widgetsByLinkId.length>1) {
|
||||
var v = widget.getValue()
|
||||
for (let i in widgetsByLinkId) {
|
||||
if (widgetsByLinkId[i].hash != widget.hash && widgetsByLinkId[i].setValue) {
|
||||
widgetsByLinkId[i].setValue(v,{send:options.send,sync:false})
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
})
|
||||
this.on('change', this.onChange, this)
|
||||
|
||||
ipc.on('reconnect', ()=>{
|
||||
for (var hash in this.widgets) {
|
||||
ipc.send('addWidget', {
|
||||
hash:hash,
|
||||
data:{
|
||||
precision: this.widgets[hash].precision,
|
||||
precision: this.widgets[hash].getProp('precision'),
|
||||
preArgs: this.widgets[hash].getProp('preArgs'),
|
||||
split: this.widgets[hash].split,
|
||||
target: this.widgets[hash].getProp('target'),
|
||||
address: this.widgets[hash].getProp('address'),
|
||||
noSync: this.widgets[hash].getProp('noSync'),
|
||||
}
|
||||
})
|
||||
}
|
||||
|
|
@ -63,6 +37,36 @@ var WidgetManager = class WidgetManager {
|
|||
|
||||
}
|
||||
|
||||
onChange(e) {
|
||||
|
||||
var {id, widget, linkId, options} = e,
|
||||
widgetsById = this.getWidgetById(id),
|
||||
widgetsByLinkId = linkId ? this.getWidgetByLinkId(linkId) : []
|
||||
|
||||
// Widget that share the same id will update each other
|
||||
// without sending any extra osc message
|
||||
if (widgetsById.length>1) {
|
||||
var v = widget.getValue()
|
||||
for (let i in widgetsById) {
|
||||
if (widgetsById[i].hash != widget.hash && widgetsById[i].setValue) {
|
||||
widgetsById[i].setValue(v,{send:false,sync:false})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// widgets that share the same linkId will update each other.
|
||||
// Updated widgets will send osc messages normally
|
||||
if (widgetsByLinkId.length>1) {
|
||||
var v = widget.getValue()
|
||||
for (let i in widgetsByLinkId) {
|
||||
if (widgetsByLinkId[i].hash != widget.hash && widgetsByLinkId[i].setValue) {
|
||||
widgetsByLinkId[i].setValue(v,{send:options.send,sync:false})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
createAddressRef(widget, preArgs, address) {
|
||||
var preArgs = preArgs || widget.getProp('preArgs'),
|
||||
address = address || widget.getProp('address')
|
||||
|
|
@ -101,17 +105,15 @@ var WidgetManager = class WidgetManager {
|
|||
this.scrollingWidgets.push(hash)
|
||||
}
|
||||
|
||||
widget.widget.abstract = widget
|
||||
if (widget.container) widget.container[0].abstract = widget
|
||||
|
||||
ipc.send('addWidget', {
|
||||
hash:hash,
|
||||
data:{
|
||||
precision: widget.precision,
|
||||
precision: widget.getProp('precision'),
|
||||
preArgs: widget.getProp('preArgs'),
|
||||
split: widget.split,
|
||||
target: widget.getProp('target'),
|
||||
address: widget.getProp('address'),
|
||||
noSync: widget.getProp('noSync'),
|
||||
}
|
||||
})
|
||||
|
||||
|
|
@ -139,6 +141,22 @@ var WidgetManager = class WidgetManager {
|
|||
if (scroll && this.scrollingWidgets.indexOf(hash) != -1) this.scrollingWidgets.splice(this.scrollingWidgets.indexOf(hash), 1)
|
||||
}
|
||||
|
||||
removeWidgets(hashes) {
|
||||
|
||||
for (let i in hashes) {
|
||||
|
||||
if (
|
||||
this.widgets[hashes[i]]
|
||||
) {
|
||||
this.removeWidget(hashes[i])
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
this.purge()
|
||||
|
||||
}
|
||||
|
||||
purge() {
|
||||
|
||||
for (let route of [this.addressRoute, this.idRoute, this.linkIdRoute]) {
|
||||
|
|
@ -162,11 +180,11 @@ var WidgetManager = class WidgetManager {
|
|||
|
||||
reset() {
|
||||
|
||||
this.widgets = {}
|
||||
this.removeWidgets(Object.keys(this.widgets))
|
||||
|
||||
this.addressRoute = {}
|
||||
this.idRoute = {}
|
||||
this.linkIdRoute = {}
|
||||
this.removeEvent()
|
||||
|
||||
this.on('change', this.onChange, this)
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -208,6 +226,50 @@ var WidgetManager = class WidgetManager {
|
|||
|
||||
}
|
||||
|
||||
getWidgetByAddressAndArgs(address, args) {
|
||||
|
||||
var addressref = address,
|
||||
restArgs = args
|
||||
|
||||
if (typeof args == 'object' && args != null) {
|
||||
for (var i = args.length; i >= 0; i--) {
|
||||
|
||||
var ref = this.createAddressRef(null, args.slice(0,i), address)
|
||||
|
||||
if (this.getWidgetByAddress(ref).length) {
|
||||
addressref = ref
|
||||
restArgs = args.slice(i, args.length)
|
||||
break
|
||||
}
|
||||
|
||||
}
|
||||
} else {
|
||||
restArgs = args
|
||||
}
|
||||
|
||||
|
||||
if (restArgs == null || restArgs.length == 0) restArgs = null
|
||||
else if (restArgs.length == 1) restArgs = restArgs[0]
|
||||
|
||||
|
||||
var widgets = this.getWidgetByAddress(addressref)
|
||||
|
||||
return [
|
||||
widgets,
|
||||
restArgs
|
||||
]
|
||||
|
||||
}
|
||||
|
||||
getWidgetByElement(e, filter = '') {
|
||||
var element = (e instanceof $ ? e[0] : e).closest('[data-widget]' + filter)
|
||||
if (element) {
|
||||
return element._widget_instance ?
|
||||
element._widget_instance :
|
||||
this.widgets[element.getAttribute('data-widget')]
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
var widgetManager = new WidgetManager()
|
||||
|
|
|
|||
|
|
@ -10,10 +10,6 @@ var Osc = class Osc {
|
|||
|
||||
}
|
||||
|
||||
init(data) {
|
||||
this.remoteControl = require('./remote-control')
|
||||
}
|
||||
|
||||
send(data) {
|
||||
|
||||
if (this.syncOnly) {
|
||||
|
|
@ -38,43 +34,16 @@ var Osc = class Osc {
|
|||
|
||||
if (this.remoteControl.exists(data.address)) this.remoteControl.exec(data.address, data.args)
|
||||
|
||||
// fetch ids corresponding to the osc address
|
||||
var address = data.address,
|
||||
addressref = address,
|
||||
args = data.args,
|
||||
target = data.target
|
||||
var [widgets, restArgs] = widgetManager.getWidgetByAddressAndArgs(data.address, data.args)
|
||||
|
||||
if (typeof data.args == 'object' && data.args != null) {
|
||||
for (var i=data.args.length-1;i>=0;i--) {
|
||||
|
||||
var ref = widgetManager.createAddressRef(null, data.args.slice(0,i), address)
|
||||
|
||||
if (widgetManager.getWidgetByAddress(ref).length) {
|
||||
addressref = ref
|
||||
args = data.args.slice(i,data.args.length)
|
||||
break
|
||||
}
|
||||
|
||||
}
|
||||
} else {
|
||||
args = data.args
|
||||
}
|
||||
|
||||
|
||||
if (args == null || args.length==0) args = null
|
||||
else if (args.length==1) args = args[0]
|
||||
|
||||
|
||||
let widget = widgetManager.getWidgetByAddress(addressref)
|
||||
|
||||
for (let i in widget) {
|
||||
let widgetTarget = widget[i].getProp('target')
|
||||
for (let i in widgets) {
|
||||
let widgetTarget = widgets[i].getProp('target')
|
||||
// if the message target is provided (when message comes from another client connected to the same server)
|
||||
// then we only update the widgets that have the same target
|
||||
// compare arrays using > and < operators (both false = equality)
|
||||
if (!target || !widgetTarget || !(widgetTarget < target || widgetTarget > target || widgetTarget.length !== target.length)) {
|
||||
if (!data.target || !widgetTarget || !(widgetTarget < data.target || widgetTarget > data.target || widgetTarget.length !== data.target.length)) {
|
||||
// update matching widgets
|
||||
if (widget[i] && widget[i].setValue) widget[i].setValue(args,{send:false,sync:true,fromExternal:!target})
|
||||
if (widgets[i] && widgets[i].setValue) widgets[i].setValue(restArgs,{send:false,sync:true,fromExternal:!data.target})
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -86,3 +55,5 @@ var Osc = class Osc {
|
|||
var osc = new Osc()
|
||||
|
||||
module.exports = osc
|
||||
|
||||
osc.remoteControl = require('./remote-control')
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
var widgetManager = require('./managers/widgets'),
|
||||
{iconify} = require('./utils')
|
||||
stateManager = require('./managers/state'),
|
||||
{iconify} = require('./ui/utils')
|
||||
|
||||
var Parser = class Parser {
|
||||
|
||||
|
|
@ -10,10 +11,6 @@ var Parser = class Parser {
|
|||
|
||||
}
|
||||
|
||||
init() {
|
||||
this.widgets = require('./widgets/').widgets
|
||||
}
|
||||
|
||||
getIterator(id) {
|
||||
|
||||
this.iterators[id] = (this.iterators[id] || 0) + 1
|
||||
|
|
@ -67,20 +64,22 @@ var Parser = class Parser {
|
|||
}
|
||||
|
||||
// create container
|
||||
var widgetContainer = $(`
|
||||
var widgetContainer = DOM.create(`
|
||||
<div class="widget ${props.type}-container">
|
||||
<div class="label"></div>
|
||||
<div class="label"></div>
|
||||
</div>
|
||||
`)
|
||||
`)
|
||||
|
||||
// create widget
|
||||
var widgetInner = new this.widgets[props.type]({props:props, container:widgetContainer, parent:parentWidget, parentNode:parentNode})
|
||||
|
||||
widgetContainer[0].appendChild(widgetInner.widget[0])
|
||||
widgetContainer.appendChild(widgetInner.widget)
|
||||
|
||||
widgetManager.addWidget(widgetInner)
|
||||
|
||||
widgetContainer[0].setAttribute('data-widget', widgetInner.hash)
|
||||
widgetContainer.setAttribute('data-widget', widgetInner.hash)
|
||||
|
||||
widgetInner.created()
|
||||
|
||||
// dimensions / coordinates can't be < 0
|
||||
for (let t of ['width', 'height', 'top', 'left']) {
|
||||
|
|
@ -89,17 +88,13 @@ var Parser = class Parser {
|
|||
}
|
||||
|
||||
// convert dimensions / coordinates to rem
|
||||
var width = parseFloat(widgetInner.getProp('width'))==widgetInner.getProp('width')?parseFloat(widgetInner.getProp('width'))+'rem' : widgetInner.getProp('width'),
|
||||
height = parseFloat(widgetInner.getProp('height'))==widgetInner.getProp('height')?parseFloat(widgetInner.getProp('height'))+'rem' : widgetInner.getProp('height'),
|
||||
left = parseFloat(widgetInner.getProp('left'))==widgetInner.getProp('left')?parseFloat(widgetInner.getProp('left'))+'rem' : widgetInner.getProp('left'),
|
||||
top = parseFloat(widgetInner.getProp('top'))==widgetInner.getProp('top')?parseFloat(widgetInner.getProp('top'))+'rem' : widgetInner.getProp('top')
|
||||
|
||||
var geometry = {}
|
||||
for (var d of ['width', 'height', 'left', 'top']){
|
||||
if (props[d]!==undefined)
|
||||
geometry[d] = `${props[d]}`.indexOf('-') != -1 ? 0 :
|
||||
parseFloat(props[d]) == props[d] ?
|
||||
parseFloat(props[d])+'rem' : props[d]
|
||||
let val = widgetInner.getProp(d)
|
||||
if (val !== undefined)
|
||||
geometry[d] = `${val}`.indexOf('-') != -1 ? 0 :
|
||||
parseFloat(val) == val ?
|
||||
parseFloat(val)+'rem' : val
|
||||
}
|
||||
|
||||
// dimensions / coordinates css
|
||||
|
|
@ -108,24 +103,25 @@ var Parser = class Parser {
|
|||
styleL = widgetInner.getProp('left') && widgetInner.getProp('left') != 'auto'|| widgetInner.getProp('left') == 0 ?`left: ${geometry.left};` : '',
|
||||
styleT = widgetInner.getProp('top') && widgetInner.getProp('top') != 'auto'|| widgetInner.getProp('top') == 0 ? `top: ${geometry.top};` : ''
|
||||
|
||||
if (styleL.length || styleT.length) widgetContainer.addClass('absolute-position')
|
||||
if (styleL.length || styleT.length) widgetContainer.classList.add('absolute-position')
|
||||
|
||||
// Hide label if false
|
||||
if (widgetInner.getProp('label')===false) {
|
||||
widgetContainer.addClass('nolabel')
|
||||
widgetContainer.classList.add('nolabel')
|
||||
} else {
|
||||
// Generate label, iconify if starting with "icon:"
|
||||
var label = widgetInner.getProp('label') == 'auto'?
|
||||
widgetInner.getProp('id'):
|
||||
iconify(widgetInner.getProp('label'))
|
||||
|
||||
widgetContainer.find('> .label').html(label)
|
||||
DOM.get(widgetContainer, '> .label')[0].innerHTML = label
|
||||
}
|
||||
|
||||
// parse scoped css
|
||||
// parse css
|
||||
var css = ';' + widgetInner.getProp('css'),
|
||||
scopedCss = ''
|
||||
|
||||
// parse scoped css
|
||||
css = css.replace(/[;\}\s]*([^;\{]*\{[^\}]*\})/g, (m)=>{
|
||||
m = m.replace(/^[;\}\s]*/,'')
|
||||
if (m[0]=='&') {
|
||||
|
|
@ -137,29 +133,29 @@ var Parser = class Parser {
|
|||
})
|
||||
|
||||
// apply styles
|
||||
widgetContainer[0].setAttribute('style', styleW + styleH + styleL + styleT + css)
|
||||
widgetContainer.setAttribute('style', styleW + styleH + styleL + styleT + css)
|
||||
|
||||
// apply scoped css
|
||||
if (scopedCss.length) {
|
||||
widgetContainer.attr('id', 'widget-' + widgetInner.hash)
|
||||
widgetContainer.setAttribute('id', 'widget-' + widgetInner.hash)
|
||||
scopedCss = scopedCss.split('&').join('#widget-' + widgetInner.hash)
|
||||
widgetContainer.prepend(`<style>${scopedCss}</style>`)
|
||||
widgetContainer.insertBefore(DOM.create(`<style>${scopedCss}</style>`), widgetInner.widget)
|
||||
}
|
||||
|
||||
// Set custom css color variable
|
||||
if (widgetInner.getProp('color') && widgetInner.getProp('color')!='auto') widgetContainer[0].style.setProperty('--color-custom',widgetInner.getProp('color'))
|
||||
if (widgetInner.getProp('color') && widgetInner.getProp('color')!='auto') widgetContainer.style.setProperty('--color-custom',widgetInner.getProp('color'))
|
||||
|
||||
// set widget's initial state
|
||||
if (widgetInner.getProp('value') !== '' && widgetInner.setValue) {
|
||||
widgetInner.setValue(widgetInner.getProp('value'))
|
||||
if (widgetInner.getProp('value') !== '') {
|
||||
stateManager.pushValueNewProp(widgetInner.getProp('id'), widgetInner.getProp('value'))
|
||||
}
|
||||
|
||||
// Append the widget to its parent
|
||||
parentNode[0].appendChild(widgetContainer[0])
|
||||
parentNode.appendChild(widgetContainer)
|
||||
}
|
||||
|
||||
// Editor needs to get the container object
|
||||
if (data && data.length==1) return widgetContainer
|
||||
if (data && data.length==1) return widgetInner
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -168,3 +164,5 @@ var Parser = class Parser {
|
|||
var parser = new Parser()
|
||||
|
||||
module.exports = parser
|
||||
|
||||
parser.widgets = require('./widgets/').widgets
|
||||
|
|
|
|||
|
|
@ -1,49 +1,140 @@
|
|||
var {getObjectData, updateDom} = require('./editor/data-workers'),
|
||||
var {updateWidget} = require('./editor/data-workers'),
|
||||
widgetManager = require('./managers/widgets')
|
||||
|
||||
var callbacks = {
|
||||
'/EXEC': function(args) {
|
||||
// backward-compatibility
|
||||
var [name, ...args] = args
|
||||
if (name == 'edit') return callbacks['/EDIT'](args)
|
||||
if (name == 'edit_soft') return callbacks['/EDIT_SOFT'](args)
|
||||
},
|
||||
'/EDIT': function(args) {
|
||||
|
||||
if (READ_ONLY) return
|
||||
|
||||
var [id, json] = args,
|
||||
newdata = JSON.parseFlex(json),
|
||||
containers = widgetManager.getWidgetById(id)
|
||||
widgets = widgetManager.getWidgetById(id)
|
||||
|
||||
if (!containers.length) return
|
||||
for (var i=containers.length-1;i>=0;i--) {
|
||||
var container = containers[i].container,
|
||||
data = containers[i].props
|
||||
if (!widgets.length) return
|
||||
|
||||
for (var i = widgets.length - 1; i >= 0; i--) {
|
||||
|
||||
var widget = widgets[i],
|
||||
data = widget.props
|
||||
|
||||
for (var k in newdata) {
|
||||
data[k] = newdata[k]
|
||||
}
|
||||
updateDom(container,data,true)
|
||||
updateWidget(widget, {remote: true})
|
||||
|
||||
}
|
||||
},
|
||||
'/EDIT_SOFT': function(args) {
|
||||
'/EDIT/MERGE': function(args) {
|
||||
|
||||
if (READ_ONLY) return
|
||||
|
||||
var [id, json] = args,
|
||||
newdata = JSON.parseFlex(json),
|
||||
containers = widgetManager.getWidgetById(id)
|
||||
widgets = widgetManager.getWidgetById(id)
|
||||
|
||||
if (!containers.length) return
|
||||
for (var i=containers.length-1;i>=0;i--) {
|
||||
var container = containers[i].container,
|
||||
data = containers[i].props
|
||||
if (!widgets.length) return
|
||||
|
||||
for (var i = widgets.length - 1; i >= 0; i--) {
|
||||
|
||||
var widget = widgets[i],
|
||||
data = widget.props
|
||||
|
||||
$.extend(true,data,newdata)
|
||||
updateDom(container,data,true)
|
||||
updateWidget(widget, {remote: true})
|
||||
|
||||
}
|
||||
},
|
||||
'/EDIT/GET': function(args) {
|
||||
|
||||
var [target, idOrAddress, ...preArgs] = args,
|
||||
widgets = []
|
||||
|
||||
if (idOrAddress[0] == '/') {
|
||||
|
||||
widgets = widgetManager.getWidgetByAddress(
|
||||
widgetManager.createAddressRef(null, preArgs, idOrAddress)
|
||||
)
|
||||
|
||||
} else {
|
||||
|
||||
widgets = widgetManager.getWidgetById(idOrAddress)
|
||||
|
||||
}
|
||||
|
||||
for (var i = widgets.length - 1; i >= 0; i--) {
|
||||
|
||||
return widgets[i].sendValue({
|
||||
target: [target],
|
||||
address: '/EDIT/GET',
|
||||
preArgs: [idOrAddress, ...preArgs],
|
||||
v: JSON.stringify(widgets[i].props),
|
||||
noSync: true
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
},
|
||||
'/GET':function(args) {
|
||||
|
||||
var [target, idOrAddress, ...preArgs] = args,
|
||||
widgets = []
|
||||
|
||||
if (idOrAddress[0] == '/') {
|
||||
|
||||
widgets = widgetManager.getWidgetByAddress(
|
||||
widgetManager.createAddressRef(null, preArgs, idOrAddress)
|
||||
)
|
||||
|
||||
} else {
|
||||
|
||||
widgets = widgetManager.getWidgetById(idOrAddress)
|
||||
|
||||
}
|
||||
|
||||
for (var i = widgets.length - 1; i >= 0; i--) {
|
||||
|
||||
return widgets[i].sendValue({
|
||||
target: [target],
|
||||
address: '/GET',
|
||||
preArgs: [idOrAddress, ...preArgs],
|
||||
noSync: true
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
},
|
||||
'/SET':function(args) {
|
||||
|
||||
var [idOrAddress, ...preArgsOrValue] = args,
|
||||
widgets = [],
|
||||
value = null
|
||||
|
||||
if (idOrAddress[0] == '/') {
|
||||
|
||||
[widgets, value] = widgetManager.getWidgetByAddressAndArgs(
|
||||
idOrAddress,
|
||||
preArgsOrValue
|
||||
)
|
||||
|
||||
} else {
|
||||
|
||||
widgets = widgetManager.getWidgetById(idOrAddress)
|
||||
value = preArgsOrValue
|
||||
if (value.length == 0) value = null
|
||||
else if (value.length == 1) value = value[0]
|
||||
|
||||
}
|
||||
|
||||
for (var i = widgets.length - 1; i >= 0; i--) {
|
||||
|
||||
return widgets[i].setValue(value, {
|
||||
sync: true,
|
||||
send: true
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
},
|
||||
'/TABS': function(args) {
|
||||
|
||||
if (!Array.isArray(args)) args = [args]
|
||||
|
|
@ -51,13 +142,18 @@ var callbacks = {
|
|||
for (let id of args) {
|
||||
let ws = widgetManager.getWidgetById(id)
|
||||
for (let w of ws) {
|
||||
$(`.tablink[data-widget="${w.hash}"]`).trigger('fake-click')
|
||||
DOM.each(document, `.tablink[data-widget="${w.hash}"]`, (el)=>{
|
||||
DOM.dispatchEvent(el, 'fast-click')
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// backward-compatibility
|
||||
callbacks['/EDIT_SOFT'] = callbacks['/EDIT/MERGE']
|
||||
|
||||
module.exports = {
|
||||
exec: function(name, args){
|
||||
if (callbacks[name]) {
|
||||
|
|
|
|||
|
|
@ -1,165 +0,0 @@
|
|||
var state = require('./managers/state'),
|
||||
session = require('./managers/session'),
|
||||
editor = require('./editor/'),
|
||||
icon = require('./utils').icon,
|
||||
fullscreen = require('screenfull')
|
||||
|
||||
var data = [
|
||||
{
|
||||
actions: [
|
||||
{
|
||||
title:'Fullscreen',
|
||||
action:()=>{
|
||||
if (fullscreen.enabled) fullscreen.toggle()
|
||||
},
|
||||
class:'fullscreenToggle'
|
||||
}
|
||||
|
||||
]
|
||||
},
|
||||
{
|
||||
title: icon('sliders') + ' State',
|
||||
actions: [
|
||||
{
|
||||
title:'Store',
|
||||
action:()=>{
|
||||
state.quickSave.bind(state)
|
||||
$('.quickload').removeClass('disabled')
|
||||
}
|
||||
},
|
||||
{
|
||||
title:'Recall',
|
||||
action:state.quickLoad.bind(state),
|
||||
class:'disabled quickload'
|
||||
},
|
||||
{
|
||||
title:'Send All',
|
||||
action:state.send.bind(state)
|
||||
},
|
||||
{
|
||||
title:'Import',
|
||||
action:state.load.bind(state)
|
||||
},
|
||||
{
|
||||
title:'Export',
|
||||
action:state.save.bind(state)
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
title: icon('magic') + ' Traversing gestures',
|
||||
actions: [
|
||||
{
|
||||
title:'On',
|
||||
action:()=>{
|
||||
$('.traversingEnable, .traversingDisable').toggleClass('on')
|
||||
$('#container').enableTraversingGestures()
|
||||
},
|
||||
class:'traversingEnable'
|
||||
},
|
||||
{
|
||||
title:'Off',
|
||||
action:()=>{
|
||||
$('.traversingEnable, .traversingDisable').toggleClass('on')
|
||||
$('#container').disableTraversingGestures()
|
||||
},
|
||||
class:'traversingDisable on'
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
title: icon('edit') + ' Editor',
|
||||
class:'editor-menu',
|
||||
actions: [
|
||||
{
|
||||
title:'On',
|
||||
action:editor.enable.bind(editor),
|
||||
class:'enable-editor'
|
||||
},
|
||||
{
|
||||
title:'Off',
|
||||
action:editor.disable.bind(editor),
|
||||
class:'on disable-editor'
|
||||
},
|
||||
{
|
||||
title:'Root',
|
||||
class:'editor-root disabled'
|
||||
},
|
||||
{
|
||||
title:'Load',
|
||||
action:session.browse.bind(session)
|
||||
},
|
||||
{
|
||||
title:'Save',
|
||||
action:session.save.bind(session)
|
||||
}
|
||||
]
|
||||
},
|
||||
]
|
||||
|
||||
var sidepanel = $('<ul id="options"></ul>')
|
||||
|
||||
for (let i in data) {
|
||||
|
||||
let itemData = data[i],
|
||||
item = $('<li></li>'),
|
||||
inner = $(`<div class="${itemData.class || ''}"></div>`).appendTo(item),
|
||||
wrapper = $('<div class="actions"></div>').appendTo(inner)
|
||||
|
||||
if (itemData.title) $(`<div class="title">${itemData.title}</div>`).prependTo(wrapper)
|
||||
|
||||
for (let j in itemData.actions) {
|
||||
|
||||
let actionData = itemData.actions[j],
|
||||
element = $(`<a class="btn ${actionData.class || ''}">${actionData.title}</a>`).appendTo(wrapper)
|
||||
|
||||
if (actionData.action) element.click(actionData.action)
|
||||
|
||||
}
|
||||
|
||||
item.appendTo(sidepanel)
|
||||
|
||||
}
|
||||
|
||||
|
||||
$('#sidepanel').empty()
|
||||
$('#sidepanel').append(`
|
||||
<div class="navigation"><ul><li><a>${PACKAGE.productName.toUpperCase()}</a></li></ul></div>
|
||||
`)
|
||||
$('#sidepanel').append(sidepanel)
|
||||
$('#sidepanel').append('<div id="editor"></div>')
|
||||
|
||||
$('#container').on('fake-click.sidepanel', function(e){
|
||||
|
||||
if (e.target.id != 'open-toggle') return
|
||||
|
||||
var t = (!$('#sidepanel').hasClass('sidepanel-open')) ? 250 : 0
|
||||
|
||||
|
||||
setTimeout(function(){
|
||||
$('#open-toggle, #sidepanel').toggleClass('sidepanel-open')
|
||||
}, 25)
|
||||
|
||||
setTimeout(function(){
|
||||
$('#container').toggleClass('sidepanel-open')
|
||||
$(window).resize()
|
||||
},t + 25)
|
||||
|
||||
})
|
||||
|
||||
$(document).on('keydown.sidepanel', function(e){
|
||||
if (e.keyCode==121) $('#open-toggle').trigger('fake-click')
|
||||
})
|
||||
|
||||
// Fullscreen
|
||||
|
||||
var fsToggle = $('#sidepanel').find('.fullscreenToggle')
|
||||
|
||||
if (fullscreen.enabled) {
|
||||
fullscreen.off('change')
|
||||
fullscreen.on('change', ()=>{
|
||||
fsToggle.toggleClass('on', fullscreen.isFullScreen)
|
||||
})
|
||||
} else {
|
||||
fsToggle.addClass('disabled')
|
||||
}
|
||||
|
|
@ -1,23 +0,0 @@
|
|||
var sourceMap = require('../libs/source-map.min.js'),
|
||||
request = new XMLHttpRequest(),
|
||||
ipc = require('./ipc/')
|
||||
|
||||
request.open('GET', 'scripts.js.map', true)
|
||||
|
||||
request.onload = function() {
|
||||
|
||||
if (request.status >= 200 && request.status < 400) {
|
||||
|
||||
var data = JSON.parse(request.responseText),
|
||||
smc = new sourceMap.SourceMapConsumer(data)
|
||||
|
||||
window.onerror = function(error,url,row,col) {
|
||||
var data = smc.originalPositionFor({line:row,column:col})
|
||||
ipc.send('errorLog', `[Renderer process error]\n${error}\nSource: ${data.source} @ line ${data.line}`)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
request.send()
|
||||
28
src/browser/js/app/stacktrace.js
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
var StackTrace = require('stacktrace-js'),
|
||||
ipc = require('./ipc')
|
||||
|
||||
window.onerror = function(msg,url,row,col, error) {
|
||||
|
||||
StackTrace.fromError(error).then((stackframes)=>{
|
||||
|
||||
var stringifiedStack = stackframes.filter((sf)=>{
|
||||
|
||||
return !sf.fileName.match('browser-pack')
|
||||
|
||||
}).map(function(sf) {
|
||||
|
||||
if (sf.functionName.match(/Object\./)) sf.functionName = 'require'
|
||||
|
||||
return ` at ${sf.functionName} (${sf.fileName}:${sf.lineNumber}:${sf.columnNumber})`
|
||||
|
||||
}).join('\n')
|
||||
|
||||
ipc.send('errorLog', `[Renderer process error]\n${msg}\n${stringifiedStack}`)
|
||||
|
||||
}).catch(()=>{
|
||||
|
||||
ipc.send('errorLog', `[Renderer process error]\n${msg}\n at ${url}:${row}:${col}\n (no stacktrace available)`)
|
||||
|
||||
})
|
||||
|
||||
}
|
||||
|
|
@ -1,35 +0,0 @@
|
|||
|
||||
// mousewheel zoom
|
||||
$('html').on('mousewheel.zoom',function(e) {
|
||||
if (e.ctrlKey) {
|
||||
e.preventDefault()
|
||||
if (e.originalEvent.deltaY==0) return
|
||||
var d = -e.originalEvent.deltaY/(10*Math.abs(e.originalEvent.deltaY))
|
||||
|
||||
PXSCALE = parseFloat(d)+parseFloat(PXSCALE)
|
||||
document.documentElement.style.setProperty('font-size', PXSCALE + 'px')
|
||||
|
||||
$(window).resize()
|
||||
}
|
||||
})
|
||||
$(document).on('keydown.resetzoom', function(e){
|
||||
if (e.ctrlKey && (e.keyCode==96||e.keyCode==48)) {
|
||||
PXSCALE = INITIALZOOM
|
||||
document.documentElement.style.setProperty('font-size', PXSCALE + 'px')
|
||||
|
||||
$(window).resize()
|
||||
}
|
||||
})
|
||||
|
||||
// prevent mobile sleep
|
||||
var NoSleep = require('nosleep.js'),
|
||||
noSleep = new NoSleep()
|
||||
|
||||
function enableNoSleep() {
|
||||
noSleep.enable()
|
||||
document.removeEventListener('click', enableNoSleep, false)
|
||||
}
|
||||
|
||||
document.addEventListener('click', enableNoSleep, false)
|
||||
|
||||
require('./sidepanel')
|
||||
4
src/browser/js/app/ui/init.js
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
require('./zoom')
|
||||
require('./lobby').create()
|
||||
require('./sidepanel')
|
||||
require('../events/click')
|
||||
51
src/browser/js/app/ui/lobby.js
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
class Lobby {
|
||||
|
||||
constructor() {
|
||||
|
||||
this.state = 0
|
||||
|
||||
}
|
||||
|
||||
create() {
|
||||
|
||||
this.html = DOM.create(`
|
||||
<div id="lobby">
|
||||
<div class="main">
|
||||
<div class="header">
|
||||
${PACKAGE.productName}
|
||||
</div>
|
||||
<div class="list"></div>
|
||||
<div class="footer"></div>
|
||||
</div>
|
||||
</div>
|
||||
`)
|
||||
|
||||
this.main = DOM.get(this.html, '.main')[0]
|
||||
this.list = DOM.get(this.html, '.list')[0]
|
||||
this.footer = DOM.get(this.html, '.footer')[0]
|
||||
|
||||
}
|
||||
|
||||
open() {
|
||||
if (this.state) return
|
||||
this.state = 1
|
||||
document.body.appendChild(this.html)
|
||||
setTimeout(()=>{
|
||||
this.main.classList.add('show')
|
||||
})
|
||||
}
|
||||
|
||||
close() {
|
||||
if (!this.state) return
|
||||
this.state = 0
|
||||
this.main.classList.remove('show')
|
||||
setTimeout(()=>{
|
||||
document.body.removeChild(this.html)
|
||||
}, 100)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
var lobby = new Lobby()
|
||||
|
||||
module.exports = lobby
|
||||
219
src/browser/js/app/ui/sidepanel.js
Normal file
|
|
@ -0,0 +1,219 @@
|
|||
var state = require('../managers/state'),
|
||||
session = require('../managers/session'),
|
||||
editor = require('../editor/'),
|
||||
{icon} = require('./utils'),
|
||||
fullscreen = require('screenfull'),
|
||||
{enableTraversingGestures, disableTraversingGestures} = require('../events/drag')
|
||||
|
||||
var sidepanelData = [
|
||||
{
|
||||
actions: [
|
||||
{
|
||||
title:'Fullscreen',
|
||||
action:()=>{
|
||||
if (fullscreen.enabled) fullscreen.toggle()
|
||||
},
|
||||
class:'fullscreenToggle'
|
||||
}
|
||||
|
||||
]
|
||||
},
|
||||
{
|
||||
title: icon('sliders-h') + ' State',
|
||||
actions: [
|
||||
{
|
||||
title:'Store',
|
||||
action:()=>{
|
||||
state.quickSave()
|
||||
DOM.get('.quickload')[0].classList.remove('disabled')
|
||||
}
|
||||
},
|
||||
{
|
||||
title:'Recall',
|
||||
action:state.quickLoad.bind(state),
|
||||
class:'disabled quickload'
|
||||
},
|
||||
{
|
||||
title:'Send All',
|
||||
action:state.send.bind(state)
|
||||
},
|
||||
{
|
||||
title:'Import',
|
||||
action:state.load.bind(state)
|
||||
},
|
||||
{
|
||||
title:'Export',
|
||||
action:state.save.bind(state)
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
title: icon('magic') + ' Traversing gestures',
|
||||
actions: [
|
||||
{
|
||||
title:'On',
|
||||
action:()=>{
|
||||
DOM.each(document, '.traversingEnable, .traversingDisable', (el)=>{
|
||||
el.classList.toggle('on')
|
||||
})
|
||||
enableTraversingGestures(document.getElementById('container'))
|
||||
},
|
||||
class:'traversingEnable'
|
||||
},
|
||||
{
|
||||
title:'Off',
|
||||
action:()=>{
|
||||
DOM.each(document, '.traversingEnable, .traversingDisable', (el)=>{
|
||||
el.classList.toggle('on')
|
||||
})
|
||||
disableTraversingGestures(document.getElementById('container'))
|
||||
},
|
||||
class:'traversingDisable on'
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
title: icon('edit') + ' Editor',
|
||||
class:'editor-menu',
|
||||
actions: [
|
||||
{
|
||||
title:'On',
|
||||
action:editor.enable.bind(editor),
|
||||
class:'enable-editor'
|
||||
},
|
||||
{
|
||||
title:'Off',
|
||||
action:editor.disable.bind(editor),
|
||||
class:'on disable-editor'
|
||||
},
|
||||
{
|
||||
title:'Root',
|
||||
class:'editor-root disabled'
|
||||
},
|
||||
{
|
||||
title:'Load',
|
||||
action:session.browse.bind(session)
|
||||
},
|
||||
{
|
||||
title:'Save',
|
||||
action:session.save.bind(session)
|
||||
}
|
||||
]
|
||||
},
|
||||
]
|
||||
|
||||
var options = DOM.create('<ul id="options"></ul>')
|
||||
|
||||
for (let i in sidepanelData) {
|
||||
|
||||
let data = sidepanelData[i],
|
||||
item = DOM.create(`
|
||||
<li>
|
||||
<div class="${data.class || ''}">
|
||||
<div class="actions">
|
||||
${data.title ? `<div class="title">${data.title}</div>` : ''}
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
`),
|
||||
wrapper = DOM.get(item, '.actions')[0]
|
||||
|
||||
for (let j in data.actions) {
|
||||
|
||||
let actionData = data.actions[j],
|
||||
element = DOM.create(`<a class="btn ${actionData.class || ''}">${actionData.title}</a>`)
|
||||
|
||||
if (actionData.action) element.addEventListener('click', actionData.action)
|
||||
|
||||
wrapper.appendChild(element)
|
||||
}
|
||||
|
||||
options.appendChild(item)
|
||||
|
||||
}
|
||||
|
||||
|
||||
var sidepanel = document.getElementById('sidepanel')
|
||||
|
||||
sidepanel.appendChild(DOM.create(`
|
||||
<div class="navigation"><ul><li><a>${PACKAGE.productName.toUpperCase()}</a></li></ul></div>
|
||||
`))
|
||||
|
||||
sidepanel.appendChild(options)
|
||||
|
||||
sidepanel.appendChild(DOM.create('<div id="editor"></div>'))
|
||||
|
||||
|
||||
// Fullscreen
|
||||
|
||||
var fsToggle = DOM.get(sidepanel, '.fullscreenToggle')[0]
|
||||
|
||||
if (fullscreen.enabled) {
|
||||
fullscreen.on('change', ()=>{
|
||||
fsToggle.classList.toggle('on', fullscreen.isFullScreen)
|
||||
})
|
||||
} else {
|
||||
fsToggle.classList.add('disabled')
|
||||
}
|
||||
|
||||
|
||||
// open / close / toggle
|
||||
|
||||
function sidepanelOpen() {
|
||||
|
||||
DOM.get('#open-toggle, #sidepanel').forEach((el)=>{
|
||||
el.classList.add('sidepanel-open')
|
||||
})
|
||||
|
||||
setTimeout(function(){
|
||||
DOM.get('#container')[0].classList.add('sidepanel-open')
|
||||
setTimeout(function(){
|
||||
DOM.dispatchEvent(window, 'resize')
|
||||
}, 25)
|
||||
}, 250)
|
||||
|
||||
}
|
||||
|
||||
function sidepanelClose() {
|
||||
|
||||
DOM.get('#open-toggle, #sidepanel, #container').forEach((el)=>{
|
||||
el.classList.remove('sidepanel-open')
|
||||
})
|
||||
|
||||
setTimeout(function(){
|
||||
DOM.dispatchEvent(window, 'resize')
|
||||
}, 25)
|
||||
|
||||
}
|
||||
|
||||
function sidepanelToggle() {
|
||||
|
||||
if (sidepanel.classList.contains('sidepanel-open')) {
|
||||
sidepanelClose()
|
||||
} else {
|
||||
sidepanelOpen()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
DOM.get('#container')[0].addEventListener('fast-click', function(e){
|
||||
|
||||
if (e.target.id == 'open-toggle') {
|
||||
e.stopPropagation()
|
||||
sidepanelToggle()
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
document.addEventListener('keydown', function(e){
|
||||
// F10
|
||||
if (e.keyCode==121) sidepanelToggle()
|
||||
})
|
||||
|
||||
|
||||
module.exports = {
|
||||
open: sidepanelOpen,
|
||||
close: sidepanelClose,
|
||||
toggle: sidepanelToggle
|
||||
}
|
||||
83
src/browser/js/app/ui/utils.js
Normal file
|
|
@ -0,0 +1,83 @@
|
|||
module.exports = {
|
||||
|
||||
Popup: class Popup {
|
||||
|
||||
constructor(options) {
|
||||
|
||||
this.closable = options.closable
|
||||
this.escKey = options.closable || options.escKey
|
||||
this.enterKey = options.enterKey
|
||||
this.content = options.content
|
||||
this.title = options.title
|
||||
this.state = 0
|
||||
|
||||
this.html = DOM.create(`
|
||||
<div class="popup show">
|
||||
<div class="popup-wrapper">
|
||||
<div class="popup-title ${this.closable? 'closable' : ''}">${this.title}${this.closable? `<span class="closer">${module.exports.icon('times')}</span>` : ''}</div>
|
||||
<div class="popup-content">
|
||||
${this.content}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
`)
|
||||
|
||||
if (this.closable) {
|
||||
DOM.get(this.html, '.popup-title .closer')[0].addEventListener('fast-click', ()=>{
|
||||
this.close()
|
||||
})
|
||||
}
|
||||
|
||||
if (this.escKey) {
|
||||
this.escKeyHandler = ((e)=>{
|
||||
if (e.keyCode==27) this.close()
|
||||
}).bind(this)
|
||||
}
|
||||
|
||||
if (this.enterKey) {
|
||||
this.enterKeyHandler = ((e)=>{
|
||||
if (e.keyCode == 13) this.enterKey.call(this, e)
|
||||
}).bind(this)
|
||||
}
|
||||
|
||||
this.open()
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
close() {
|
||||
if (!this.state) return
|
||||
this.state = 0
|
||||
|
||||
if (this.escKey) document.removeEventListener('keydown', this.escKeyHandler)
|
||||
if (this.enterKey) document.removeEventListener('keydown', this.enterKeyHandler)
|
||||
document.body.removeChild(this.html)
|
||||
}
|
||||
|
||||
open() {
|
||||
if (this.state) return
|
||||
this.state = 1
|
||||
|
||||
if (this.escKey) document.addEventListener('keydown', this.escKeyHandler)
|
||||
if (this.enterKey) document.addEventListener('keydown', this.enterKeyHandler)
|
||||
document.body.appendChild(this.html)
|
||||
}
|
||||
},
|
||||
|
||||
loading: function(title){
|
||||
return new module.exports.Popup({
|
||||
title: title,
|
||||
content: '<p><div class="spinner"></div></p>',
|
||||
closable: false
|
||||
})
|
||||
},
|
||||
icon: function(i) {
|
||||
return `<i class="fa fa-fw fa-${i}"></i>`
|
||||
},
|
||||
iconify:function(string){
|
||||
return String(string).replace(/\^[^\s]*/g,(x)=>{return module.exports.icon(x.substring(1))})
|
||||
}
|
||||
|
||||
}
|
||||
22
src/browser/js/app/ui/zoom.js
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
// mousewheel zoom
|
||||
document.addEventListener('mousewheel', function(event) {
|
||||
if (event.ctrlKey) {
|
||||
event.preventDefault()
|
||||
if (event.deltaY==0) return
|
||||
var d = -event.deltaY / (10 * Math.abs(event.deltaY))
|
||||
|
||||
PXSCALE = parseFloat(d)+parseFloat(PXSCALE)
|
||||
document.documentElement.style.setProperty('font-size', PXSCALE + 'px')
|
||||
|
||||
DOM.dispatchEvent(window, 'resize')
|
||||
}
|
||||
})
|
||||
|
||||
document.addEventListener('keydown', function(event){
|
||||
if (event.ctrlKey && (event.keyCode == 96 || event.keyCode == 48)) {
|
||||
PXSCALE = INITIALZOOM
|
||||
document.documentElement.style.setProperty('font-size', PXSCALE + 'px')
|
||||
|
||||
DOM.dispatchEvent(window, 'resize')
|
||||
}
|
||||
})
|
||||
|
|
@ -1,43 +0,0 @@
|
|||
module.exports = {
|
||||
|
||||
createPopup: function(title,content,closable) {
|
||||
|
||||
var popup = $(`
|
||||
<div class="popup">
|
||||
<div class="popup-wrapper">
|
||||
<div class="popup-title ${closable? 'closable' : ''}">${title}${closable? `<span class="closer">${module.exports.icon('remove')}</span>` : ''}</div>
|
||||
<div class="popup-content"></div>
|
||||
</div>
|
||||
</div>`),
|
||||
closer = popup.find('.popup-title .closer')
|
||||
|
||||
if (closable) {
|
||||
closer.click(function(){
|
||||
popup.close()
|
||||
})
|
||||
$(document).on('keydown.popup', function(e){
|
||||
if (e.keyCode==27) popup.close()
|
||||
})
|
||||
}
|
||||
|
||||
popup.close = function(){
|
||||
$(document).off('.popup')
|
||||
popup.remove()
|
||||
}
|
||||
|
||||
popup.find('.popup-content').append(content)
|
||||
$('body').append(popup)
|
||||
|
||||
return popup
|
||||
},
|
||||
loading: function(title){
|
||||
return module.exports.createPopup(title,'<p><div class="spinner"></div></p>', false)
|
||||
},
|
||||
icon: function(i) {
|
||||
return `<i class="fa fa-fw fa-${i}"></i>`
|
||||
},
|
||||
iconify:function(string){
|
||||
return String(string).replace(/\^[^\s]*/g,(x)=>{return module.exports.icon(x.substring(1))})
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
var _widgets_base = require('../common/_widgets_base'),
|
||||
{iconify} = require('../../utils')
|
||||
{iconify} = require('../../ui/utils')
|
||||
|
||||
module.exports = class Dropdown extends _widgets_base {
|
||||
|
||||
|
|
@ -42,24 +42,24 @@ module.exports = class Dropdown extends _widgets_base {
|
|||
|
||||
super({...options, html: '<div class="select"></div>'})
|
||||
|
||||
this.select = $(`<select></select>`).appendTo(this.widget)
|
||||
this.select = this.widget.appendChild(DOM.create(`<select></select>`))
|
||||
|
||||
this.values = []
|
||||
|
||||
var i = 0
|
||||
for (var k in this.getProp('values')) {
|
||||
this.values[i] = this.getProp('values')[k]
|
||||
this.select.append(`<option value="${i}">${iconify(parseFloat(k) != k ? k : this.getProp("values")[k])}</option>`)
|
||||
this.select.innerHTML += `<option value="${i}">${iconify(parseFloat(k) != k ? k : this.getProp("values")[k])}</option>`
|
||||
i++
|
||||
}
|
||||
|
||||
this.select.change(()=>{
|
||||
this.setValue(this.values[this.select[0].selectedIndex], {sync:true, send:true, fromLocal:true})
|
||||
this.select.addEventListener('change', ()=>{
|
||||
this.setValue(this.values[this.select.selectedIndex], {sync:true, send:true, fromLocal:true})
|
||||
})
|
||||
|
||||
this.value = undefined
|
||||
this.select[0].selectedIndex = -1
|
||||
this.container.addClass('noselect')
|
||||
this.select.selectedIndex = -1
|
||||
this.container.classList.add('noselect')
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -69,15 +69,15 @@ module.exports = class Dropdown extends _widgets_base {
|
|||
|
||||
if (i != -1) {
|
||||
this.value = this.values[i]
|
||||
if (!options.fromLocal) this.select[0].selectedIndex = i
|
||||
if (!options.fromLocal) this.select.selectedIndex = i
|
||||
if (options.send) this.sendValue()
|
||||
if (options.sync) this.widget.trigger({type:'change',id:this.getProp('id'),widget:this, linkId:this.getProp('linkId'), options})
|
||||
this.container.removeClass('noselect')
|
||||
if (options.sync) this.changed(options)
|
||||
this.container.classList.remove('noselect')
|
||||
} else {
|
||||
this.value = undefined
|
||||
this.select[0].selectedIndex = -1
|
||||
if (options.sync) this.widget.trigger({type:'change',id:this.getProp('id'),widget:this, linkId:this.getProp('linkId'), options})
|
||||
this.container.addClass('noselect')
|
||||
if (options.sync) this.changed(options)
|
||||
this.container.classList.add('noselect')
|
||||
}
|
||||
|
||||
}}
|
||||
|
|
|
|||
|
|
@ -47,12 +47,14 @@ module.exports = class Push extends _widgets_base {
|
|||
this.active = 0
|
||||
this.lastChanged = 'state'
|
||||
|
||||
this.widget.on('drag',function(e){e.stopPropagation()})
|
||||
this.widget.on('draginit.push',()=>{
|
||||
this.widget.off('draginit.push')
|
||||
this.fakeclick()
|
||||
})
|
||||
this.classHolders = this.widget.add(this.container)
|
||||
this.on('draginit',()=>{
|
||||
if (this.active) return
|
||||
this.setValuePrivate(this.getProp('on'),{send:true,sync:true})
|
||||
}, {element: this.widget})
|
||||
|
||||
this.on('dragend',()=>{
|
||||
this.setValuePrivate(this.getProp('off'),{send:true,sync:true})
|
||||
}, {element: this.widget})
|
||||
|
||||
this.value = this.getProp('off')
|
||||
|
||||
|
|
@ -68,37 +70,23 @@ module.exports = class Push extends _widgets_base {
|
|||
|
||||
}
|
||||
|
||||
fakeclick(){
|
||||
|
||||
if (!this.active) this.setValuePrivate(this.getProp('on'),{send:true,sync:true})
|
||||
this.widget.on('dragend.push',()=>{
|
||||
this.setValuePrivate(this.getProp('off'),{send:true,sync:true})
|
||||
this.widget.off('dragend.push')
|
||||
this.widget.on('draginit.push',()=>{
|
||||
this.widget.off('draginit.push')
|
||||
this.fakeclick()
|
||||
})
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
setValuePrivate(v,options={}) {
|
||||
|
||||
if (typeof v == 'object' && v !== null) v = v.value
|
||||
if (v===this.getProp('on') || (this.getProp('on') != null && v === this.getProp('on').value && v !== undefined)) {
|
||||
this.widget.addClass('active')
|
||||
this.widget.classList.add('active')
|
||||
this.active = 1
|
||||
this.lastChanged = 'active'
|
||||
this.updateValue()
|
||||
if (options.send) this.sendValue(v)
|
||||
if (options.sync) this.widget.trigger({type:'change',id:this.getProp('id'),widget:this, linkId:this.getProp('linkId'), options:options})
|
||||
if (options.sync) this.changed(options)
|
||||
} else if (v===this.getProp('off') || (this.getProp('off') != null && v === this.getProp('off').value && v !== undefined)) {
|
||||
this.widget.removeClass('active')
|
||||
this.widget.classList.remove('active')
|
||||
this.active = 0
|
||||
this.lastChanged = 'active'
|
||||
this.updateValue()
|
||||
if (options.send) this.sendValue(v, this.getProp('norelease'))
|
||||
if (options.sync) this.widget.trigger({type:'change',id:this.getProp('id'),widget:this, linkId:this.getProp('linkId'), options:options})
|
||||
if (options.sync) this.changed(options)
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -111,17 +99,19 @@ module.exports = class Push extends _widgets_base {
|
|||
}
|
||||
if (typeof v == 'object' && v !== null) v = v.value
|
||||
if (v===this.getProp('on') || (this.getProp('on') != null && v === this.getProp('on').value && v !== undefined)) {
|
||||
this.classHolders.addClass('on')
|
||||
this.widget.classList.add('on')
|
||||
this.container.classList.add('on')
|
||||
this.state = 1
|
||||
if (options.send) this.sendValue(v)
|
||||
this.lastChanged = 'state'
|
||||
if (options.sync) this.widget.trigger({type:'change',id:this.getProp('id'),widget:this, linkId:this.getProp('linkId'),options:options})
|
||||
if (options.sync) this.changed(options)
|
||||
} else if (v===this.getProp('off') || (this.getProp('off') != null && v === this.getProp('off').value && v !== undefined)) {
|
||||
this.classHolders.removeClass('on')
|
||||
this.widget.classList.remove('on')
|
||||
this.container.classList.remove('on')
|
||||
this.state = 0
|
||||
if (options.send) this.sendValue(v)
|
||||
this.lastChanged = 'state'
|
||||
if (options.sync) this.widget.trigger({type:'change',id:this.getProp('id'),widget:this, linkId:this.getProp('linkId'),options:options})
|
||||
if (options.sync) this.changed(options)
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
var _widgets_base = require('../common/_widgets_base'),
|
||||
{iconify} = require('../../utils'),
|
||||
$document = $(document)
|
||||
{iconify} = require('../../ui/utils')
|
||||
|
||||
module.exports = class Switch extends _widgets_base {
|
||||
|
||||
|
|
@ -27,6 +26,7 @@ module.exports = class Switch extends _widgets_base {
|
|||
_switch:'switch',
|
||||
|
||||
horizontal:false,
|
||||
showValues:false,
|
||||
values:{"Value 1":1,"Value 2":2},
|
||||
value:'',
|
||||
|
||||
|
|
@ -46,23 +46,41 @@ module.exports = class Switch extends _widgets_base {
|
|||
super({...options, html: '<div class="switch"></div>'})
|
||||
|
||||
|
||||
if (this.getProp('horizontal')) this.widget.addClass('horizontal')
|
||||
if (this.getProp('horizontal')) this.widget.classList.add('horizontal')
|
||||
|
||||
this.values = []
|
||||
this.stringValues = []
|
||||
|
||||
var isArray = Array.isArray(this.getProp('values'))
|
||||
|
||||
for (var k in this.getProp('values')) {
|
||||
|
||||
this.values.push(this.getProp('values')[k])
|
||||
$(`<div class="value">${iconify(parseFloat(k) != k ? k : this.getProp("values")[k])}</div>`).data({value:this.getProp('values')[k]}).appendTo(this.widget)
|
||||
|
||||
if (typeof this.getProp('values')[k] == 'object') {
|
||||
this.stringValues.push(JSON.stringify(this.getProp('values')[k]))
|
||||
} else {
|
||||
this.stringValues.push(-1)
|
||||
}
|
||||
|
||||
var label = isArray ? this.getProp('values')[k]: k
|
||||
if (this.getProp('showValues') && !isArray) label = label + ': ' + this.getProp('values')[k]
|
||||
|
||||
this.widget.appendChild(DOM.create(`
|
||||
<div class="value"> ${iconify(label)}</div>
|
||||
`))
|
||||
|
||||
}
|
||||
|
||||
this.value = undefined
|
||||
|
||||
this.widget.find('.value').on('draginit',(e,dd)=>{
|
||||
this.on('draginit', (e)=>{
|
||||
|
||||
var index = 0,
|
||||
node = e.target
|
||||
|
||||
while ( (node = node.previousSibling) ) {
|
||||
if (node.nodeType != 3 || !/^\s*$/.test(node.data)) {
|
||||
if (node.nodeType != 3) {
|
||||
index++;
|
||||
}
|
||||
}
|
||||
|
|
@ -70,23 +88,27 @@ module.exports = class Switch extends _widgets_base {
|
|||
var value = this.values[index]
|
||||
|
||||
if (value!=this.value || this.value===undefined) this.setValue(value,{sync:true,send:true})
|
||||
})
|
||||
|
||||
}, {element: this.widget})
|
||||
|
||||
}
|
||||
|
||||
setValue(v,options={}) {
|
||||
setValue(v, options={}) {
|
||||
|
||||
var i = typeof v == 'object' ?
|
||||
this.stringValues.indexOf(JSON.stringify(v)) :
|
||||
this.values.indexOf(v)
|
||||
|
||||
DOM.each(this.widget, '.on', (el)=>{el.classList.remove('on')})
|
||||
|
||||
var i = this.values.indexOf(v)
|
||||
if (i!=-1) {
|
||||
this.value = this.values[i]
|
||||
this.widget.find('.on').removeClass('on')
|
||||
this.widget.find('.value').eq(i).addClass('on')
|
||||
DOM.get(this.widget, '.value')[i].classList.add('on')
|
||||
if (options.send) this.sendValue(this.value)
|
||||
if (options.sync) this.widget.trigger({type:'change',id:this.getProp('id'),widget:this, linkId:this.getProp('linkId'), options})
|
||||
if (options.sync) this.changed(options)
|
||||
} else {
|
||||
this.widget.find('.on').removeClass('on')
|
||||
this.value = undefined
|
||||
if (options.sync) this.widget.trigger({type:'change',id:this.getProp('id'),widget:this, linkId:this.getProp('linkId'), options})
|
||||
if (options.sync) this.changed(options)
|
||||
}
|
||||
|
||||
}}
|
||||
|
|
|
|||