# HG changeset patch # User drewp@bigasterisk.com # Date 2023-05-30 06:08:55 # Node ID 1281b46778623b3f833a826ee95412687e4d7cb7 # Parent e9239995eb577ceb07a4413e2aa5abe3b6a10ff1 dead code diff --git a/light9/live/GraphToControls.ts b/light9/live/GraphToControls.ts deleted file mode 100644 --- a/light9/live/GraphToControls.ts +++ /dev/null @@ -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, 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); -// } -// }