Skip to content
Snippets Groups Projects
Commit 601b1ff2 authored by RANWEZ Pierre's avatar RANWEZ Pierre :anchor:
Browse files

:children_crossing: improve: code heritage

parent 83a767e8
No related branches found
No related tags found
1 merge request!1✨ feat: CSSLSD V2
...@@ -1430,7 +1430,8 @@ You can put "element" tab to bottom by right-clicking on it. ...@@ -1430,7 +1430,8 @@ You can put "element" tab to bottom by right-clicking on it.
For deported devtool, click on more (top-right) and then click on separate devtool dock.</p> For deported devtool, click on more (top-right) and then click on separate devtool dock.</p>
<p><img src="file:///d:\Cours\M2S4\PFE\csslsd\doc\devtool.gif" alt="Devtool view"></p> <p><img src="file:///d:\Cours\M2S4\PFE\csslsd\doc\devtool.gif" alt="Devtool view"></p>
<h3 id="csslsd-code">CSSLSD Code</h3> <h3 id="csslsd-code">CSSLSD Code</h3>
<p>You need to use a custom CSS template, like below to map your audio or MIDI events to some CSSLSD properties. All parameters are between <strong>square brackets</strong> you can extend parameter by heritage with a range like bellow (this is not mandatory). You can use multiple parameters in a line. You can also type pure CSS in code editor, this CSS wil be apply on code auto-save (each time your type something in editor).</p> <p>You need to use a custom CSS template, like below to map your audio or MIDI events to some CSSLSD properties. All parameters are between <strong>square brackets</strong>. You can use multiple parameters in a line. You can also type pure CSS in code editor, this CSS wil be apply on code auto-save (each time your type something in editor).</p>
<p>You can extend parameter by heritage with template <code>[&lt;parameter&gt; &lt;type&gt; &lt;option&gt; &lt;audio or midi control&gt;]</code>. This is not mandatory to type all heritage, but you need to restect the direction. This is allowed : <code>[&lt;parameter&gt; &lt;type&gt; &lt;option&gt;]</code> or <code>[&lt;parameter&gt; &lt;type&gt;]</code>. This is <strong>not</strong> allowed : <code>[&lt;parameter&gt; &lt;audio or midi control&gt;]</code>.</p>
<p>Code example:</p> <p>Code example:</p>
<pre><code class="language-css"><div><span class="hljs-selector-tag">body</span> { <pre><code class="language-css"><div><span class="hljs-selector-tag">body</span> {
<span class="hljs-comment">/* Tip : You can use comments */</span> <span class="hljs-comment">/* Tip : You can use comments */</span>
......
...@@ -71,7 +71,9 @@ For deported devtool, click on more (top-right) and then click on separate devto ...@@ -71,7 +71,9 @@ For deported devtool, click on more (top-right) and then click on separate devto
### CSSLSD Code ### CSSLSD Code
You need to use a custom CSS template, like below to map your audio or MIDI events to some CSSLSD properties. All parameters are between **square brackets** you can extend parameter by heritage with a range like bellow (this is not mandatory). You can use multiple parameters in a line. You can also type pure CSS in code editor, this CSS wil be apply on code auto-save (each time your type something in editor). You need to use a custom CSS template, like below to map your audio or MIDI events to some CSSLSD properties. All parameters are between **square brackets**. You can use multiple parameters in a line. You can also type pure CSS in code editor, this CSS wil be apply on code auto-save (each time your type something in editor).
You can extend parameter by heritage with template `[<parameter> <type> <option> <audio or midi control>]`. This is not mandatory to type all heritage, but you need to restect the direction. This is allowed : `[<parameter> <type> <option>]` or `[<parameter> <type>]`. This is **not** allowed : `[<parameter> <audio or midi control>]`.
Code example: Code example:
......
...@@ -208,23 +208,23 @@ function analyseAll() { ...@@ -208,23 +208,23 @@ function analyseAll() {
type: '', type: '',
name: templateSplited[0], name: templateSplited[0],
templateFull: template, templateFull: template,
eventType: '', eventType: templateSplited.length > 3 ? (templateSplited[3].includes(':')?templateSplited[3].split(':')[0]:templateSplited[3]) : '',
eventName: '', eventName: templateSplited.length > 3 ? (templateSplited[3].includes(':')?templateSplited[3].split(':')[1]:'') : '',
options: '', options: templateSplited.length > 2 ? (templateSplited[2]) : '',
array: templateSplited.length > 1 ? (templateSplited[1].includes(';') ? templateSplited[1].split(';') : '') : '', array: templateSplited.length > 1 ? (templateSplited[1].includes(';') ? templateSplited[1].split(';') : '') : '',
min: templateSplited.length > 1 ? (templateSplited[1].includes(':') ? templateSplited[1].split(':')[0] : '') : '', min: templateSplited.length > 1 ? (templateSplited[1].includes(':') ? templateSplited[1].split(':')[0] : '') : '',
max: templateSplited.length > 1 ? (templateSplited[1].includes(':') ? templateSplited[1].split(':')[1] : '') : '', max: templateSplited.length > 1 ? (templateSplited[1].includes(':') ? templateSplited[1].split(':')[1] : '') : '',
} }
obj.type = 'midi'; obj.type = 'midi';
if (midiE.includes(':')) { if (midiE.includes(':')) {
obj.eventType = midiE.split(':')[0]; obj.eventType = ((obj.eventType == '') ? midiE.split(':')[0] : obj.eventType);
obj.eventName = midiE.split(':')[1]; obj.eventName = ((obj.eventName == '') ? midiE.split(':')[1] : obj.eventName);
} }
else { else {
obj.eventType = midiE; obj.eventType = ((obj.eventType == '') ? midiE : obj.eventType);
obj.eventName = ''; obj.eventName = ((obj.eventName == '') ? '' : obj.eventName);
} }
obj.options = p[3]; obj.options = ((obj.options == '') ? (p[3]) : obj.options);
obj.array = ((obj.array == '') ? (p[2].includes(';') ? p[2].split(';') : '') : obj.array); obj.array = ((obj.array == '') ? (p[2].includes(';') ? p[2].split(';') : '') : obj.array);
obj.min = ((obj.min == '') ? (p[2].includes(':') ? p[2].split(':')[0] : 0) : obj.min); obj.min = ((obj.min == '') ? (p[2].includes(':') ? p[2].split(':')[0] : 0) : obj.min);
obj.max = ((obj.max == '') ? (p[2].includes(':') ? p[2].split(':')[1] : 1) : obj.max); obj.max = ((obj.max == '') ? (p[2].includes(':') ? p[2].split(':')[1] : 1) : obj.max);
...@@ -237,23 +237,23 @@ function analyseAll() { ...@@ -237,23 +237,23 @@ function analyseAll() {
type: '', type: '',
name: templateSplited[0], name: templateSplited[0],
templateFull: template, templateFull: template,
eventType: '', eventType: templateSplited.length > 3 ? (templateSplited[3].includes(':')?templateSplited[3].split(':')[0]:templateSplited[3]) : '',
eventName: '', eventName: templateSplited.length > 3 ? (templateSplited[3].includes(':')?templateSplited[3].split(':')[1]:'') : '',
options: '', options: templateSplited.length > 2 ? (templateSplited[2]) : '',
array: templateSplited.length > 1 ? (templateSplited[1].includes(';') ? templateSplited[1].split(';') : '') : '', array: templateSplited.length > 1 ? (templateSplited[1].includes(';') ? templateSplited[1].split(';') : '') : '',
min: templateSplited.length > 1 ? (templateSplited[1].includes(':') ? templateSplited[1].split(':')[0] : '') : '', min: templateSplited.length > 1 ? (templateSplited[1].includes(':') ? templateSplited[1].split(':')[0] : '') : '',
max: templateSplited.length > 1 ? (templateSplited[1].includes(':') ? templateSplited[1].split(':')[1] : '') : '', max: templateSplited.length > 1 ? (templateSplited[1].includes(':') ? templateSplited[1].split(':')[1] : '') : '',
} }
obj.type = 'audio'; obj.type = 'audio';
if (audioE.includes(':')) { if (audioE.includes(':')) {
obj.eventType = audioE.split(':')[0]; obj.eventType = ((obj.eventType == '') ? audioE.split(':')[0] : obj.eventType);
obj.eventName = audioE.split(':')[1]; obj.eventName = ((obj.eventName == '') ? audioE.split(':')[1] : obj.eventName);
} }
else { else {
obj.eventType = audioE; obj.eventType = ((obj.eventType == '') ? audioE : obj.eventType);
obj.eventName = ''; obj.eventName = ((obj.eventName == '') ? '' : obj.eventName);
} }
obj.options = p[3]; obj.options = ((obj.options == '') ? (p[3]) : obj.options);
obj.array = ((obj.array == '') ? (p[2].includes(';') ? p[2].split(';') : '') : obj.array); obj.array = ((obj.array == '') ? (p[2].includes(';') ? p[2].split(';') : '') : obj.array);
obj.min = ((obj.min == '') ? (p[2].includes(':') ? p[2].split(':')[0] : 0) : obj.min); obj.min = ((obj.min == '') ? (p[2].includes(':') ? p[2].split(':')[0] : 0) : obj.min);
obj.max = ((obj.max == '') ? (p[2].includes(':') ? p[2].split(':')[1] : 1) : obj.max); obj.max = ((obj.max == '') ? (p[2].includes(':') ? p[2].split(':')[1] : 1) : obj.max);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment