Skip to content

Commit 7f3a9cf

Browse files
committed
fix: repair DockDebugOverlay HUD layout and drag diagnostics
Restore DockDebugOverlay as a managed pref-sized overlay panel so the HUD background renders correctly and the panel is no longer clipped in the top-left corner when mounted as a StackPane overlay. Refresh HUD text from the active drag service while attached to a scene so target/zone diagnostics follow in-place DockDragData mutations instead of remaining stuck at one, and show dock-node titles for DockNode targets. Keep the MainDemo HUD as a local debug-toggle option (no default-on requirement), add DockDebugOverlay regression coverage for layout/diagnostics behavior, and update status/roadmap/done/changelog docs plus current test counts.
1 parent 838a1bf commit 7f3a9cf

8 files changed

Lines changed: 224 additions & 30 deletions

File tree

CHANGELOG.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,17 @@ The changelog is grouped by release tags (`vX.Y.Z`) and includes an `Unreleased`
66

77
## Unreleased
88

9+
### Build and Test
10+
- ✅ Added `DockDebugOverlayTest` coverage for HUD layout defaults (managed pref-sized panel + background presence) and live target/zone diagnostics refresh when drag data mutates in place.
11+
12+
### Framework and UI
13+
- ✅ Fixed `DockDebugOverlay` HUD rendering and diagnostics behavior used by MainDemo debugging: the HUD panel now lays out correctly with visible background (no top-left clipping), and target/zone text updates live during active drags instead of staying at `none`.
14+
- ✅ Improved `DockDebugOverlay` target diagnostics text to show the dragged hover target dock-node title for `DockNode` targets (instead of the generic `DockNode` type label).
15+
- ✅ Kept the MainDemo `DockDebugOverlay` HUD as a local debug-toggle option after the overlay fixes (no default-on requirement).
16+
17+
### Documentation
18+
- ✅ Updated roadmap/status/done docs to mark the `DockDebugOverlay` HUD fixes follow-up as completed (while noting the MainDemo HUD remains opt-in) and return current priority focus to the Phase 3 UX backlog.
19+
920
## v0.4.0 - 2026-02-25
1021

1122
### Build and Test

DONE.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ SnapFX has been fully implemented with core functionality and is production-read
8888
-`EditorCloseDecisionPolicyTest` (5 tests) - Deterministic close-decision behavior for dirty editor nodes
8989
-`MarkdownDocumentationConsistencyTest` (12 tests) - Documentation consistency guardrails
9090
- ✅ CI flake guard for critical interaction suites (`SnapFXTest`, `DockFloatingWindowTest`, `DockDragServiceTest`) runs 3x per CI execution
91-
- ✅ All tests passing (313/313) ✅
91+
- ✅ All tests passing (314/314) ✅
9292
-**Testing Policy** established (TESTING_POLICY.md)
9393
- ✅ Mandatory regression tests for all bug fixes
9494

@@ -181,6 +181,7 @@ SnapFX has been fully implemented with core functionality and is production-read
181181
-**Framework sidebar visual baseline**: SnapFX now renders left/right sidebar icon strips with immediate title tooltips, click-to-open overlay panels, same-icon toggle close, outside-click overlay close, and pin/unpin switching to layout-consuming side panels
182182
-**MainDemo framework-sidebar validation path**: MainDemo now uses the framework-rendered sidebar UI again (instead of the temporary demo-only strip wrapper) for Phase-C manual testing
183183
-**MainDemo D&D debug HUD temporary disable**: `DockDebugOverlay` HUD overlay is temporarily disabled in MainDemo until sidebar interaction work is completed; a post-sidebar fix/re-enable follow-up is tracked for background/clipping/data-text issues
184+
-**DockDebugOverlay HUD fixes**: `DockDebugOverlay` now renders as a managed pref-sized HUD panel again (background and top-left clipping fixed), refreshes live target/zone diagnostics during drag even when `DockDragData` mutates in place, and shows dock-node target titles in the HUD; MainDemo keeps the HUD behind a local debug toggle
184185
-**Phase-C sidebar interaction polish fixes**: Pinning now starts collapsed by default, overlay hit-testing no longer blocks sidebar interactions, and right-side unpin keeps overlay panels on the correct side
185186
-**Pinned active-icon collapse policy option**: SnapFX now exposes a configurable policy for clicking the active icon of a pinned-open sidebar panel (default collapses), and MainDemo exposes the toggle in Settings for manual UX validation
186187
-**Pinned active-icon collapse pin-preservation fix**: Collapsing a pinned-open sidebar panel via active icon now keeps the sidebar in pinned mode and reopens pinned on the next icon click
@@ -318,7 +319,7 @@ SnapFX has been fully implemented with core functionality and is production-read
318319

319320
See [ROADMAP.md](ROADMAP.md) for planned features and improvements.
320321

321-
**Current Priority**: Sidebar interaction parity (Phase 2, current scope) is complete; next focus is the `DockDebugOverlay` HUD fix/re-enable follow-up, then return to the Phase 3 user-experience backlog.
322+
**Current Priority**: Sidebar interaction parity (Phase 2, current scope) and the `DockDebugOverlay` HUD follow-up are complete; next focus returns to the Phase 3 user-experience backlog.
322323

323324
---
324325

ROADMAP.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ This roadmap lists planned work only; completed/fixed history is tracked in `CHA
4545
### 1.2 Debug & Monitoring
4646
**Priority**: 🟡 High
4747

48-
- 📋 **DockDebugOverlay HUD fix + re-enable (after sidebar Phase 2)**: Re-enable the temporary MainDemo D&D HUD after fixing missing background rendering, top-left clipping, and incorrect `none` values for target/zone text during active drags
48+
- **DockDebugOverlay HUD fixes**: Fixed missing panel background rendering (layout sizing), top-left clipping, and stale `none` target/zone diagnostics text during active drags; MainDemo HUD remains a local debug-toggle option
4949
-**MainDemo debug/settings split divider stability**: The outer demo split divider between the dock area and Debug/Settings tabs now remains stable during dock-layout rebuilds by updating a persistent left-side host container instead of replacing the split item
5050

5151
### 1.3 Testing & Quality Assurance

STATUS.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -154,12 +154,13 @@
154154
- ✅ DockDragServiceTest (8 tests) - D&D visibility, tab-hover activation, float-detach callback behavior, and ESC drag-cancel handling
155155
- ✅ DockFloatingWindowTest (31 tests) - Floating title bar controls, context menu behavior (attach/pin icons + attach action), floating-header sidebar move-menu callback forwarding, pin behavior, icon rendering/sync regression coverage, single-node float-menu policy, maximize/restore interaction behavior, scene-level drag continuity (including release/reset and non-primary guard behavior), resize-min constraints, interactive-target cursor reliability, and floating/main edge snapping behavior (including overlap-guard, adjacent-edge cases, and main-window shadow-inset compensation)
156156
- ✅ DockFloatingSnapEngineTest (6 tests) - Snap candidate scoring, overlap-aware candidate generation, and shadow-inset compensation behavior
157-
- ✅ MainDemoTest (24 tests) - Demo app icon resource wiring, menu icon behavior, sidebar menu/list helper coverage for Phase-C manual controls, sidebar settings width-control API-parity wiring (including `DockSideBarMode` settings control), debug/settings outer-split divider-stability regression coverage, demo shortcut wiring, floating snap-target settings resolution coverage, load-error message formatting, owner-aware error-alert behavior, FileChooser helper coverage for shared layout/editor chooser configuration, and named theme-catalog/resource coverage
157+
- ✅ DockDebugOverlayTest (2 tests) - HUD layout-state defaults (managed + pref-sized panel background) and live diagnostics refresh coverage for mutated drag-state updates (`Target`/`Zone` no longer stuck at `none`)
158+
- ✅ MainDemoTest (23 tests) - Demo app icon resource wiring, menu icon behavior, sidebar menu/list helper coverage for Phase-C manual controls, sidebar settings width-control API-parity wiring (including `DockSideBarMode` settings control), debug/settings outer-split divider-stability regression coverage, demo shortcut wiring, floating snap-target settings resolution coverage, load-error message formatting, owner-aware error-alert behavior, FileChooser helper coverage for shared layout/editor chooser configuration, and named theme-catalog/resource coverage
158159
- ✅ DemoNodeFactoryTest (3 tests) - Unknown-node fallback strategy coverage (framework placeholder vs. custom demo fallback node) plus SnapFX integration coverage for unsupported-type recovery with the default demo factory
159160
- ✅ EditorCloseDecisionPolicyTest (5 tests) - Deterministic close-decision policy checks
160161
- ✅ MarkdownDocumentationConsistencyTest (12 tests) - Markdown consistency guardrails
161162
- ✅ AboutDialogTest (2 tests) - About dialog branding resources and credit link targets
162-
-**313/313 tests passing**
163+
-**314/314 tests passing**
163164
-**Performance tests for large layouts** (50+ nodes with stress move/cleanup operations)
164165
-**Memory leak cleanup tests** (cache boundedness, undock cleanup, large-layout detach/attach cycles)
165166
-**Edge case tests** (null inputs, detached nodes, invalid move targets, no-op revision checks)
@@ -180,6 +181,7 @@
180181
- ✅ About dialog extracted into dedicated class with dynamic version info, large logo branding, and icon credits
181182
- ✅ About dialog easter egg animation (triple-click logo)
182183
- ✅ Debug view toggle
184+
- ✅ DockDebugOverlay HUD issues are fixed after sidebar Phase 2 (panel layout/background rendering, top-left clipping, and live target/zone diagnostics updates during drag); MainDemo keeps the HUD behind a local debug toggle
183185
- ✅ Settings tab for live layout options (title bar, close buttons, drop visualization, lock, floating pin controls, floating-window snapping controls, and Phase-C pinned side-bar manual test controls for pin/restore/pin-open)
184186
- ✅ File workflows now use shared `FileChooser` helpers for layout open/save and editor open/save-as to keep extension filters and defaults consistent
185187
- ✅ Settings tab now includes a theme selector driven by the SnapFX named theme catalog (`Light`, `Dark`) and applies styles via runtime API
@@ -218,13 +220,12 @@
218220
- ⚠️ Memory: Automated heap profiling in CI not implemented
219221
- ⚠️ UI: Global interaction animations missing (only About dialog easter egg animation exists; tracked in `ROADMAP.md` Phase 3.3)
220222
- ⚠️ UI: Context-menu extensibility API for custom menu items is not implemented yet (tracked in `ROADMAP.md` Phase 3.2)
221-
- ⚠️ UI: `DockDebugOverlay` HUD in MainDemo is temporarily disabled; sidebar Phase 2 is complete and the next follow-up is the tracked HUD fix/re-enable in `ROADMAP.md` Phase 1.2 (background rendering, top-left clipping, and `none` diagnostics text)
222223

223224
## Next Steps
224225

225226
See [ROADMAP.md](ROADMAP.md) for detailed future development plans.
226227

227-
**Priority**: Sidebar Phase 2 interaction parity is complete for the current scope; next focus is the `DockDebugOverlay` HUD fix/re-enable follow-up, then return to the broader Phase 3 UX backlog.
228+
**Priority**: Sidebar Phase 2 interaction parity and the `DockDebugOverlay` HUD follow-up are complete for the current scope; next focus returns to the broader Phase 3 UX backlog (context-menu extensibility API and global interaction animation polish).
228229

229230
---
230231

src/main/java/com/github/beowolve/snapfx/debug/DockDebugOverlay.java

Lines changed: 57 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
package com.github.beowolve.snapfx.debug;
22

3+
import com.github.beowolve.snapfx.model.DockNode;
4+
import com.github.beowolve.snapfx.theme.DockThemeStyleClasses;
35
import com.github.beowolve.snapfx.dnd.DockDragData;
46
import com.github.beowolve.snapfx.dnd.DockDragService;
57
import com.github.beowolve.snapfx.model.DockElement;
68
import com.github.beowolve.snapfx.model.DockGraph;
79
import com.github.beowolve.snapfx.model.DockPosition;
8-
import javafx.beans.property.ObjectProperty;
9-
import javafx.beans.property.SimpleObjectProperty;
10+
import javafx.animation.AnimationTimer;
1011
import javafx.geometry.Insets;
12+
import javafx.scene.layout.Region;
1113
import javafx.scene.layout.*;
1214
import javafx.scene.paint.Color;
1315
import javafx.scene.text.Text;
@@ -18,24 +20,26 @@
1820
* Lightweight debug overlay that renders the current D&D state as a small HUD.
1921
*/
2022
public class DockDebugOverlay extends StackPane {
21-
private final ObjectProperty<DockDragData> currentDrag;
23+
private final DockDragService dragService;
24+
private final AnimationTimer refreshTimer;
2225

2326
private final Text hudText;
27+
private String lastRenderedText;
28+
private boolean lastVisible;
2429

2530
public DockDebugOverlay(DockGraph dockGraph, DockDragService dragService) {
2631
Objects.requireNonNull(dockGraph, "dockGraph");
27-
Objects.requireNonNull(dragService, "dragService");
28-
29-
this.currentDrag = new SimpleObjectProperty<>(dragService.currentDragProperty().get());
32+
this.dragService = Objects.requireNonNull(dragService, "dragService");
3033

3134
setMouseTransparent(true);
32-
setManaged(false);
3335
setPickOnBounds(false);
34-
36+
setMaxSize(Region.USE_PREF_SIZE, Region.USE_PREF_SIZE);
3537
setPadding(new Insets(8));
38+
setVisible(false);
39+
getStyleClass().add(DockThemeStyleClasses.DOCK_DEBUG_PANEL);
3640

3741
hudText = new Text();
38-
hudText.setFill(Color.WHITE);
42+
hudText.setFill(Color.RED);
3943

4044
var bg = new Background(new BackgroundFill(Color.rgb(0, 0, 0, 0.55), new CornerRadii(6), Insets.EMPTY));
4145
setBackground(bg);
@@ -44,28 +48,65 @@ public DockDebugOverlay(DockGraph dockGraph, DockDragService dragService) {
4448
StackPane.setMargin(hudText, new Insets(8));
4549

4650
dragService.currentDragProperty().addListener((obs, old, cur) -> {
47-
currentDrag.set(cur);
48-
updateText(cur);
51+
refreshFromDragService();
52+
});
53+
54+
refreshTimer = new AnimationTimer() {
55+
@Override
56+
public void handle(long now) {
57+
refreshFromDragService();
58+
}
59+
};
60+
sceneProperty().addListener((obs, oldScene, newScene) -> {
61+
if (newScene == null) {
62+
refreshTimer.stop();
63+
} else {
64+
refreshTimer.start();
65+
refreshFromDragService();
66+
}
4967
});
5068

51-
updateText(currentDrag.get());
69+
refreshFromDragService();
70+
}
71+
72+
void refreshFromDragService() {
73+
updateText(dragService.getCurrentDrag());
74+
}
75+
76+
String getHudTextForTest() {
77+
return hudText.getText();
5278
}
5379

5480
private void updateText(DockDragData data) {
5581
if (data == null) {
56-
setVisible(false);
82+
applyHudState(false, null);
5783
return;
5884
}
5985

60-
setVisible(true);
61-
6286
DockElement target = data.getDropTarget();
6387
DockPosition pos = data.getDropPosition();
6488

6589
String targetText = target == null ? "none" : target.getClass().getSimpleName();
6690
String posText = pos == null ? "none" : pos.name();
6791

68-
hudText.setText("Drag: " + safeTitle(data) + "\nTarget: " + targetText + "\nZone: " + posText);
92+
if (target instanceof DockNode dockNode) {
93+
targetText = dockNode.getTitle();
94+
}
95+
96+
applyHudState(
97+
true,
98+
"Drag: " + safeTitle(data) + "\nTarget: " + targetText + "\nZone: " + posText
99+
);
100+
}
101+
102+
private void applyHudState(boolean visible, String text) {
103+
if (lastVisible == visible && Objects.equals(lastRenderedText, text)) {
104+
return;
105+
}
106+
lastVisible = visible;
107+
lastRenderedText = text;
108+
setVisible(visible);
109+
hudText.setText(text);
69110
}
70111

71112
private String safeTitle(DockDragData data) {

src/main/java/com/github/beowolve/snapfx/demo/MainDemo.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1021,8 +1021,7 @@ private void installDebugPanel() {
10211021
mainSplit.setDividerPositions(0.72);
10221022

10231023
if (ENABLE_DOCK_DEBUG_HUD) {
1024-
// Temporary local demo HUD for D&D diagnostics. Disabled while sidebar interaction work is in progress
1025-
// and until DockDebugOverlay issues (background/clipping/data text) are fixed.
1024+
// Local demo HUD for D&D diagnostics.
10261025
DockDebugOverlay hud = new DockDebugOverlay(snapFX.getDockGraph(), snapFX.getDragService());
10271026
StackPane stack = new StackPane(mainSplit, hud);
10281027
StackPane.setAlignment(hud, Pos.TOP_LEFT);

0 commit comments

Comments
 (0)