mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-10-14 19:26:56 -04:00
When the browser dropped the page's WebGPU device or WebGL context, the editor kept running but nothing it drew reached the screen: Chrome and WebKit showed a frozen, stale canvas and Firefox a blank page, while edits and Save went on. - ui-egui: new `graphics` module. `GraphicsLoss` carries a loss report from any thread (wgpu's device-lost callback, the canvas's `webglcontextlost` event) to the UI thread. `VectorcraftApp:: graphics_lost` writes Data Recovery copies of the modified documents at once. The app now notices when the host hands it a new egui context and uploads everything again (fonts and theme, the canvas, place cursor thumbnails); every per-thread texture cache (layer, symbol, swatch, style, asset and glyph thumbnails, previews, font samples, Navigator, Flattener Preview) is a `TexCache` that empties for a new context. Without this, the moved app drew stale or wrong textures and egui panicked on its missing font families. - web: the shell watches both loss signals; on a loss it puts a fresh canvas in place of the dead one and starts the same `WebRunner` again, handing over the same app (documents, undo, panels), with services made for the new context and a status-bar note. If no new graphics can be had (or after three losses) it removes the stale canvas, lets go of the recovery copies and says to reload. - engine: `recovery::leave` lets go of a session's area but keeps its copies, so the reloaded page offers them at once instead of after the heartbeat goes stale. - desktop: eframe can't give a window a new device, so a lost device (driver reset) is logged, the copies are written and the status bar says to save and restart; closing then skips the Save Changes question it can't show. - Tests: loss reporting across threads, `TexCache` emptying, the app uploading the canvas, a cached preview, theme and fonts again in a new context (fails without the fix), copies written on loss, and `recovery::leave` offering copies at once with both lock and heartbeat stores. docs/development.md (web section) and ROADMAP updated. Co-Authored-By: Claude Opus 5.5 <[email protected]>