Skip to content

Milestone 4: Hits Manager

Timeline: Jan 8, 2025 | Status: done

Goal

Borrow and deploy the hits manager from ws (webseriously) to di.

What Emerged

(add this when complete)

Our Work

Review ws implementation

  • [x] src/lib/ts/managers/Hits.ts — main manager (RBush spatial index, click handling)
  • [x] src/lib/ts/state/S_Hit_Target.ts — hit target class
  • [x] src/lib/ts/signals/Mouse_Timer.ts — timer for long-click, double-click, autorepeat

Identify what di already has

  • [x] S_Mouse — identical to ws ✓
  • [x] T_Hit_Target enum ✓
  • [x] T_Mouse_Detection enum ✓
  • [x] T_Drag enum ✓
  • [x] Constants.threshold (autorepeat, double_click, long_click) ✓
  • [x] Point, Rect types ✓

Dependencies to add

  • [x] Install rbush package (yarn add rbush @types/rbush)
  • [x] Create src/lib/ts/signals/Mouse_Timer.ts
  • [x] Create src/lib/ts/state/S_Hit_Target.ts
  • [x] Create src/lib/ts/managers/Hits.ts
  • [x] Add asBBox to Point and Rect in Coordinates.ts
  • [x] Create src/lib/ts/signals/Events.ts (mouse event handlers)
  • [x] Create src/lib/ts/state/S_Component.ts
  • [x] Create src/lib/ts/managers/Components.ts

Simplifications for di

  • [x] Remove ws-specific: radial, controls, ancestry, colors references
  • [x] Remove ring/paging/widget-specific logic (not needed yet)
  • [x] Keep: RBush indexing, hover detection, click/long-click/double-click handling

Integration

  • [x] Add hits export to common imports
  • [x] Create src/lib/ts/signals/Events.ts (mouse event handlers)
  • [x] Call e.setup() on app init (Main.svelte onMount)
  • [x] Make graph an S_Component hit target
  • [x] Add hover reaction (background turns white)
  • [x] Fix: clear hover on mouseleave and recalibrate on resize
  • [x] Test hover detection
  • [x] Test click handling

Deploy

Artifacts

(add links when complete)