Skip to content

Plan viewer: minimap resize, double-click zoom and coloured edges (#4580) - #4603

Merged
erikdarlingdata merged 3 commits into
devfrom
viewer/4580-minimap-part2
Sep 28, 2026
Merged

erikdarlingdata merged 3 commits into
devfrom
viewer/4580-minimap-part2

Conversation

@erikdarlingdata

@erikdarlingdata erikdarlingdata commented Sep 28, 2026 •

Copy link
Copy Markdown
Owner

Fixes #4580. Builds on #4596. Part of #4511.

Why

Part 1 (#4596) added the plan viewer's minimap panel but left three items for this pass, per PerformanceStudio's PlanViewerControl.Minimap.cs: a resizable panel with its size remembered across plans, double-click on a minimap node to zoom and select it, and accuracy-ratio coloured minimap edges (using the PlanEdgeColour helper from #4586, which is already on dev).

What changes

  • The minimap panel gets a header with a resize grip (top-left corner, since the panel is pinned bottom-right) and a close button. Dragging the grip resizes the panel between 160px and 500px on each axis, matching PerformanceStudio's bounds. The size is kept in a field that survives across plans and control instances (a static field, mirroring PerformanceStudio), so reopening the minimap on a different plan keeps the size the user last set.
  • Double-clicking a node in the minimap zooms the main canvas so that node takes about a third of the viewport, scrolls to center it, and selects it (same as clicking it directly on the main canvas). A single click anywhere in the minimap still centers the viewport there, whether or not it lands on a node.
  • Minimap edges are coloured by the same actual/estimated row-count ratio as the main canvas' edges, through the existing PlanEdgeColour helper and the same six-brush set the main canvas already defines — no new colours were introduced.
  • The pure geometry (the resize clamp, the zoom-to-node level and center offset, and node hit-testing for double-click) lives in MinimapLayout, alongside the geometry part 1 added. The WPF code-behind only wires these numbers to mouse events and the existing shapes.
  • Lite: gets this too (shared control — no separate work needed).

Test plan

Pins added to Darling/Darling.Tests/Viewer4580Tests.cs (existing file from part 1; new members are new on this branch, so the RED for them is a compile failure on part 1's b3317c250):

  • ClampPanelSize: clamps to 160-500.
  • ResizeFromDrag: subtracts the drag delta from the starting size (growing toward the pinned corner), clamped to bounds.
  • GetZoomToNodeLevel: fits a node to about a third of the viewport, clamped to the zoom range, returns the minimum zoom when the viewport or node has no size.
  • GetNodeCenterOffset: centers a node in the viewport, clamped to zero near the edges.
  • FindNodeAt: returns the node whose minimap rectangle contains a point, or null.

Runtime mutation (behavioural RED): flipped ResizeFromDrag's subtraction to addition — ResizeFromDrag_SubtractsDeltaFromStartSize_ClampedToBounds and ResizeFromDrag_ClampsBelowMinAndAboveMax both failed (Darling.Tests Total: 26, Failed: 2); reverted, rebuilt, all 26 green again.

Commands run (macOS, in-process xunit v3 runner, Microsoft.WindowsDesktop.App stripped from the runtimeconfig):

dotnet build Darling/Darling.Tests/Darling.Tests.csproj -c Release -p:EnableWindowsTargeting=true
dotnet build PerformanceMonitor.Ui/PerformanceMonitor.Ui.csproj -c Release -p:EnableWindowsTargeting=true
dotnet build Lite/PerformanceMonitorLite.csproj -c Release -p:EnableWindowsTargeting=true
dotnet build Darling/PerformanceMonitor.Darling.Viewer/PerformanceMonitor.Darling.Viewer.csproj -c Release -p:EnableWindowsTargeting=true
dotnet Darling.Tests.dll -class Darling.Tests.Viewer4580Tests \
  -class Darling.Tests.CommentFilterAdoptionTests -class Darling.Tests.DocCommentHygieneTests \
  -class Darling.Tests.EntraProviderPackageCensusTests -class Darling.Tests.DailyDeadlockWindowCensusTests \
  -class Darling.Tests.MeasurementContractCensusTests -class Darling.Tests.SameStatementPileupSourceCensusTests \
  -class Darling.Tests.FileGrowthRiseUnitCensusTests -class Darling.Tests.PgSettingScrubCandidateCensusTests \
  -class Darling.Tests.McpPayloadContractCensusTests -class Darling.Tests.RemoteCollectorServiceCancellationCensusTests \
  -class Darling.Tests.StoreSessionTimeZonePinCensusTests -class Darling.Tests.StoreApplicationNameCensusTests \
  -class Darling.Tests.MigrationDataMovingRungCensusPins -class Darling.Tests.PlanForceActionDetailCensusTests \
  -class Darling.Tests.WebExceptionTextCensusTests -class Darling.Tests.McpServiceParameterDiSeatCensusTests \
  -class Darling.Tests.ShowPlanParserCondAndMultiplePlanTests -class Darling.Tests.ActualPlanRequestTests \
  -class Darling.Tests.ActualPlanDispatchTests -class Darling.Tests.ActualPlanResultParseTests \
  -class Darling.Tests.QueryModificationDetectorTests -class Darling.Tests.ActualPlanCaptureLoopTests \
  -class Darling.Tests.ActualPlanGatingTests -class Darling.Tests.ReproScriptBuilderHardeningTests \
  -class Darling.Tests.DarlingAnalysisPipelineTests -class Darling.Tests.DarlingMcpPlanToolsSurfaceAndSqlTests \
  -class Darling.Tests.DarlingMcpPlanToolsLivePostgresTests -class Darling.Tests.McpPlanAnalysisEnvelopeTests \
  -class Darling.Tests.SerialLoopStoreSizeSourceTests -class Darling.Tests.TsqlConventionGuardTests

Result: Darling.Tests Total: 530, Errors: 0, Failed: 0, Skipped: 3.

All four builds (Darling.Tests, PerformanceMonitor.Ui, Lite, the Darling Viewer) are Release, -p:EnableWindowsTargeting=true, 0 warnings on every log.

Not run (WPF-dependent, platform reasons): all Viewer* classes that reference PresentationFramework types fail to run on macOS for that reason alone; CI decides them.

Screenshot plan (both hosts, since the control is shared): open a large multi-branch plan with some misestimated operators. Click "Minimap" — the panel appears with the same overview as part 1. Drag the resize grip in the panel's top-left corner and confirm it grows/shrinks between roughly 160px and 500px, re-rendering live; close and reopen the minimap (or load a different plan) and confirm the panel keeps the size you last set. Double-click a minimap node and confirm the main canvas zooms in on it, centers it, and selects it (its properties panel updates). Confirm minimap edges below a misestimated operator pick up the same orange/red (underestimated) or blue (overestimated) tint the main canvas shows for that same edge, instead of the plain neutral colour.

CHANGELOG

SECTION: Changed
ENTRY: - Plan viewer minimap: resize, double-click zoom, and accuracy-coloured edges ([#4603]) - The plan viewer's minimap panel can now be resized and remembers its size across plans, double-clicking a minimap node zooms to and selects it, and minimap edges pick up the same over/underestimate colouring as the main canvas.
REF: [#4603]: #4603

Ports PerformanceStudio's plan minimap core: a toggle button that opens
a corner panel over the plan canvas, a scaled-down view of the whole
plan (translucent per-root-child subtree backgrounds in an 8-color
cycle, small per-node rectangles with the expensive-node tint and
operator icon, elbow connectors), a viewport box that tracks the main
scroll viewer's scroll/zoom, and click-to-center.

The math (scale, node/subtree rectangles, viewport rectangle, click-to-
offset) lives in a new pure PerformanceMonitor.PlanAnalysis.MinimapLayout,
pinned in Darling.Tests.Viewer4580Tests.

Resize/persist, double-click zoom+select, and accuracy-colored minimap
edges are left for a follow-up; minimap edges use the neutral edge
color for now.
)

Ports the minimap's remaining PerformanceStudio behaviour: a resizable panel (160-500px, size remembered across plans), double-click on a minimap node to zoom and select it, and accuracy-ratio coloured minimap edges reusing the main canvas' PlanEdgeColour helper.
# Conflicts:
#	Darling/Darling.Tests/Viewer4580Tests.cs
#	PerformanceMonitor.PlanAnalysis/MinimapLayout.cs
#	PerformanceMonitor.Ui/PlanViewerControl.Minimap.cs
#	PerformanceMonitor.Ui/PlanViewerControl.xaml
@erikdarlingdata
erikdarlingdata marked this pull request as ready for review September 28, 2026 16:25
@erikdarlingdata
erikdarlingdata merged commit e7d90a2 into dev Sep 28, 2026
15 of 16 checks passed
@erikdarlingdata
erikdarlingdata deleted the viewer/4580-minimap-part2 branch September 28, 2026 16:25
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.

1 participant