The bifocal display system has been successfully implemented as the default navigation mechanism for the TimeArcs visualization. It is always enabled and starts with a full overview, allowing users to directly manipulate the timeline via drag handles.
Core transform module with:
bifocalTransform()- Maps normalized time [0,1] to screen position [0,1]bifocalInverse()- Inverse transform for click-to-time conversioncomputeLayoutWidths()- Calculates region widths from compression ratioupdateFocusRegion()- Updates focus with clamping and validationcreateBifocalXScale()- Compatible with xScaleLens interface
SVG drag handles module with:
- Focus region rectangle (draggable to move)
- Left/right resize handles (drag to adjust boundaries)
- Boundary indicator lines (visual guides)
- D3 drag behaviors with proper clamping
- Added
import { bifocalTransform } from './bifocal.js' - Modified
createLensXScale()to check bifocal first (priority 1) - Bifocal > Fisheye > Legacy Lens (in priority order)
Added UI controls:
- Bifocal Toggle Button -
#bifocalToggle(Shift+B shortcut) - Compression Slider -
#compressionSlider(1-10x range) - Region Indicator -
#bifocalRegionIndicator(shows focus bounds)
Major changes:
- State Variables (lines 320-328): Added
bifocalEnabled,bifocalState,bifocalHandles - DOM References (lines 42-46): Added bifocal control element references
- Imports (lines 12-13): Added bifocal and handles imports
- Event Handlers (lines 192-263):
- Compression slider handler
- Bifocal toggle button handler
- Button state management functions
- Keyboard shortcuts (Shift+B, Arrow keys)
- Scale Creation (lines 1205-1206): Added bifocal getters to
createLensXScale() - Visualization Update (lines 3622-3715): Created
updateBifocalVisualization() - Handles Creation (lines 3717-3728): Initialize bifocal drag handles
✅ Three-region timeline (left context, focus, right context) ✅ Sharp transitions (no smooth distortion like fisheye) ✅ Monotonicity preservation (temporal ordering maintained) ✅ Compression ratio control (1-10x via slider)
✅ Always-on by default - starts with full overview (focus = entire timeline) ✅ Draggable focus region (move entire region left/right) ✅ Resize handles (adjust left/right boundaries independently) ✅ Keyboard navigation:
- Arrow Left/Right: Move focus region (Shift for large steps)
- Arrow Up/Down: Expand/contract focus region ✅ Visual indicators (boundary lines, region percentage display) ✅ Compression slider for adjusting context detail (1-10x)
✅ Compatible with existing xScaleLens interface ✅ Mutual exclusion with fisheye (only one active at a time) ✅ Transitions all visual elements smoothly (250ms) ✅ Updates arcs, rows, labels, gradients, and axis ticks
Bifocal display is always active - no toggle required. The timeline starts in full overview mode (focus = entire timeline). Simply drag handles to zoom into areas of interest.
- Drag center: Move entire focus region
- Drag left handle: Adjust left boundary
- Drag right handle: Adjust right boundary
- Arrow Left/Right: Move region (keyboard)
- Arrow Up/Down: Expand/contract region (keyboard)
- Blue dashed rectangle shows focus region
- Vertical dashed lines show boundaries
- Indicator displays focus percentage (e.g., "Focus: 35% - 65%")
- Arcs render correctly in all three regions
- Row lines span correctly across regions
- Gradients update at region boundaries
- Time axis ticks positioned correctly
- Left handle resizes from left
- Right handle resizes from right
- Center region moves left/right
- Minimum focus width enforced (5%)
- Handles don't cross boundaries
- Shift+B toggles bifocal mode
- Arrow keys move/resize focus
- Shift modifier increases step size
- Fisheye disabled when bifocal enabled
- Bifocal disabled when fisheye enabled
- Compression slider updates visualization
- Smooth transitions (250ms)
- Always Available: No mode switching - direct manipulation from the start
- Starts with Overview: Full timeline visible initially, zoom in as needed
- Predictable: Sharp transitions, no continuous position shifting
- Readable Context: Compressed but not distorted
- Better for Comparison: Clear focus region boundaries
- Intuitive Control: Drag handles vs. mode toggle + mouse tracking
- Keyboard Navigation: Arrow keys for precise adjustment
- Progressive Disclosure: Handles show interaction is available
- Remove fisheye code after bifocal is validated
- Add preset focus positions (e.g., "Attack Event 1", "Attack Event 2")
- Integrate with ground truth events (auto-focus on attack times)
- Add focus region bookmarks/history
- Sync with other views (if multi-view layout is added)