Window curvature: the press contract documented once

- docs/window-curvature.md holds the full contract (now also: the next
  press starts at 1x, return values, a drag keeps its value, neither side
  restores the other's state); the patch headers of window-curvature and
  frame-controls point to it and keep only their own side.
- frame-controls header: the localStorage history points to
  docs/ui-patches.md#persistent-state.
Comments only, no VERSION bumps.
This commit is contained in:
Pierre Kisters committed 2026-10-01 04:09:13 +02:00
1 parent c2427b4e20
commit df501a169b
3 files changed
+33 -48

No files matched your search

+7 -13
View File
@@ -28,25 +28,19 @@
// re-patch and unpatch), saved on every change through the injector's
// persistent store (window.__sfuiStore, patch registered with state = true:
// ~/.local/state/steam-frame-nix/ui-patches/frame-controls.json), which
// seeds a fresh page (SteamVR restart, reboot, reload). localStorage can't
// do that: steamvr.service deletes ~/.cache/SteamVR (vrwebhelper's profile)
// on every start (which also took version 4's localStorage copy with it).
// seeds a fresh page (SteamVR restart, reboot, reload; localStorage doesn't
// survive SteamVR starts, see docs/ui-patches.md#persistent-state).
//
// Long press: the dashboard only gets primary-button laser input (no right
// click; thumbstick click arrives as nothing). Holding changes nothing; the
// timer survives the laser leaving the control, an early release cancels it.
// On completion the popup opens and the next click on that control is
// swallowed so its stock action doesn't run.
// Contract with window-curvature (whose controls own press-and-drag): its
// elements carry class sfui-curv-ctl; a drag there dispatches a bubbling
// CustomEvent 'sfui-curv-dragstart', which cancels the long press (a drag
// always wins). When the ring shows, the press's drag threshold is raised to
// CURV_RING_THRESHOLD x its own via
// window.__sfuiWindowCurvature.scalePressDragThreshold(), still measured from
// the press start: laser drift keeps the long press, a deliberate drag still
// cancels it. On completion the long press takes the press over via
// cancelPress() (no curvature click on release). Neither reads the other's
// thresholds.
// With window-curvature (docs/window-curvature.md#contract-for-other-patches):
// 'sfui-curv-dragstart' cancels the long press (a drag always wins); when the
// ring shows, scalePressDragThreshold(CURV_RING_THRESHOLD) lets laser drift
// keep the long press; on completion cancelPress() takes the press over (no
// curvature click on release).
//
// Popup: its own scene-graph panel so the bar/menu panels don't change. The
// dashboard builds its scene graph from the DOM (vsg-transform attributes,
+6 -22
View File
@@ -44,27 +44,12 @@
// Sliding per step (at most every 30 ms). During a drag the dashboard's own
// haptics (hover clicks on buttons the laser passes) are muted.
//
// Contract with other patches (e.g. frame-controls' long press); this patch
// owns press-and-drag on its controls:
// - Every element it drives has the class `sfui-curv-ctl`.
// - When a press becomes a drag (opts.dragThresholdPixels px vertical from
// where the press started) it dispatches a bubbling CustomEvent
// `sfui-curv-dragstart` on the element (detail { frameID, where: 'menu' |
// 'bar' }); when that drag ends (release or cancelPress),
// `sfui-curv-dragend`.
// - window.__sfuiWindowCurvature.scalePressDragThreshold(factor) sets the
// current press's threshold to factor x opts.dragThresholdPixels, still
// measured from the press start, so small laser drift doesn't start a
// drag while a deliberate one still does; returns whether it applied
// (a press that is not yet a drag). The next press starts at 1x.
// - window.__sfuiWindowCurvature.cancelPress() ends the current press
// without its click (a drag keeps its value); returns whether a press
// was active.
// A patch with its own gesture on these elements lets mousemove through while
// undecided, drops its gesture on `sfui-curv-dragstart`, may raise the
// threshold with scalePressDragThreshold() while its gesture is under way,
// and calls cancelPress() when it takes the press over. Neither side reads
// the other's thresholds or restores the other's state.
// Contract with other patches (e.g. frame-controls' long press), documented
// in docs/window-curvature.md#contract-for-other-patches: this patch owns
// press-and-drag on its controls (class sfui-curv-ctl), dispatches
// sfui-curv-dragstart / sfui-curv-dragend, and offers
// scalePressDragThreshold(factor) and cancelPress() on
// window.__sfuiWindowCurvature.
//
// Debugging: window.__sfuiWindowCurvature: dump(), hits (rewrite/haptic
// counters), log, setValue(frameID, v), controls(), cancelPress(),
@@ -346,7 +331,6 @@ ${ROW}:last-child > .sfui-curv-ind { margin-bottom: -14px; }
} catch (e) { log(`${type} listener failed`, String(e)); }
};
const onMove = (e) => {
const p = press;
if (!p) return;