diff --git a/light9/fade/Light9FadeUi.ts b/light9/fade/Light9FadeUi.ts --- a/light9/fade/Light9FadeUi.ts +++ b/light9/fade/Light9FadeUi.ts @@ -29,6 +29,9 @@ export class Light9FadeUi extends LitEle display: block; user-select: none; /* really this is only desirable during slider drag events */ } + .mappedToHw { + background: #393945; + } `, ]; render() { @@ -37,15 +40,22 @@ export class Light9FadeUi extends LitEle

Fade

- ${(this.fadePages?.pages || []).map(this.renderPage)} + ${(this.fadePages?.pages || []).map(this.renderPage.bind(this))}
`; } private renderPage(page: FadePage): TemplateResult { - return html`
+ const mappedToHw = this.currentHwPage !== undefined && page.uri.equals(this.currentHwPage); + return html`
- Page + + Page + + ${mappedToHw ? html`mapped to hardware sliders` : html` + + `} + ${page.faders.map((fd) => html` `)}
`; @@ -55,6 +65,7 @@ export class Light9FadeUi extends LitEle ctx: NamedNode = new NamedNode(showRoot + "/fade"); @property() fadePages?: FadePages; + @property() currentHwPage?: NamedNode; constructor() { super(); @@ -88,6 +99,18 @@ export class Light9FadeUi extends LitEle return a.uri.value.localeCompare(b.uri.value); }); this.fadePages = fadePages; + this.currentHwPage = undefined; + try { + const mc = this.graph.uriValue(U(":midiControl"), U(":map")); + this.currentHwPage = this.graph.uriValue(mc, U(":outputs")); + } catch (e) {} + } + + mapThisToHw(page: NamedNode) { + const U = this.graph.U(); + log("map to hw", page); + const mc = this.graph.uriValue(U(":midiControl"), U(":map")); + this.graph.patchObject(mc, U(":outputs"), page, this.ctx); } addPage() {