Skip to content

Refactor anti-patterns: zoom constant, setRange(), and recordTrackPoint() - #71

Merged
veillette merged 1 commit into
mainfrom
claude/refactor-anti-patterns-brjY8
Feb 28, 2026
Merged

Refactor anti-patterns: zoom constant, setRange(), and recordTrackPoint()#71
veillette merged 1 commit into
mainfrom
claude/refactor-anti-patterns-brjY8

Conversation

@veillette

Copy link
Copy Markdown
Collaborator

3.2 – Duplicate zoom factor constant
Add GRAPH_ZOOM_FACTOR = 1.1 to TrackLabConstants.ts and import it in
AxisGestureHandler and ZoomGestureHandler, removing the two local
private readonly zoomFactor = 1.1 fields.

3.1 + 4.2 – Shotgun surgery / direct chartTransform mutations
Add GraphDataManager.setRange(xRange, yRange) that atomically sets
isManuallyZoomed, applies both ranges to chartTransform, and updates
tick spacing. All gesture handlers (Axis, Pan, Zoom) now call this
single method instead of individually calling setModelXRange/YRange,
updateTickSpacing, and setManuallyZoomed(true). The seven scattered
setManuallyZoomed(true) call-sites and the duplicate updateTickSpacing
calls are removed.

3.3 – Feature envy: DigitizingOverlayNode reaching into sub-models
Add SimModel.recordTrackPoint(trackId, pixelPoint) to encapsulate the
frame-from-time and model-coordinate computations that previously lived
in DigitizingOverlayNode's FireListener. The view now passes raw inputs
(track id + pixel position) and the model coordinates all sub-model
interactions. DigitizingOverlayNode gains a recordPoint callback in
its options type; VideoPlayerNode wires it to model.recordTrackPoint().

https://claude.ai/code/session_015RyaayM2oq4T59EQKjycRW

…nt()

3.2 – Duplicate zoom factor constant
  Add GRAPH_ZOOM_FACTOR = 1.1 to TrackLabConstants.ts and import it in
  AxisGestureHandler and ZoomGestureHandler, removing the two local
  `private readonly zoomFactor = 1.1` fields.

3.1 + 4.2 – Shotgun surgery / direct chartTransform mutations
  Add GraphDataManager.setRange(xRange, yRange) that atomically sets
  isManuallyZoomed, applies both ranges to chartTransform, and updates
  tick spacing. All gesture handlers (Axis, Pan, Zoom) now call this
  single method instead of individually calling setModelXRange/YRange,
  updateTickSpacing, and setManuallyZoomed(true). The seven scattered
  setManuallyZoomed(true) call-sites and the duplicate updateTickSpacing
  calls are removed.

3.3 – Feature envy: DigitizingOverlayNode reaching into sub-models
  Add SimModel.recordTrackPoint(trackId, pixelPoint) to encapsulate the
  frame-from-time and model-coordinate computations that previously lived
  in DigitizingOverlayNode's FireListener. The view now passes raw inputs
  (track id + pixel position) and the model coordinates all sub-model
  interactions. DigitizingOverlayNode gains a `recordPoint` callback in
  its options type; VideoPlayerNode wires it to model.recordTrackPoint().

https://claude.ai/code/session_015RyaayM2oq4T59EQKjycRW
@veillette
veillette merged commit b015967 into main Feb 28, 2026
1 check passed
@veillette
veillette deleted the claude/refactor-anti-patterns-brjY8 branch March 1, 2026 01:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants