Fix/bubble dpr position and relayout selection#3
Merged
Conversation
Dragging the window to a monitor with a different device-pixel-ratio left bubble groups (and the heatmap field) misaligned until a sidebar toggle forced a resize. Root cause: a monitor move changes window.devicePixelRatio without changing the container's CSS box, so sigma.resize() refreshes its pixelRatio but early-returns before re-sizing any canvas — the WebGL layers stay at the old backing resolution while the overlays repaint at the new ratio. The overlay canvases also never had an explicit CSS display size (createCanvasContext sets only position:absolute), so at >1 DPR they rendered at their backing- store size (width*dpr px) instead of the logical viewport. - add watchDevicePixelRatio (dpr_watch.js): on every DPR change force sigma.resize(true) + re-render, re-sizing all canvases to the new ratio (the same recovery a sidebar toggle triggered manually) - bubble_layer/heatmap_layer #prepareCanvas now own the CSS display size, keeping each overlay 1:1 with the WebGL layers regardless of resize timing - tests for the watcher, the A->B monitor-move sequence, and DPR-1/2 sizing
All six Arrange Selection tools (shrink/expand/circle/force/grid/random) were silent no-ops: layoutSelectedNodes persisted positions before pushing them to the graph, and persistNodePositions reads via getNodeData(), which re-syncs nodeRef.style from graphology — clobbering the freshly computed coordinates back to their pre-layout values before they ever reached the renderer. Push to the graph first, then persist. Replace the hand-rolled circle/force/random geometry (incl. a ~90-line force sim that clamped toward world-origin instead of the selection centroid) with layoutSelectionSubgraph(): run graphology circular/ forceAtlas2/random on a throwaway subgraph of the selection and recenter on the original centroid. Grid stays manual (no graphology grid) and shrink/expand stay as centroid scaling. Rewrite the regression test with a faithful adapter mock (backing store synced into refs by getNodeData) so it reproduces the clobbering bug; verified it fails on the old persist-before-push order.
Patch release covering the two bug fixes since v1.15.0: - Arrange Selection tools no longer silent no-ops - bubble/heatmap overlays stay aligned across DPR changes
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.
No description provided.