Skip to content

ImGui docking, add-node undo/redo fixes, and settings defaults#180

Merged
trailcode merged 11 commits into
mainfrom
Trailcode/imgui-docking
Jul 9, 2026
Merged

ImGui docking, add-node undo/redo fixes, and settings defaults#180
trailcode merged 11 commits into
mainfrom
Trailcode/imgui-docking

Conversation

@trailcode

@trailcode trailcode commented Jul 8, 2026

Copy link
Copy Markdown
Owner

Closes #179

Summary

  • Upgrade Dear ImGui to v1.92.7-docking and enable dockable panels (native multi-viewport; WASM in-canvas only).
  • Add Settings -> UI dark/light theme controls; persist dock layout in imgui_ini.
  • Fix Add node distance-input Escape handling, undo/redo for rubber-band placement, and length-dimension picking of the sketch Origin.
  • Fix circle and arc undo/redo so redo restores the same edge count and permanent nodes as the initial create.
  • New Project now clears undo/redo stacks.
  • Fix chamfer/fillet view crash and zoom corruption after sketch extrude + view-cube navigation.
  • Refresh bundled res/ezycad_settings.json defaults (layout, theme, grid, dimensions, snap colors).

Add node fixes

Bug Fix
Escape during distance input still added node hide_dist_edit(false) / hide_angle_edit(false) on Escape; route Escape to on_key while dist edit is focused
Undo empty after anchor + distance/click Open Sketch_op_recorder before add_new_node / get_node_exact in rubber-band commit paths
Redo did not restore placed nodes restore_curr_node_at_pt_() in Sketch_delta::apply_forward_
Length dimension tool ignored Origin Remove hard origin exclusion from try_pick_existing_node

Circle / arc undo-redo fix

Repro: create a circle (center + radius click), undo, redo — debug pane showed 4 edges and 3 extra permanent nodes instead of the original 2 edges.

Root cause: on redo, restore_curr_node_at_pt_() revived stencil/bulge nodes from curr_arc_edges and then called split_arcs_at_node_if_interior, splitting each semicircle in half. Bulge nodes were also revived with get_node_exact(pt, true), promoting them to permanent.

Fix: in restore_curr_node_at_pt_(), treat nodes matching arc-defining points (pt_a / pt_b / pt_c in curr_arc_edges) specially:

  • Bulge (pt_b): revive without making permanent; skip interior splits.
  • Endpoints (pt_a / pt_c): revive without making permanent (split is already a no-op at endpoints).
  • Add-node placements (not arc-defining): unchanged — revive as permanent and re-run interior splits.

View / chamfer fix

Repro: new project, rotate view, view cube Top (zoom to origin), zoom out, draw square, extrude, chamfer, then rotate/zoom — view jumped to empty space and FlushViewEvents crashed with Standard_ProgramError.

Problem Fix
Stale selection/highlight on removed solid after chamfer/fillet replace_picked_shape_(): clear hover/selection, Unhilight, remove old shape, Display replacement
Orthographic sketch extrude -> perspective chamfer corrupted zoom apply_camera_projection() runs at start of on_mode() (before shape show/redisplay)
Projection switch reset camera scale/distance Preserve eye-center distance and view scale when toggling ortho/perspective
Residual OCCT failures during navigation Defensive try/catch in flush_view_events() clears selection/hover and aborts view animation

Settings storage (for reference)

Platform Path
Windows (live) %APPDATA%\EzyCad\ezycad_settings.json
Bundled defaults res/ezycad_settings.json
Linux ~/.config/EzyCad/ezycad_settings.json
macOS ~/Library/Application Support/EzyCad/ezycad_settings.json

Test plan

  • EzyCad_tests.exe --gtest_filter=Sketch_test.AddNode_*:Sketch_test.NewFile_clears_undo_stacks:Sketch_test.DimensionTool_picks_sketch_origin
  • EzyCad_tests.exe --gtest_filter=Sketch_test.Undo_single_arc_via_recorder:Sketch_test.Undo_circle_via_recorder
  • Manual: dock/tab/split panels; detach panel to OS window (native); layout persists across restart
  • Manual: Add node from Origin -> Tab -> distance -> Enter -> Ctrl+Z -> Ctrl+Y
  • Manual: Add node from Origin -> Tab -> distance -> Escape (no node added)
  • Manual: File -> New -> debug pane shows Undo: 0 | Redo: 0
  • Manual: Circle tool (center + radius) -> Ctrl+Z -> Ctrl+Y — still 2 edges, no extra permanent nodes
  • Manual: Arc Segment tool (3 clicks) -> Ctrl+Z -> Ctrl+Y — still 1 edge
  • Manual: Settings -> Defaults restores bundled layout/theme
  • Manual: new project -> rotate -> view cube Top -> zoom out -> square -> extrude -> chamfer -> rotate/zoom (no crash, solid stays visible)
  • Manual: view cube Top orients to top view (not bottom)
  • WASM smoke: docking inside canvas; no multi-viewport

@cursor

cursor Bot commented Jul 8, 2026

Copy link
Copy Markdown

Bugbot is not enabled for your account, so this pull request was not reviewed.

Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs.

@cursor

cursor Bot commented Jul 8, 2026

Copy link
Copy Markdown

Bugbot is not enabled for your account, so this pull request was not reviewed.

Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs.

@cursor

cursor Bot commented Jul 9, 2026

Copy link
Copy Markdown

Bugbot is not enabled for your account, so this pull request was not reviewed.

Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs.

@cursor

cursor Bot commented Jul 9, 2026

Copy link
Copy Markdown

Bugbot is not enabled for your account, so this pull request was not reviewed.

Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs.

@cursor

cursor Bot commented Jul 9, 2026

Copy link
Copy Markdown

Bugbot is not enabled for your account, so this pull request was not reviewed.

Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs.

@trailcode trailcode merged commit f37cc76 into main Jul 9, 2026
3 checks passed
@trailcode trailcode deleted the Trailcode/imgui-docking branch July 9, 2026 20:34
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.

ImGui docking, add-node undo/redo fixes, and settings defaults

1 participant