fix(eeschema): wasm dialog positioning (web .window CSS) + collab SCH_SHAPE add via coroutine fiber stack

Thrust A — dialogs render top-left with OK clipped in the WEB app (not the
test harness): root cause was the React shell missing the .window /
.window-canvas CSS that wx.js relies on (it positions each dialog div via
inline left/top, which need position:absolute). Added the rules to
web/apps/frontend/src/index.css. Native draw-text now works end-to-end;
symbol/power choosers render (placing still blocked by absent libraries).

Thrust B — collab apply of a newly-added SCH_SHAPE trapped in KiCad core
(SCH_COMMIT::Push CHT_ADD -> GAL view->Add, an asyncify invoke_* mis-dispatch)
because doApply ran off a fiber stack. doApply now runs inside a COROUTINE so
it executes on a libcontext fiber, the same context native draws use; the add
dispatches correctly. Re-enabled the SCH_SHAPE converter (rect/circle). Added
thirdparty/libcontext to the embind include path (tool/coroutine.h needs it).
Verified two-tab: rectangle + circle drawn in tab A sync + render in tab B.
Extended eeschema-collab.spec.ts apply test with a SCH_SHAPE add.

All changes root-repo only; kicad and wxwidgets forks untouched.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Gergő Törcsvári 2026-06-05 11:57:10 +02:00
commit b577c05fae
No known key found for this signature in database
GPG key ID: 8E75F2CDE64E5322
6 changed files with 373 additions and 16 deletions

View file

@ -52,3 +52,36 @@
margin: 0;
}
}
/*
* wxWidgets WASM child-window styling.
*
* The wx.js runtime glue (createWindow/setWindowRect) creates a `.window`
* <div> (+ `.window-canvas`) per top-level window every KiCad dialog
* (text properties, symbol chooser, power chooser, ) is one of these,
* appended to #window-container. setWindowRect positions it via inline
* left/top, which only take effect when the element is `position: absolute`.
*
* The standalone test harness HTML ships these rules; the React shell
* (WasmTool.tsx) did not so dialogs computed `position: static`, ignored
* their left/top, and rendered jammed in the top-left corner with the OK
* button clipped off-screen. These rules (mirrored from the test harness)
* restore correct centered positioning. Input is routed through the main
* #canvas, so the window layers are pointer-events: none.
*/
.window {
position: absolute;
pointer-events: none;
z-index: 10;
background-color: black;
overflow: hidden;
width: 0;
height: 0;
}
.window-canvas {
position: absolute;
top: 0;
left: 0;
pointer-events: none;
}