(null)
+
+ useFrame(() => {
+ if (itemObj) return
+ const obj = sceneRegistry.nodes.get(nodeId)
+ if (obj) setItemObj(obj)
+ })
+
+ const controlValues = useInteractive(useShallow((state) => state.items[nodeId]?.controlValues))
+ const setControlValue = useInteractive((state) => state.setControlValue)
+
+ if (!itemObj || !controlValues || !node?.asset.interactive) return null
+
+ const { controls } = node.asset.interactive
+ const [, height] = node.asset.dimensions
+
+
+ return createPortal(
+
+
+ {controls.map((control, i) => (
+ setControlValue(nodeId, i, v)}
+ />
+ ))}
+
+ ,
+ itemObj,
+ )
+}
+
+// ---- Control widgets ----
+
+const ControlWidget = ({
+ control,
+ value,
+ onChange,
+}: {
+ control: Control
+ value: ControlValue
+ onChange: (v: ControlValue) => void
+}) => {
+ const labelStyle: React.CSSProperties = {
+ color: 'white',
+ fontSize: 11,
+ fontFamily: 'monospace',
+ display: 'flex',
+ flexDirection: 'column',
+ gap: 2,
+ }
+
+ if (control.kind === 'toggle') {
+ return (
+
+ )
+ }
+
+ if (control.kind === 'slider') {
+ return (
+
+ )
+ }
+
+ if (control.kind === 'temperature') {
+ return (
+
+ )
+ }
+
+ return null
+}