Files
bherbruck 2220e049bc Web app: mouse buttons follow the browser's, so a chord or a release outside the window no longer leaves one held (#15321)
eframe's web runner turns each pointerdown/pointerup into one egui button event from event.button.
A mouse chord doesn't work that way: the second button and the first release fire pointermove, and
only the last release fires pointerup. Press right then left and let go of right then left, and
eframe reports right down, left up: egui keeps right held and every mouse move orbits. A release
the page never hears (outside the window, alt-tab) left a button held the same way.

The web app now notes every mouse/pen pointer event's buttons bitmask (window capture listeners,
so it is noted before eframe runs a frame from the same event) and adds the button events egui is
missing before each frame. The canvas captures the pointer on pointerdown; pointercancel,
lostpointercapture, blur and a hidden page release everything. Presses are only added for
buttons that went down on the canvas. A shim in our crate, no eframe patch.

Tests: unit tests for the reconciliation; cargo xtask web-api-test checks chords, a drag let go
outside the window, a lost release and blur in headless Chrome (window.solidcraft.buttons()).

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-12 07:40:48 +00:00

50 lines
2.1 KiB
TOML

[package]
name = "solidcraft-web"
description = "SolidCraft 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 = "solidcraft-web"
path = "src/main.rs"
[features]
default = ["profile"]
bundled-render-library = ["solidcraft-engine/bundled-render-library"]
# The profiler, compiled in so any build can say where its time goes (the Profile operations
# preference, SOLIDCRAFT_PROFILE=1, diagnostics.profile); it records nothing until asked.
profile = ["solidcraft-engine/profile"]
[dependencies]
solidcraft-engine = { workspace = true }
solidcraft-control = { workspace = true }
solidcraft-ui-egui = { workspace = true }
# SolidCraft's look (icons, glyphs, built-in themes), installed at startup.
solidcraft-look = { workspace = true }
solidcraft-ui-text = { workspace = true }
egui = { workspace = true }
log = { workspace = true }
serde_json = { workspace = true }
url = "2"
percent-encoding = "2"
[target.'cfg(target_arch = "wasm32")'.dependencies]
eframe = { workspace = true, features = ["default_fonts", "wgpu", "accesskit"] }
wasm-bindgen = "0.2"
wasm-bindgen-futures = "0.4"
js-sys = "0.3"
web-sys = { version = "0.3", features = [
"Window", "Document", "Element", "HtmlElement", "HtmlCanvasElement", "Location", "Navigator", "StorageManager",
"FileSystemHandle", "FileSystemDirectoryHandle", "FileSystemFileHandle", "FileSystemGetFileOptions", "FileSystemGetDirectoryOptions", "FileSystemWritableFileStream",
"WritableStream", "File", "FileList", "Blob", "BlobPropertyBag", "Url", "HtmlAnchorElement", "HtmlInputElement", "Storage", "StorageEvent",
"IdbFactory", "IdbDatabase", "IdbObjectStore", "IdbOpenDbRequest", "IdbRequest", "IdbTransaction", "IdbTransactionMode",
"Headers", "ReadableStream", "ReadableStreamDefaultReader",
"BeforeUnloadEvent", "Event", "EventTarget", "KeyboardEvent", "Response", "FormData", "RequestInit", "MediaQueryList", "Gamepad", "Performance",
"PointerEvent", "Node", "VisibilityState",
] }