changeset 2291:1281b4677862

dead code
author drewp@bigasterisk.com
date Mon, 29 May 2023 23:08:55 -0700
parents e9239995eb57
children 0a11698fecc4
files light9/live/GraphToControls.ts
diffstat 1 files changed, 0 insertions(+), 96 deletions(-) [+]
line wrap: on
line diff
--- a/light9/live/GraphToControls.ts	Mon May 29 23:08:15 2023 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,96 +0,0 @@
-// import debug from "debug";
-// import { NamedNode } from "n3";
-// import { SyncedGraph } from "../web/SyncedGraph";
-// import { ControlValue, Effect } from "./Effect";
-// const log = debug("g2c");
-
-// // Callback for GraphToControls to set a ControlValue on a
-// // Light9LiveControl (widget for a Device+Attr)
-// type NewValueCb = (newValue: ControlValue | null) => void;
-
-// // More efficient bridge between liveControl widgets and graph edits (inside Effect),
-// // as opposed to letting each widget scan the graph and push lots of
-// // tiny patches to it.
-// //
-// // When you create a Light9LiveControl, it registers with GraphToControls (and does not
-// // watch value updates from the graph).
-// export class GraphToControls {
-//   // rename to PageControls?
-//   private effect: Effect | null = null; // this uri should sync to the editchoice
-
-//   // This will fill with every device+attr in the show. Currently there's no unregister to forget a device or attr.
-//   private registeredWidgets: Map<
-//     NamedNode /*Device*/,
-//     Map<
-//       NamedNode /*DeviceAttr*/, //
-//       NewValueCb
-//     >
-//   > = new Map();
-//   constructor(public graph: SyncedGraph) {
-    
-//   }
-
-//   debugDump() {
-//     log("dump: effect", this.effect);
-//     log("registered widgets");
-//     for (let e of this.registeredWidgets.entries()) {
-//       log(" rw:", e[0], e[1]);
-//     }
-//   }
-
-//   setEffect(effect: NamedNode | null) {
-//     log(`setEffect ${effect?.value}`);
-//     this.effect = effect ? new Effect(this.graph, effect, this.onValuesChanged.bind(this)) : null;
-//   }
-
-//   newEffect(): NamedNode {
-//     // wrong- this should be our editor's scratch effect, promoted to a
-//     // real one when you name it.
-//     const uri = this.graph.nextNumberedResource(this.graph.Uri("http://light9.bigasterisk.com/effect/effect"));
-
-//     this.effect = new Effect(this.graph, uri, this.onValuesChanged.bind(this));
-//     log("add new eff");
-//     this.effect.addNewEffectToGraph();
-//     return this.effect.uri;
-//   }
-
-//   emptyEffect() {
-//     throw new Error("not implemented");
-//   }
-
-//   private onValuesChanged() {
-//     log(`i learned values changed for ${this.effect?.uri.value} `);
-//     this.registeredWidgets.forEach((d1: Map<NamedNode, NewValueCb>, device: NamedNode) => {
-//       d1.forEach((cb: NewValueCb, deviceAttr: NamedNode) => {
-//         const v = this.effect ? this.effect.currentValue(device, deviceAttr) : null;
-//         cb(v);
-//       });
-//     });
-//   }
-
-//   register(device: NamedNode, deviceAttr: NamedNode, graphValueChanged: NewValueCb) {
-//     // log(`control for ${device.value}-${deviceAttr.value} registring with g2c`);
-//     let d1 = this.registeredWidgets.get(device);
-//     if (!d1) {
-//       d1 = new Map();
-//       this.registeredWidgets.set(device, d1);
-//     }
-//     d1.set(deviceAttr, graphValueChanged);
-
-//     if (this.effect) {
-//       const nv = this.effect.currentValue(device, deviceAttr);
-//       // log(`i have a a cb for ${device.value}-${deviceAttr.value}; start value is ${nv}`);
-//       graphValueChanged(nv);
-//     }
-//   }
-
-//   controlChanged(device: NamedNode, deviceAttr: NamedNode, value: ControlValue) {
-//     // todo: controls should be disabled if there's no effect and they won't do anything.
-//     if (!this.effect) {
-//       log("controlChanged, no effect");
-//       return;
-//     }
-//     const p = this.effect.edit(device, deviceAttr, value);
-//     this.graph.applyAndSendPatch(p);
-//   }
-// }