Split Canvas and PivotCanvas into focused hooks and share one classNames helper - #377
Merged
Merged
Conversation
Wheel pan, Ctrl+wheel zoom toward the pointer, the zoom controls, a background drag, the imperative handle and measured item bounds, asserted through onTransformChange. A planted change to the wheel zoom intensity fails it.
Canvas.tsx keeps its props contract and composes useLatestRef, useCanvasItemRegistry, usePixiApplication, useCanvasCamera, useCanvasWheelZoom, useCanvasPointerGestures, usePixiItems and useCanvasNavigation, called in the original order so effects run as before. The exported types move to their own files and are re-exported from Canvas.tsx. The write-only itemsRef is removed. The camera story test, the Canvas specs and the API surface snapshot are unchanged.
PivotCanvas composes usePivotStage (Pixi init, canvas overlay, resize), usePivotCardColors, usePivotGroupBackgrounds, usePivotSpriteSync, usePivotSelectionHighlight and usePivotScrollSync in the original effect order. Dead code is removed: the never-assigned spacer ref and its branch, commented-out listeners and camera effect, unused helpers kept alive with void, and a write-only scroll record. onPanStartRef now follows the latest onPanStart like the other callback refs; the only caller's callback is already stable, so nothing changes today. Rendered pixels in collection view, grouped view and after scrolling match the previous implementation.
Thirteen components and the DataTables modules each defined the same class-joining helper. Common/classNames.ts replaces them, accepts false as ComboBox's copy did, and is registered as a kernel module since it is pure.
Per-area stylesheets follow the source directories a subpath reaches, so importing a pure helper from Common/ pulled Common's CSS into the Chat and TimeMachine areas and broke their budgets. The helper now lives in its own CSS-free ClassNames/ folder, as QueryStatus/ does for its helper.
CanvasItemRegistryEntry moved to its own declaration file, which the build does not rewrite. CanvasProps is still declared in the rewritten Canvas.d.ts, so the check keeps testing navigation through a rewritten declaration.
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.
CanvasandPivotCanvas, the two largest components, are split into focused hooks, and one sharedclassNameshelper replaces fourteen copies. Nothing a consumer can observe changes, so this PR publishes nothing.Changed
Canvas.tsx(1334 lines) is split into these hooks, called in the original effect order:PivotCanvas.tsx(882 lines) is split into stage, color, group background, sprite sync, selection and scroll sync hooks, and its dead code is removed.ClassNames/classNames.tsreplaces the local copies. It sits in its own CSS-free folder so it does not add another area's stylesheet to the per-area CSS.Closes #376.