diff --git a/static/css/patch.css b/static/css/patch.css index 6bdfbec..ab79336 100644 --- a/static/css/patch.css +++ b/static/css/patch.css @@ -63,10 +63,10 @@ display: inline-block; } -svg #params, +/* svg #params, svg #sockets { display: none; -} +} */ .instrument .cables { position: absolute; diff --git a/static/js/panel.js b/static/js/panel.js index 8ae94cd..c36d18a 100644 --- a/static/js/panel.js +++ b/static/js/panel.js @@ -93,15 +93,17 @@ class Panel { model = {}; params = []; sockets = []; + preset = {}; cable = null; cables = null; - constructor(svg, container, debug = false) { + constructor(svg, container, preset = {}, debug = false) { this.svg = this.htmlToElement(svg); this.container = container; this.container.style.position = "relative"; this.containerRect = container.getBoundingClientRect(); + this.preset = { ...preset }; this.debug = debug; while (container.firstChild) { @@ -111,6 +113,7 @@ class Panel { this.setSize(); this.createParams(); + this.createSockets(); this.createCables(); @@ -155,6 +158,10 @@ class Panel { control.setAttribute("name", param.id); + if (this.preset.hasOwnProperty(param.id)) { + control.value = this.preset[param.id]; + } + this.container.appendChild(control); this.model.params.push(param.id); diff --git a/static/js/patch.js b/static/js/patch.js index 84ca42b..c3a0f11 100644 --- a/static/js/patch.js +++ b/static/js/patch.js @@ -1,4 +1,8 @@ const container = document.querySelector("#panel-container"); +const preset = { ...document.querySelector("#data-params").dataset }; + const svg = container.querySelector("svg").outerHTML; -let panel = new Panel(svg, container); +let panel = new Panel(svg, container, preset); + +// there is something about ... but is not that diff --git a/templates/patch.html b/templates/patch.html index 3c244fc..4bdcb1b 100644 --- a/templates/patch.html +++ b/templates/patch.html @@ -13,7 +13,7 @@ - +
@@ -27,7 +27,7 @@ /

{{patch['name']}}

-