Mercurial > code > home > repos > light9
changeset 2344:83135b0c8bba
sort faders in a page by column
author | drewp@bigasterisk.com |
---|---|
date | Sat, 03 Jun 2023 14:51:06 -0700 |
parents | af38643cffd4 |
children | b972f927ae6c |
files | light9/fade/Light9FadeUi.ts |
diffstat | 1 files changed, 10 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/light9/fade/Light9FadeUi.ts Sat Jun 03 13:10:24 2023 -0700 +++ b/light9/fade/Light9FadeUi.ts Sat Jun 03 14:51:06 2023 -0700 @@ -10,12 +10,16 @@ export { EditChoice } from "../web/EditChoice"; export { Light9EffectFader } from "./Light9EffectFader"; -debug.enable("*,autodep"); +debug.enable("*,-autodep"); const log = debug("fade"); +class FaderConfig { +constructor(public uri: NamedNode,public column: number){} +} + class FadePage { constructor(public uri: NamedNode) {} - faders: NamedNode[] = []; + faders: FaderConfig[] = []; } class FadePages { pages: FadePage[] = []; @@ -56,7 +60,7 @@ <button @click=${(ev: Event) => this.mapThisToHw(page.uri)}>Map this to hw</button> `} </legend> - ${page.faders.map((fd) => html` <light9-effect-fader .uri=${fd}></light9-effect-fader> `)} + ${page.faders.map((fd) => html` <light9-effect-fader .uri=${fd.uri}></light9-effect-fader> `)} </fieldset> </div>`; } @@ -86,11 +90,11 @@ const fp = new FadePage(page as NamedNode); try { for (let fader of this.graph.objects(page, U(":fader"))) { - fp.faders.push(fader as NamedNode); + const colLit = this.graph.stringValue(fader, U(':column')) + fp.faders.push(new FaderConfig(fader as NamedNode, parseFloat(colLit))); } fp.faders.sort((a, b) => { - // todo this is supposed to sort by :column so you can reorder - return a.value.localeCompare(b.value); + return a.column-(b.column); }); fadePages.pages.push(fp); } catch (e) {}