mirror of
https://github.com/storytold/gridcraft.git
synced 2026-10-25 11:16:49 -06:00
The web build had no way to actually print — Ctrl+P (Cmd+P, declared on file.print's shortcut) did nothing at all, and the ribbon's "Print…" menu item ran file.print and silently discarded the result. file.print already builds a PDF and returns it as base64 specifically "for the UI to hand to the system print dialog" per its own doc comment — this wires that up. - ui-egui: new Services::print hook (web: hand PDF bytes to the browser's print flow directly, no download); SheetApp::print_now runs file.print, decodes the base64 result, and calls the hook. - ui-egui: Key::P now dispatches to print_now (was unbound); the ribbon's "Print…" menu item calls print_now instead of discarding file.print's result. - gridcraft-web: implements the hook (Blob -> object URL -> hidden iframe -> iframe.contentWindow.print() on load). Desktop builds are unaffected (no Services::print set there; print_now falls back to the existing alert-on-error behaviour with no UI action on success, same as before this change).
30 lines
971 B
TOML
30 lines
971 B
TOML
[package]
|
|
name = "gridcraft-web"
|
|
description = "GridCraft in the browser (eframe web runner, WebGPU with WebGL2 fallback)"
|
|
version.workspace = true
|
|
edition.workspace = true
|
|
license.workspace = true
|
|
publish = false
|
|
|
|
[lints]
|
|
workspace = true
|
|
|
|
[[bin]]
|
|
name = "gridcraft-web"
|
|
path = "src/main.rs"
|
|
|
|
[dependencies]
|
|
gridcraft-engine = { workspace = true }
|
|
gridcraft-ui-egui = { workspace = true }
|
|
egui = { workspace = true }
|
|
log = { workspace = true }
|
|
serde_json = { workspace = true }
|
|
|
|
[target.'cfg(target_arch = "wasm32")'.dependencies]
|
|
eframe = { workspace = true, features = ["default_fonts", "wgpu", "accesskit"] }
|
|
rfd = { workspace = true }
|
|
wasm-bindgen = "0.2"
|
|
wasm-bindgen-futures = "0.4"
|
|
js-sys = "0.3"
|
|
web-sys = { version = "0.3", features = ["Window", "Document", "Element", "HtmlElement", "HtmlCanvasElement", "HtmlAnchorElement", "HtmlIFrameElement", "Blob", "BlobPropertyBag", "Url", "Location", "CssStyleDeclaration", "Clipboard", "ClipboardItem", "Navigator"] }
|