Changeset - d665acb12046
[Not reviewed]
default
0 2 0
drewp@bigasterisk.com - 20 months ago 2023-05-23 20:58:26
drewp@bigasterisk.com
cleanup
2 files changed with 12 insertions and 18 deletions:
0 comments (0 inline, 0 general)
light9/fade/web/Light9FadeUi.ts
Show inline comments
 
@@ -109,28 +109,27 @@ export class Light9Fader extends LitElem
 
    super();
 
    getTopGraph().then((g) => {
 
      this.graph = g;
 
      this.graph.runHandler(this.configure.bind(this), `config ${this.uri.value}`);
 
      this.graph.runHandler(this.valueSync.bind(this), `valueSync ${this.uri.value}`);
 
      this.graph.runHandler(this.compile.bind(this), `config ${this.uri.value}`);
 
      this.graph.runHandler(this.compileValue.bind(this), `valueSync ${this.uri.value}`);
 
    });
 
  }
 

	
 
  configure() {
 
    //   console.time(`fader configure ${this.uri.value}`)
 
  private compile() {
 
    const U = this.graph.U();
 
    if (!this.graph.contains(this.uri, U("rdf:type"), U(":Fader"))) {
 
      // not loaded yet
 
      //   console.timeEnd(`fader configure ${this.uri.value}`)
 

	
 
      // not loaded yet, perhaps
 
      this.column = "unset";
 
      this.effect = null;
 
      this.effectAttr = null;
 
      return;
 
    }
 
    this.column = this.graph.stringValue(this.uri, U(":column"));
 
    this.effect = this.graph.uriValue(this.uri, U(":effectClass"));
 
    this.effectAttr = this.graph.uriValue(this.uri, U(":effectAttr"));
 
    // console.timeEnd(`fader configure ${this.uri.value}`)
 
    this.effect = this.graph.uriValue(this.uri, U(":effect"));
 
    const s = this.graph.uriValue(this.uri, U(":setting"));
 
    this.effectAttr = this.graph.uriValue(s, U(":effectAttr"));
 
  }
 

	
 
  valueSync() {
 
    // console.time(`valueSync ${this.uri.value}`)
 
  private compileValue() {
 
    const U = this.graph.U();
 
    if (!this.graph.contains(this.uri, U("rdf:type"), U(":Fader"))) {
 
      // not loaded yet
 
@@ -139,7 +138,6 @@ export class Light9Fader extends LitElem
 
    }
 

	
 
    this.value = this.graph.floatValue(this.uri, this.graph.Uri(":value"));
 
    // console.timeEnd(`valueSync ${this.uri.value}`)
 
  }
 

	
 
  onSliderInput(ev: CustomEvent) {
 
@@ -149,13 +147,12 @@ export class Light9Fader extends LitElem
 
    if (this.value == prev) {
 
      return;
 
    }
 
    log(`new value ${this.value}`);
 
    meter.tick();
 
    this.graph.patchObject(this.uri, this.graph.Uri(":value"), this.graph.LiteralRoundedFloat(this.value), this.ctx);
 
  }
 

	
 
  onEffectChange(ev: CustomEvent) {
 
    const { newValue } = ev.detail;
 
    this.graph.patchObject(this.uri, this.graph.Uri(":effectClass"), newValue, this.ctx);
 
    this.graph.patchObject(this.uri, this.graph.Uri(":effect"), newValue, this.ctx);
 
  }
 
}
light9/typedgraph.py
Show inline comments
 
@@ -33,9 +33,6 @@ def _typeIncludes(t1: Type, t2: Type) ->
 
    ts = _expandUnion(t1)
 
    if len(ts) > 1:
 
        return any(_typeIncludes(t, t2) for t in ts)
 
    # if t1 is float:
 
    #     return float in get_args(t2)
 
    print(f'down to {t1} {t2}')
 

	
 
    return False
 

	
0 comments (0 inline, 0 general)