Skip to content

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

Description

@trailcode

Summary

Enable ImGui docking (native multi-viewport + WASM in-canvas), fix several Add node tool bugs around distance input / undo / redo, fix circle/arc undo-redo regressions, clear undo history on New Project, fix chamfer/fillet view crash after extrude + view-cube navigation, and refresh bundled default settings.

ImGui docking

  • Upgrade vendored Dear ImGui to v1.92.7-docking (IMGUI_HAS_DOCK).
  • Native: dockable/tabbed panels inside the main window; panels can detach into separate OS windows (multi-viewport).
  • WASM: in-canvas docking only (single browser canvas).
  • Persist dock layout in imgui_ini inside ezycad_settings.json; older installs without a [Docking] section get a default layout on first launch.
  • Settings -> UI: separate Dark / Light theme ImGui controls (transparency, rounding, borders, padding, spacing). Legacy imgui_rounding_* keys migrate to both themes on load.

Add node tool fixes

  1. Escape during distance input — pressing Escape while typing a distance no longer commits the node; distance/angle popups cancel instead of finalize.
  2. Undo after anchor + distance or second clickSketch_op_recorder now opens before node creation on rubber-band placement paths so undo deltas are recorded.
  3. RedoSketch_delta::apply_forward_ restores curr_node_pts (revive tombstoned nodes and re-run interior splits).
  4. Length dimension tool + Origintry_pick_existing_node no longer hard-excludes the sketch Origin (still respects origin_snap_enabled).

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 recorded for arc creation and then split arcs at those interior bulge points. Bulge nodes were also revived as permanent via get_node_exact(pt, true).

Fix (in PR #180): restore_curr_node_at_pt_() skips interior splits for arc bulge points and does not promote arc-defining nodes (pt_a / pt_b / pt_c from curr_arc_edges) to permanent on redo. Add-node redo behavior is unchanged.

Verified: circle undo/redo keeps 2 edges and the same permanent node count; Arc Segment undo/redo keeps 1 edge.

View / chamfer fix

Repro: new project, rotate view, click view cube Top (zoom to origin), zoom out, add square, extrude, chamfer, then change view — camera jumped to empty space and the app crashed in FlushViewEvents (Standard_ProgramError).

Root cause: chamfer/fillet replaced the picked solid without clearing AIS selection/highlight on the removed shape; switching from sketch orthographic (extrude) to shape perspective (chamfer) after shapes were already redisplayed corrupted camera zoom.

Fix (in PR #180):

  • replace_picked_shape_() for chamfer/fillet: clear hover/selection, remove old shape, Display replacement.
  • apply_camera_projection() at start of on_mode() (before shape visibility/selection updates).
  • Preserve eye-center distance and view scale when toggling ortho/perspective.
  • Defensive try/catch in flush_view_events().

Verified: chamfer no longer crashes; view cube Top orients correctly; solid stays visible after chamfer.

Other fixes

  • New Project clears undo and redo stacks instead of pushing a snapshot of the previous document.
  • Distance edit popup follows the cursor when reopened (Tab) instead of staying at the first-open position.
  • Bundled defaults (res/ezycad_settings.json) updated to current preferred settings (layout, theme, grid off, dimension style, snap colors, etc.).

Tests

  • AddNode_distance_enter_undo
  • AddNode_anchor_then_click_undo (undo + redo)
  • DimensionTool_picks_sketch_origin
  • NewFile_clears_undo_stacks
  • Undo_single_arc_via_recorder (GUI Arc Segment 3-click path)
  • Undo_circle_via_recorder (GUI Circle center + radius path; checks edge and permanent-node counts after redo)

Documentation

  • CHANGELOG.md (UI layout section)
  • docs/usage-settings.md (docking, settings storage, UI theme keys)
  • src/doc/gui.md (input routing, dock space)

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingenhancementNew feature or requestsketchui

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions