Refactor anti-patterns: zoom constant, setRange(), and recordTrackPoint() - #71
Merged
Merged
Conversation
…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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.1fields.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
recordPointcallback inits options type; VideoPlayerNode wires it to model.recordTrackPoint().
https://claude.ai/code/session_015RyaayM2oq4T59EQKjycRW