mirror of
https://github.com/storytold/AniCraft.git
synced 2026-11-28 09:09:32 +01:00
fix(shell): closing the window no longer crashes on macOS
On macOS 26 the app aborted when its window closed (the end of a `--screenshot` run, and the same close path that quitting and the close button take) with NSRangeException: "Cannot remove an observer <_NSTouchBarFinderObservation> for the key path "nextResponder" from <WinitView> because it is not registered as an observer", exit 134. Cause: accesskit_macos 0.26 subclasses winit's view at runtime and, when the adapter drops, sets the view's class back. By then AppKit's Touch Bar finder has observed the view with KVO, which gave it a class of its own; putting the old class back breaks that observation, and AppKit throws when it removes it on the next display cycle. Fixed upstream in accesskit_macos 0.27.2 (AccessKit/accesskit#835), which only eframe and egui 0.37 can use (egui-winit 0.37 -> accesskit_winit 0.34). Measured on macOS 26.5 (M1), display awake: - `anicraft --screenshot`: main 3/3 exit 134, this branch 5/5 exit 0, same picture. - A bare eframe window closed with ViewportCommand::Close: eframe 0.36 with accesskit 6/8 crashed, without accesskit 0/8, eframe 0.37 with accesskit 0/10. The bump, by egui 0.37's migration notes: - WidgetType is Role (SelectableLabel -> Button, Checkbox -> CheckBox, CollapsingHeader -> DisclosureTriangle, ColorButton -> ColorWell); Id::new -> Id::unique; Ui::id -> Ui::scope_id. - Screenshots come back through a callback (Context::request_screenshot) instead of an Event::Screenshot; MouseWheel events carry a source. - egui now names its own panel and window resize handles for screen readers, and hands a tooltip to them as the control's description: the pseudo-locale tests list egui's names with its close button, and count file paths and open documents' names as data. wgpu stays at 30. New crates (Linux clipboard: wl-clipboard-rs and its dependencies; accesskit_ios) are MIT or MIT OR Apache-2.0. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
9c2687dd37
commit
24a2297fa6
57 files changed
+499
-432
No files matched your search
@@ -2,6 +2,14 @@
|
||||
|
||||
## Unreleased
|
||||
|
||||
* **Closing the window no longer crashes on macOS.** Quitting, closing the window and the end of
|
||||
a `--screenshot` run could stop with `NSRangeException` (`Cannot remove an observer
|
||||
<_NSTouchBarFinderObservation …> for the key path "nextResponder"`) and exit code 134. The
|
||||
accessibility layer put the window's view back to its own class on close, after macOS had
|
||||
given it another class to watch it for the Touch Bar. eframe and egui go to 0.37, which
|
||||
brings AccessKit 0.27.2 with the fix (AccessKit/accesskit#835). Single-line text fields are now
|
||||
as tall as the buttons beside them, as egui 0.37 draws them.
|
||||
|
||||
* **Reliability fixes from the November principal-engineer review** (M8,
|
||||
`docs/reviews/2026-11-principal-review.md`).
|
||||
* **Save is flushed to the disk** before the new file replaces the old one, as the
|
||||
|
||||
Generated
+184
-160
@@ -4,66 +4,60 @@ version = 4
|
||||
|
||||
[[package]]
|
||||
name = "accesskit"
|
||||
version = "0.24.1"
|
||||
version = "0.25.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d3b7f7f85a7e5f68090000ed7622545829afd484d210358702ae4cb97dd0c320"
|
||||
checksum = "4e883d1d28c5fd5568c79ed2d2bd48d9f2fd3945c8974ed0f53690ceddb051be"
|
||||
dependencies = [
|
||||
"uuid",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "accesskit_atspi_common"
|
||||
version = "0.18.1"
|
||||
version = "0.21.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1e8c61bee90b42a772d39d06a740207dc71a4e780004ace1db8d99fb1baaa954"
|
||||
checksum = "24f5baf62e34a4a6c30e3d697e4782f821a7337049c44c3b40576a27dfbb580d"
|
||||
dependencies = [
|
||||
"accesskit",
|
||||
"accesskit_consumer 0.36.0",
|
||||
"accesskit_consumer",
|
||||
"atspi-common",
|
||||
"phf",
|
||||
"phf 0.14.0",
|
||||
"serde",
|
||||
"zvariant",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "accesskit_consumer"
|
||||
version = "0.35.0"
|
||||
version = "0.39.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "53cf47daed85312e763fbf85ceca136e0d7abc68e0a7e12abe11f48172bc3b10"
|
||||
checksum = "f3da8f27636015191b2264ee1df681503170a632cafd832fdc1edfdd4e3a2fd3"
|
||||
dependencies = [
|
||||
"accesskit",
|
||||
"hashbrown 0.16.1",
|
||||
"hashbrown 0.17.1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "accesskit_consumer"
|
||||
version = "0.36.0"
|
||||
name = "accesskit_ios"
|
||||
version = "0.2.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "25e0d7e25d06f4dc21d1774d67146e9e80d6789216cbd4d1e88185b0095dba60"
|
||||
checksum = "a5280724673bbfa8b30a838c013500b719392989be3b97c5a9964062c252c232"
|
||||
dependencies = [
|
||||
"accesskit",
|
||||
"hashbrown 0.16.1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "accesskit_consumer"
|
||||
version = "0.38.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5d10a236f96f87d70732e44520046785431ef01d5bcd6b041317bfadd2f88245"
|
||||
dependencies = [
|
||||
"accesskit",
|
||||
"hashbrown 0.16.1",
|
||||
"accesskit_consumer",
|
||||
"hashbrown 0.17.1",
|
||||
"objc2 0.5.3",
|
||||
"objc2-foundation 0.2.2",
|
||||
"objc2-ui-kit 0.2.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "accesskit_macos"
|
||||
version = "0.26.3"
|
||||
version = "0.27.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ce02dc63b43f0c9296af9ac946312a2dc8814427d7a64d2d600971dac55b6076"
|
||||
checksum = "123828ceeec755b05255e3976cb0852993202de98a0626c97dd8d34246991f84"
|
||||
dependencies = [
|
||||
"accesskit",
|
||||
"accesskit_consumer 0.38.0",
|
||||
"hashbrown 0.16.1",
|
||||
"accesskit_consumer",
|
||||
"hashbrown 0.17.1",
|
||||
"objc2 0.5.3",
|
||||
"objc2-app-kit 0.2.2",
|
||||
"objc2-foundation 0.2.2",
|
||||
@@ -71,9 +65,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "accesskit_unix"
|
||||
version = "0.21.1"
|
||||
version = "0.24.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b016ca8db0ea0ea2ceff29a9d6240391492d960716aa471967c00e8cc8cb197c"
|
||||
checksum = "30d5192871228c54f1b0fb4a85cef000e11a3804f25d2165f14afa0daa67f3f6"
|
||||
dependencies = [
|
||||
"accesskit",
|
||||
"accesskit_atspi_common",
|
||||
@@ -89,13 +83,13 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "accesskit_windows"
|
||||
version = "0.32.1"
|
||||
version = "0.35.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "eff7009f1a532e917d66970a1e80c965140c6cfbbabbdde3d64e5431e6c78e21"
|
||||
checksum = "498668b90da9995302a0055aaecad4756932333da2ddef6baee1c00844c430fc"
|
||||
dependencies = [
|
||||
"accesskit",
|
||||
"accesskit_consumer 0.35.0",
|
||||
"hashbrown 0.16.1",
|
||||
"accesskit_consumer",
|
||||
"hashbrown 0.17.1",
|
||||
"static_assertions",
|
||||
"windows",
|
||||
"windows-core",
|
||||
@@ -103,11 +97,12 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "accesskit_winit"
|
||||
version = "0.32.2"
|
||||
version = "0.34.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1fe9a94394896352cc4660ca2288bd4ef883d83238853c038b44070c8f134313"
|
||||
checksum = "cd4ab4437b520ff03088fbe48676a11e7d44a929535e64b31432c1073e48dbcc"
|
||||
dependencies = [
|
||||
"accesskit",
|
||||
"accesskit_ios",
|
||||
"accesskit_macos",
|
||||
"accesskit_unix",
|
||||
"accesskit_windows",
|
||||
@@ -459,6 +454,7 @@ dependencies = [
|
||||
"parking_lot",
|
||||
"percent-encoding",
|
||||
"windows-sys 0.61.2",
|
||||
"wl-clipboard-rs",
|
||||
"x11rb",
|
||||
]
|
||||
|
||||
@@ -830,7 +826,7 @@ dependencies = [
|
||||
"hashbrown 0.16.1",
|
||||
"indexmap",
|
||||
"once_cell",
|
||||
"phf",
|
||||
"phf 0.13.1",
|
||||
"rustc-hash 2.1.3",
|
||||
"static_assertions",
|
||||
]
|
||||
@@ -943,42 +939,18 @@ dependencies = [
|
||||
"thiserror 1.0.69",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "calloop"
|
||||
version = "0.14.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "43b32313e937c8721c9d17ee9bf60699a6402b4b7c2cb6ac1bee0ffcaa4b4e5e"
|
||||
dependencies = [
|
||||
"bitflags 2.13.2",
|
||||
"polling",
|
||||
"rustix 1.1.5",
|
||||
"tracing",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "calloop-wayland-source"
|
||||
version = "0.3.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "95a66a987056935f7efce4ab5668920b5d0dac4a7c99991a67395f13702ddd20"
|
||||
dependencies = [
|
||||
"calloop 0.13.0",
|
||||
"calloop",
|
||||
"rustix 0.38.44",
|
||||
"wayland-backend",
|
||||
"wayland-client",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "calloop-wayland-source"
|
||||
version = "0.4.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "138efcf0940a02ebf0cc8d1eff41a1682a46b431630f4c52450d6265876021fa"
|
||||
dependencies = [
|
||||
"calloop 0.14.5",
|
||||
"rustix 1.1.5",
|
||||
"wayland-backend",
|
||||
"wayland-client",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "cast"
|
||||
version = "0.3.0"
|
||||
@@ -1694,9 +1666,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "ecolor"
|
||||
version = "0.36.2"
|
||||
version = "0.37.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0656a7530b9e2841ee7a5f983965bdd9840c32f4012f759cfd44b912cced6b34"
|
||||
checksum = "31bcbef0d4263a63eb32c4834e5d711613035ce1333468e107d928923e21e6e2"
|
||||
dependencies = [
|
||||
"bytemuck",
|
||||
"emath",
|
||||
@@ -1704,9 +1676,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "eframe"
|
||||
version = "0.36.2"
|
||||
version = "0.37.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "55ad41fac6e3149abb4866e93df37dbd33baa95db525c3368c944584e95a5dc2"
|
||||
checksum = "9c5642501a65ca657d05f00c643a5c14ff2346cb3818032bfe23d58e1f8e5f84"
|
||||
dependencies = [
|
||||
"ahash",
|
||||
"bytemuck",
|
||||
@@ -1729,6 +1701,7 @@ dependencies = [
|
||||
"pollster 1.0.1",
|
||||
"profiling",
|
||||
"raw-window-handle",
|
||||
"send_wrapper",
|
||||
"static_assertions",
|
||||
"wasm-bindgen",
|
||||
"web-sys",
|
||||
@@ -1740,9 +1713,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "egui"
|
||||
version = "0.36.2"
|
||||
version = "0.37.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "dc938cc27cd911415e1e4d151bc56ff9df063d8db081374e87aeb805ea74b2ba"
|
||||
checksum = "bec9144f49b7a28b5f395d3147e325b4fe3e77ba686eac11d1bdf0a7da3f375f"
|
||||
dependencies = [
|
||||
"accesskit",
|
||||
"ahash",
|
||||
@@ -1760,9 +1733,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "egui-wgpu"
|
||||
version = "0.36.2"
|
||||
version = "0.37.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5cef1f6d1bba40b09a4d0d62cb822b81030922cfbf65c5373398c3a3caafc5bd"
|
||||
checksum = "0309cbe1febed48af5b974e4bcc424b35e9664863a4d402697147b57a488c864"
|
||||
dependencies = [
|
||||
"ahash",
|
||||
"bytemuck",
|
||||
@@ -1780,31 +1753,33 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "egui-winit"
|
||||
version = "0.36.2"
|
||||
version = "0.37.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "98466000559d66ba4db786a30448b01483946add4188e7f10f522a27b4fb89cc"
|
||||
checksum = "e4e449f4c4a2a60c7ccb4ba7fa4078417bfe1f9ddc03b5e05ce75748e33a70de"
|
||||
dependencies = [
|
||||
"accesskit_winit",
|
||||
"arboard",
|
||||
"block2 0.6.2",
|
||||
"bytemuck",
|
||||
"egui",
|
||||
"log",
|
||||
"objc2 0.6.5",
|
||||
"objc2-app-kit 0.3.2",
|
||||
"objc2-foundation 0.3.2",
|
||||
"objc2-ui-kit 0.3.2",
|
||||
"profiling",
|
||||
"raw-window-handle",
|
||||
"smithay-clipboard",
|
||||
"web-time",
|
||||
"webbrowser",
|
||||
"windows-sys 0.61.2",
|
||||
"winit",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "egui_glow"
|
||||
version = "0.36.2"
|
||||
version = "0.37.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "606ed4167daf341e5753d703285c4c1d562324b2c07aa8f405cd7d066fe58f3b"
|
||||
checksum = "9275ca5cc35a6b7c94e0e8cedf22542f66cb0cf45ed8ab2657c78ff49fec7268"
|
||||
dependencies = [
|
||||
"bytemuck",
|
||||
"egui",
|
||||
@@ -1822,9 +1797,9 @@ checksum = "0e9c71c2167ca323c882b99918929403426e2373ea17242ff5653e0d5e1058be"
|
||||
|
||||
[[package]]
|
||||
name = "emath"
|
||||
version = "0.36.2"
|
||||
version = "0.37.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "52c8d4141cf0f60fb2f7aefaf352d3ffa5171ef0ab09731c64391801e95e48f1"
|
||||
checksum = "e73ce90f54750be8672c02be0743fe47530e6f251e066f0ee2869b59eb297af5"
|
||||
dependencies = [
|
||||
"bytemuck",
|
||||
]
|
||||
@@ -1872,9 +1847,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "epaint"
|
||||
version = "0.36.2"
|
||||
version = "0.37.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a0ec0308dc23130fc1a7d4623a8534c2ed069c6dc84e258ee4f3de99615aa1a3"
|
||||
checksum = "97bac86ae3dde93fc3951e790951caea739ff39a6c89d909cdaf1d9278dbb1bd"
|
||||
dependencies = [
|
||||
"ahash",
|
||||
"bytemuck",
|
||||
@@ -1891,15 +1866,16 @@ dependencies = [
|
||||
"skrifa",
|
||||
"smallvec",
|
||||
"unicode-general-category",
|
||||
"unicode-properties",
|
||||
"unicode-segmentation",
|
||||
"vello_cpu",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "epaint_default_fonts"
|
||||
version = "0.36.2"
|
||||
version = "0.37.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "773fa9c96dd0dbef887e39d0ed6177f141cce4d68e6041df77570aa3702dfa13"
|
||||
checksum = "cfc1cc505827f4c23eedc297975a0fd038268d41293f389dd8ff3b574aefab19"
|
||||
|
||||
[[package]]
|
||||
name = "equator"
|
||||
@@ -2297,9 +2273,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "glifo"
|
||||
version = "0.2.0"
|
||||
version = "0.3.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ed4a1bb24121291d27230c1b1b44e07d6a9b28cefdb32fe1581dfb84e14f940a"
|
||||
checksum = "282a26c1e23de04bdab3e34a21b6f877a479b96737792516b9b8b8f69b6661be"
|
||||
dependencies = [
|
||||
"bytemuck",
|
||||
"foldhash 0.2.0",
|
||||
@@ -3127,6 +3103,15 @@ version = "0.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2bf50223579dc7cdcfb3bfcacf7069ff68243f8c363f62ffa99cf000a6b9c451"
|
||||
|
||||
[[package]]
|
||||
name = "nom"
|
||||
version = "8.0.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "df9761775871bdef83bee530e60050f7e54b1105350d6884eb0fb4f46c2f9405"
|
||||
dependencies = [
|
||||
"memchr",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "nu-ansi-term"
|
||||
version = "0.50.3"
|
||||
@@ -3633,6 +3618,16 @@ dependencies = [
|
||||
"pin-project-lite",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "os_pipe"
|
||||
version = "1.2.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7d8fae84b431384b68627d0f9b3b1245fcf9f46f6c0e3dc902e9dce64edd1967"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"windows-sys 0.61.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "parking"
|
||||
version = "2.2.1"
|
||||
@@ -3687,14 +3682,35 @@ version = "2.3.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9b4f627cb1b25917193a259e49bdad08f671f8d9708acfd5fe0a8c1455d87220"
|
||||
|
||||
[[package]]
|
||||
name = "petgraph"
|
||||
version = "0.8.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8701b58ea97060d5e5b155d383a69952a60943f0e6dfe30b04c287beb0b27455"
|
||||
dependencies = [
|
||||
"fixedbitset",
|
||||
"hashbrown 0.15.5",
|
||||
"indexmap",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "phf"
|
||||
version = "0.13.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c1562dc717473dbaa4c1f85a36410e03c047b2e7df7f45ee938fbef64ae7fadf"
|
||||
dependencies = [
|
||||
"phf_macros",
|
||||
"phf_shared",
|
||||
"phf_macros 0.13.1",
|
||||
"phf_shared 0.13.1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "phf"
|
||||
version = "0.14.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "010378780309880b08997fae13be7834dba947d36393bd372f2b1556deb2a2f6"
|
||||
dependencies = [
|
||||
"phf_macros 0.14.0",
|
||||
"phf_shared 0.14.0",
|
||||
"serde",
|
||||
]
|
||||
|
||||
@@ -3705,7 +3721,17 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "135ace3a761e564ec88c03a77317a7c6b80bb7f7135ef2544dbe054243b89737"
|
||||
dependencies = [
|
||||
"fastrand",
|
||||
"phf_shared",
|
||||
"phf_shared 0.13.1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "phf_generator"
|
||||
version = "0.14.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "aeb62e0959d5a1bebc965f4d15d9e2b7cea002b6b0f5ba8cde6cc26738467100"
|
||||
dependencies = [
|
||||
"fastrand",
|
||||
"phf_shared 0.14.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -3714,8 +3740,21 @@ version = "0.13.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "812f032b54b1e759ccd5f8b6677695d5268c588701effba24601f6932f8269ef"
|
||||
dependencies = [
|
||||
"phf_generator",
|
||||
"phf_shared",
|
||||
"phf_generator 0.13.1",
|
||||
"phf_shared 0.13.1",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.119",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "phf_macros"
|
||||
version = "0.14.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5fa8d0ca26d424d27630da600c6624696e7dec8bf7b3b492b383c5dc49e5e085"
|
||||
dependencies = [
|
||||
"phf_generator 0.14.0",
|
||||
"phf_shared 0.14.0",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.119",
|
||||
@@ -3730,6 +3769,15 @@ dependencies = [
|
||||
"siphasher",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "phf_shared"
|
||||
version = "0.14.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c6fd9027e2d9319be6349febd1db4e8d02aa544921200c9b777720ac34a3aa89"
|
||||
dependencies = [
|
||||
"siphasher",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "pin-project"
|
||||
version = "1.1.13"
|
||||
@@ -4401,6 +4449,12 @@ dependencies = [
|
||||
"serde_core",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "send_wrapper"
|
||||
version = "0.6.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "cd0b0ec5f1c1ca621c432a25813d8d60c88abe6d3e08a3eb9cf37d97a0fe3d73"
|
||||
|
||||
[[package]]
|
||||
name = "serde"
|
||||
version = "1.0.229"
|
||||
@@ -4566,8 +4620,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3457dea1f0eb631b4034d61d4d8c32074caa6cd1ab2d59f2327bd8461e2c0016"
|
||||
dependencies = [
|
||||
"bitflags 2.13.2",
|
||||
"calloop 0.13.0",
|
||||
"calloop-wayland-source 0.3.0",
|
||||
"calloop",
|
||||
"calloop-wayland-source",
|
||||
"cursor-icon",
|
||||
"libc",
|
||||
"log",
|
||||
@@ -4584,44 +4638,6 @@ dependencies = [
|
||||
"xkeysym",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "smithay-client-toolkit"
|
||||
version = "0.20.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0512da38f5e2b31201a93524adb8d3136276fa4fe4aafab4e1f727a82b534cc0"
|
||||
dependencies = [
|
||||
"bitflags 2.13.2",
|
||||
"calloop 0.14.5",
|
||||
"calloop-wayland-source 0.4.1",
|
||||
"cursor-icon",
|
||||
"libc",
|
||||
"log",
|
||||
"memmap2",
|
||||
"rustix 1.1.5",
|
||||
"thiserror 2.0.21",
|
||||
"wayland-backend",
|
||||
"wayland-client",
|
||||
"wayland-csd-frame",
|
||||
"wayland-cursor",
|
||||
"wayland-protocols",
|
||||
"wayland-protocols-experimental",
|
||||
"wayland-protocols-misc",
|
||||
"wayland-protocols-wlr",
|
||||
"wayland-scanner",
|
||||
"xkeysym",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "smithay-clipboard"
|
||||
version = "0.7.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "71704c03f739f7745053bde45fa203a46c58d25bc5c4efba1d9a60e9dba81226"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"smithay-client-toolkit 0.20.0",
|
||||
"wayland-backend",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "smol_str"
|
||||
version = "0.2.2"
|
||||
@@ -5152,7 +5168,6 @@ version = "0.1.44"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "63e71662fa4b2a2c3a26f570f037eb95bb1f85397f3cd8076caed2f026a6d100"
|
||||
dependencies = [
|
||||
"log",
|
||||
"pin-project-lite",
|
||||
"tracing-attributes",
|
||||
"tracing-core",
|
||||
@@ -5178,6 +5193,17 @@ dependencies = [
|
||||
"once_cell",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tree_magic_mini"
|
||||
version = "3.2.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b8765b90061cba6c22b5831f675da109ae5561588290f9fa2317adab2714d5a6"
|
||||
dependencies = [
|
||||
"memchr",
|
||||
"nom",
|
||||
"petgraph",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ttf-parser"
|
||||
version = "0.25.1"
|
||||
@@ -5237,6 +5263,12 @@ version = "1.0.27"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a2c754d6c33795a1c324727428e5a7dedb5b06195f9890bdbcba760d3e246563"
|
||||
|
||||
[[package]]
|
||||
name = "unicode-properties"
|
||||
version = "0.1.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "993ad287eb20e8ba755312801cfe1413e0f25d604075863acaddca10b04c1833"
|
||||
|
||||
[[package]]
|
||||
name = "unicode-segmentation"
|
||||
version = "1.13.3"
|
||||
@@ -5339,9 +5371,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "vello_common"
|
||||
version = "0.1.0"
|
||||
version = "0.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b2e9aed918117e8152c9eddfd8362d73c465c23f26c44786aa331707b8a64fa2"
|
||||
checksum = "bbb2141a2bca6e6d598e471fd4d1d7eed8e020aad6a28187edda07f091a325dd"
|
||||
dependencies = [
|
||||
"bytemuck",
|
||||
"fearless_simd",
|
||||
@@ -5354,9 +5386,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "vello_cpu"
|
||||
version = "0.1.0"
|
||||
version = "0.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ac7349e1f55f6b801c7c277958df4ea53e7f20f21e8014910ad888b2ecda93ea"
|
||||
checksum = "ace506ca414548966fcf3c283be94eb1cad8254de488791ee698bf438b0890a9"
|
||||
dependencies = [
|
||||
"bytemuck",
|
||||
"glifo",
|
||||
@@ -5653,32 +5685,6 @@ dependencies = [
|
||||
"wayland-scanner",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wayland-protocols-experimental"
|
||||
version = "20250721.0.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "40a1f863128dcaaec790d7b4b396cc9b9a7a079e878e18c47e6c2d2c5a8dcbb1"
|
||||
dependencies = [
|
||||
"bitflags 2.13.2",
|
||||
"wayland-backend",
|
||||
"wayland-client",
|
||||
"wayland-protocols",
|
||||
"wayland-scanner",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wayland-protocols-misc"
|
||||
version = "0.3.12"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6e9567599ef23e09b8dad6e429e5738d4509dfc46b3b21f32841a304d16b29c8"
|
||||
dependencies = [
|
||||
"bitflags 2.13.2",
|
||||
"wayland-backend",
|
||||
"wayland-client",
|
||||
"wayland-protocols",
|
||||
"wayland-scanner",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "wayland-protocols-plasma"
|
||||
version = "0.3.12"
|
||||
@@ -6184,7 +6190,7 @@ dependencies = [
|
||||
"bitflags 2.13.2",
|
||||
"block2 0.5.1",
|
||||
"bytemuck",
|
||||
"calloop 0.13.0",
|
||||
"calloop",
|
||||
"cfg_aliases",
|
||||
"concurrent-queue",
|
||||
"core-foundation 0.9.4",
|
||||
@@ -6205,7 +6211,7 @@ dependencies = [
|
||||
"raw-window-handle",
|
||||
"redox_syscall 0.4.1",
|
||||
"rustix 0.38.44",
|
||||
"smithay-client-toolkit 0.19.2",
|
||||
"smithay-client-toolkit",
|
||||
"smol_str",
|
||||
"tracing",
|
||||
"unicode-segmentation",
|
||||
@@ -6264,6 +6270,24 @@ version = "0.57.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1ebf944e87a7c253233ad6766e082e3cd714b5d03812acc24c318f549614536e"
|
||||
|
||||
[[package]]
|
||||
name = "wl-clipboard-rs"
|
||||
version = "0.9.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "959c7ac3b8afde864f7a7448ac16f29b2b83350b7eccbf77fb781c3999aa6848"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"log",
|
||||
"os_pipe",
|
||||
"rustix 1.1.5",
|
||||
"thiserror 2.0.21",
|
||||
"tree_magic_mini",
|
||||
"wayland-backend",
|
||||
"wayland-client",
|
||||
"wayland-protocols",
|
||||
"wayland-protocols-wlr",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "write16"
|
||||
version = "1.0.0"
|
||||
|
||||
+3
-3
@@ -63,14 +63,14 @@ i_overlay = { version = "9.2", default-features = false }
|
||||
# wgpu is the primary renderer; glow (OpenGL) is the fallback for GPUs/VMs where wgpu fails.
|
||||
# Default features off: we skip `links` (opening web links pulls in url/idna/ICU Unicode
|
||||
# tables we don't use) and the web-only screen-reader shim. Same set as PhotoCraft, plus glow.
|
||||
eframe = { version = "0.36", default-features = false, features = ["accesskit", "default_fonts", "wgpu", "glow", "wayland", "x11"] }
|
||||
eframe = { version = "0.37", default-features = false, features = ["accesskit", "default_fonts", "wgpu", "glow", "wayland", "x11"] }
|
||||
# Native file dialogs: Windows common dialogs, macOS NSOpenPanel, Linux XDG desktop portal.
|
||||
rfd = "0.17"
|
||||
# Lists and loads the OS's installed fonts for Preferences › Appearance (MIT).
|
||||
# Without the `fontconfig` feature, Linux scans the standard font folders directly
|
||||
# (/usr/share/fonts, /usr/local/share/fonts, ~/.local/share/fonts, ~/.fonts).
|
||||
fontdb = { version = "0.23", default-features = false, features = ["std", "fs", "memmap"] }
|
||||
egui = "0.36"
|
||||
egui = "0.37"
|
||||
# `Instant` and `SystemTime` that work in the browser too (std's panic on wasm32-unknown-unknown);
|
||||
# on other targets a re-export of std::time (MIT OR Apache-2.0; already in the tree via winit).
|
||||
web-time = "1"
|
||||
@@ -160,7 +160,7 @@ winreg = "0.55"
|
||||
# smaller. The browser glue is wasm-bindgen's (MIT OR Apache-2.0), already under eframe's web
|
||||
# backend.
|
||||
[target.'cfg(target_arch = "wasm32")'.dependencies]
|
||||
eframe = { version = "0.36", default-features = false, features = ["accesskit", "default_fonts", "glow"] }
|
||||
eframe = { version = "0.37", default-features = false, features = ["accesskit", "default_fonts", "glow"] }
|
||||
wasm-bindgen = "0.2"
|
||||
wasm-bindgen-futures = "0.4"
|
||||
js-sys = "0.3"
|
||||
|
||||
@@ -112,7 +112,7 @@ on the console, and that string shows in English.
|
||||
|
||||
## Scripts and direction
|
||||
|
||||
egui 0.36 lays text out glyph by glyph, without the Unicode bidirectional algorithm or
|
||||
egui 0.37 lays text out glyph by glyph, without the Unicode bidirectional algorithm or
|
||||
shaping. So:
|
||||
|
||||
| Script | Today |
|
||||
|
||||
@@ -63,7 +63,7 @@ Priority: **P0** = M0–M2 skeleton must have, **P1** = parity core, **P2** = lo
|
||||
| Concern | Choice | Why |
|
||||
|---|---|---|
|
||||
| Language | Rust 2024 edition, stable toolchain (MSRV 1.95, ADR 0062: the macOS Apple Event crate needs it; CI builds with current stable) | Memory safety, fearless parallelism, one language for engine, UI, CLI and web. |
|
||||
| UI | **egui / eframe 0.36** (wgpu backend) | Immediate mode keeps the UI a thin function of state, matches PhotoCraft, runs native and on the web. |
|
||||
| UI | **egui / eframe 0.37** (wgpu backend) | Immediate mode keeps the UI a thin function of state, matches PhotoCraft, runs native and on the web. |
|
||||
| Rendering (oracle) | In-house CPU rasterizer: Bézier flattening + signed-area coverage accumulation, rayon row parallelism | Deterministic, testable, headless; the reference every other renderer is compared against. |
|
||||
| Rendering (interactive, M3) | wgpu compute/fragment renderer (sparse strips or tile binning in the style of public Vello/Pathfinder papers), compared per-pixel against the CPU oracle | Fast stage at high zoom and 4K; GPU and CPU must agree within a tolerance in tests. |
|
||||
| Geometry | In-house `geom` crate (affine, Bézier, flattening, hit test); `kurbo`-compatible API shape | Small, no_std-friendly, full control over tolerance and determinism. |
|
||||
|
||||
+5
-5
@@ -14,7 +14,7 @@
|
||||
//! The test at the bottom runs the whole interface headless with AccessKit on and fails on any
|
||||
//! interactive node without a name or role.
|
||||
|
||||
use egui::{Id, Rect, Response, Stroke, StrokeKind, WidgetInfo, WidgetType};
|
||||
use egui::{Id, Rect, Response, Stroke, StrokeKind, WidgetInfo, Role};
|
||||
|
||||
/// Names a control for assistive technology, for controls whose text is a value or nothing.
|
||||
pub trait Named {
|
||||
@@ -48,7 +48,7 @@ pub fn focus_ring(ui: &egui::Ui, resp: &Response) {
|
||||
/// assistive technology, and its focus ring.
|
||||
/// A control allocated with `Sense::hover()` because it can't act now (Align with nothing
|
||||
/// selected) reads as unavailable.
|
||||
pub fn control(ui: &egui::Ui, resp: &Response, typ: WidgetType, name: &str, on: Option<bool>) {
|
||||
pub fn control(ui: &egui::Ui, resp: &Response, typ: Role, name: &str, on: Option<bool>) {
|
||||
let enabled = resp.enabled() && (resp.sense.senses_click() || resp.sense.senses_drag());
|
||||
resp.widget_info(|| match on {
|
||||
Some(v) => WidgetInfo::selected(typ, enabled, v, name),
|
||||
@@ -192,18 +192,18 @@ impl Region {
|
||||
}
|
||||
|
||||
fn key(self) -> Id {
|
||||
Id::new(("a11y_region", self))
|
||||
Id::unique(("a11y_region", self))
|
||||
}
|
||||
}
|
||||
|
||||
/// Sets this frame's Ctrl+F6 order (the dock's, ADR 0075).
|
||||
pub fn set_order(ctx: &egui::Context, order: Vec<Region>) {
|
||||
ctx.data_mut(|d| d.insert_temp(Id::new("a11y_region_order"), order));
|
||||
ctx.data_mut(|d| d.insert_temp(Id::unique("a11y_region_order"), order));
|
||||
}
|
||||
|
||||
/// The Ctrl+F6 order: the stage, the panels as docked, the tools.
|
||||
pub fn order(ctx: &egui::Context) -> Vec<Region> {
|
||||
ctx.data(|d| d.get_temp::<Vec<Region>>(Id::new("a11y_region_order"))).unwrap_or_else(|| vec![Region::Stage, Region::Tools])
|
||||
ctx.data(|d| d.get_temp::<Vec<Region>>(Id::unique("a11y_region_order"))).unwrap_or_else(|| vec![Region::Stage, Region::Tools])
|
||||
}
|
||||
|
||||
/// Where a panel is this frame and the widget that takes focus when Ctrl+F6 lands on it.
|
||||
|
||||
+2
-2
@@ -137,7 +137,7 @@ pub fn window(app: &mut App, ctx: &egui::Context) {
|
||||
fn grid_window(app: &mut App, ctx: &egui::Context) {
|
||||
let Some(d) = &mut app.aids_dialogs.grid else { return };
|
||||
let (mut ok, mut cancel) = (false, false);
|
||||
crate::windows::new(ctx, tr!("Edit Grid")).id(egui::Id::new("edit_grid")).collapsible(false).resizable(false).anchor(egui::Align2::CENTER_CENTER, [0.0, -80.0]).show(ctx, |ui| {
|
||||
crate::windows::new(ctx, tr!("Edit Grid")).id(egui::Id::unique("edit_grid")).collapsible(false).resizable(false).anchor(egui::Align2::CENTER_CENTER, [0.0, -80.0]).show(ctx, |ui| {
|
||||
ui.set_min_width(380.0);
|
||||
form_row(ui, FORM_LABEL_DIALOG, tr!("Colour"), |ui| {
|
||||
crate::colour::button_alpha(ui, &mut d.color).named(tr!("Grid colour"));
|
||||
@@ -171,7 +171,7 @@ pub fn accept_grid(app: &mut App) {
|
||||
fn guides_window(app: &mut App, ctx: &egui::Context) {
|
||||
let Some(d) = &mut app.aids_dialogs.guides else { return };
|
||||
let (mut ok, mut cancel) = (false, false);
|
||||
crate::windows::new(ctx, tr!("Edit Guides")).id(egui::Id::new("edit_guides")).collapsible(false).resizable(false).anchor(egui::Align2::CENTER_CENTER, [0.0, -80.0]).show(ctx, |ui| {
|
||||
crate::windows::new(ctx, tr!("Edit Guides")).id(egui::Id::unique("edit_guides")).collapsible(false).resizable(false).anchor(egui::Align2::CENTER_CENTER, [0.0, -80.0]).show(ctx, |ui| {
|
||||
ui.set_min_width(420.0);
|
||||
form_row(ui, FORM_LABEL_DIALOG, tr!("Colour"), |ui| {
|
||||
crate::colour::button_alpha(ui, &mut d.color).named(tr!("Guide colour"));
|
||||
|
||||
+17
-13
@@ -321,6 +321,8 @@ pub struct Shot {
|
||||
pub path: PathBuf,
|
||||
pub frames: u32,
|
||||
pub requested: bool,
|
||||
/// Where the renderer hands the picture back, once it has read the pixels.
|
||||
pub image: Option<std::sync::mpsc::Receiver<std::sync::Arc<egui::ColorImage>>>,
|
||||
/// Scaled down to this width when written (`--shot-width`).
|
||||
pub width: Option<u32>,
|
||||
}
|
||||
@@ -821,7 +823,7 @@ impl App {
|
||||
show_about: false,
|
||||
show_files: false,
|
||||
show_licenses: false,
|
||||
shot: shot.map(|path| Shot { path, frames: 0, requested: false, width: None }),
|
||||
shot: shot.map(|path| Shot { path, frames: 0, requested: false, image: None, width: None }),
|
||||
cursor_stage: None,
|
||||
tl_scroll: 0.0,
|
||||
tl_cell_w: timeline::CELL_DEFAULT,
|
||||
@@ -4405,12 +4407,7 @@ impl App {
|
||||
let Some(shot) = &mut self.shot else { return };
|
||||
shot.frames += 1;
|
||||
ctx.request_repaint();
|
||||
let image = ctx.input(|i| {
|
||||
i.raw.events.iter().find_map(|e| match e {
|
||||
egui::Event::Screenshot { image, .. } => Some(image.clone()),
|
||||
_ => None,
|
||||
})
|
||||
});
|
||||
let image = shot.image.as_ref().and_then(|r| r.try_recv().ok());
|
||||
if let Some(img) = image {
|
||||
let img = match shot.width {
|
||||
Some(w) => shrink(&img, w as usize),
|
||||
@@ -4425,7 +4422,14 @@ impl App {
|
||||
}
|
||||
if shot.frames >= SHOT_FRAMES && !shot.requested {
|
||||
shot.requested = true;
|
||||
ctx.send_viewport_cmd(egui::ViewportCommand::Screenshot(egui::UserData::default()));
|
||||
let (send, receive) = std::sync::mpsc::channel();
|
||||
shot.image = Some(receive);
|
||||
let wake = ctx.clone();
|
||||
ctx.request_screenshot(move |img| {
|
||||
// The app may have closed meanwhile: then nobody waits for the picture.
|
||||
let _ = send.send(img);
|
||||
wake.request_repaint();
|
||||
});
|
||||
}
|
||||
if shot.frames > SHOT_FRAMES + 600 {
|
||||
eprintln!("screenshot: the renderer never delivered a frame");
|
||||
@@ -4447,7 +4451,7 @@ impl App {
|
||||
let mut submit = false;
|
||||
let mut cancel = false;
|
||||
let title = crate::i18n::t(p.title);
|
||||
crate::windows::new(ctx, title).id(egui::Id::new(("prompt", p.title))).collapsible(false).resizable(false).anchor(egui::Align2::CENTER_CENTER, [0.0, -80.0]).show(ctx, |ui| {
|
||||
crate::windows::new(ctx, title).id(egui::Id::unique(("prompt", p.title))).collapsible(false).resizable(false).anchor(egui::Align2::CENTER_CENTER, [0.0, -80.0]).show(ctx, |ui| {
|
||||
ui.set_min_width(360.0);
|
||||
let r = ui.add(egui::TextEdit::singleline(&mut p.text).desired_width(f32::INFINITY)).named(title);
|
||||
if p.focus {
|
||||
@@ -4484,7 +4488,7 @@ impl App {
|
||||
|
||||
fn about_window(&mut self, ctx: &egui::Context) {
|
||||
let mut open = self.show_about;
|
||||
let shown = crate::windows::new(ctx, tr!("About AniCraft")).id(egui::Id::new("about_window")).open(&mut open).collapsible(false).resizable(false).show(ctx, |ui| {
|
||||
let shown = crate::windows::new(ctx, tr!("About AniCraft")).id(egui::Id::unique("about_window")).open(&mut open).collapsible(false).resizable(false).show(ctx, |ui| {
|
||||
ui.add(egui::Image::new((app_mark(ctx).id(), egui::vec2(64.0, 64.0))));
|
||||
ui.heading("AniCraft");
|
||||
ui.label(tr!("Version {version} · {stage}", version = env!("CARGO_PKG_VERSION"), stage = crate::i18n::t(RELEASE_STAGE)));
|
||||
@@ -4516,7 +4520,7 @@ impl App {
|
||||
(tr!("Screenshots"), root.join("shots")),
|
||||
];
|
||||
let mut opened: Option<Result<(), String>> = None;
|
||||
let shown = crate::windows::new(ctx, tr!("Project Files")).id(egui::Id::new("files_window")).open(&mut open).collapsible(false).resizable(false).default_width(620.0).show(ctx, |ui| {
|
||||
let shown = crate::windows::new(ctx, tr!("Project Files")).id(egui::Id::unique("files_window")).open(&mut open).collapsible(false).resizable(false).default_width(620.0).show(ctx, |ui| {
|
||||
ui.label(theme::text(theme::Type::Label, tr!("Where AniCraft's documents and files are on this computer")));
|
||||
ui.add_space(4.0);
|
||||
egui::Grid::new("files").num_columns(3).spacing([10.0, 6.0]).striped(true).show(ui, |ui| {
|
||||
@@ -4550,7 +4554,7 @@ impl App {
|
||||
/// first use and kept in the context. 128 px stays sharp at 64 pt on a 2× display.
|
||||
pub(crate) fn app_mark(ctx: &egui::Context) -> egui::TextureHandle {
|
||||
const PNG: &[u8] = include_bytes!("../assets/app-icon/hicolor/128x128/apps/ai.storyteller.anicraft.png");
|
||||
let id = egui::Id::new("anicraft-app-mark");
|
||||
let id = egui::Id::unique("anicraft-app-mark");
|
||||
if let Some(tex) = ctx.data(|d| d.get_temp::<egui::TextureHandle>(id)) {
|
||||
return tex;
|
||||
}
|
||||
@@ -4673,7 +4677,7 @@ impl eframe::App for App {
|
||||
_ => {
|
||||
let over = at - egui::vec2(0.0, 120.0);
|
||||
raw.events.push(egui::Event::PointerMoved(over));
|
||||
raw.events.push(egui::Event::MouseWheel { unit: egui::MouseWheelUnit::Point, delta: egui::vec2(0.0, -2000.0), modifiers: Modifiers::NONE, phase: egui::TouchPhase::Move });
|
||||
raw.events.push(egui::Event::MouseWheel { unit: egui::MouseWheelUnit::Point, delta: egui::vec2(0.0, -2000.0), modifiers: Modifiers::NONE, phase: egui::TouchPhase::Move, source: egui::MouseWheelSource::Wheel });
|
||||
self.shot_click.set(None);
|
||||
self.shot_step = 0;
|
||||
}
|
||||
|
||||
+2
-2
@@ -407,7 +407,7 @@ fn draw_graph(ui: &mut egui::Ui, d: &Dialog, g: &Graph) -> Option<u32> {
|
||||
fn choice(ui: &mut egui::Ui, widget: &str, name: &str, current: u64, list: &[(u64, String)], tip: &str) -> Option<u64> {
|
||||
let mut picked = None;
|
||||
let shown = list.iter().find(|(id, _)| *id == current).map_or_else(String::new, |(_, n)| n.clone());
|
||||
egui::ComboBox::from_id_salt(egui::Id::new(("audio_keys_choice", widget))).width(theme::fit(ui, 220.0)).selected_text(text(Type::Body, shown)).show_ui(ui, |ui| {
|
||||
egui::ComboBox::from_id_salt(egui::Id::unique(("audio_keys_choice", widget))).width(theme::fit(ui, 220.0)).selected_text(text(Type::Body, shown)).show_ui(ui, |ui| {
|
||||
for (id, n) in list {
|
||||
if ui.selectable_label(*id == current, text(Type::Body, n.clone())).clicked() && *id != current {
|
||||
picked = Some(*id);
|
||||
@@ -439,7 +439,7 @@ pub fn show(app: &mut App, ctx: &egui::Context) {
|
||||
let mut changed = false;
|
||||
let (mut ok, mut cancel) = (false, false);
|
||||
let mut retarget = false;
|
||||
let id = egui::Id::new(match d.kind {
|
||||
let id = egui::Id::unique(match d.kind {
|
||||
Kind::Keys => "audio_keys",
|
||||
Kind::Lips => "lip_sync",
|
||||
});
|
||||
|
||||
+1
-1
@@ -406,7 +406,7 @@ pub fn window(app: &mut App, ctx: &egui::Context) {
|
||||
let btn = egui::vec2(96.0, crate::theme::TARGET + 4.0);
|
||||
let title = tr!("Recover unsaved work");
|
||||
let shown = crate::windows::new(ctx, title)
|
||||
.id(egui::Id::new("recover_window"))
|
||||
.id(egui::Id::unique("recover_window"))
|
||||
.open(&mut open)
|
||||
.collapsible(false)
|
||||
.resizable(false)
|
||||
|
||||
+4
-4
@@ -15,7 +15,7 @@ use crate::app::{App, Tool};
|
||||
use crate::theme::{T, Type, text};
|
||||
use anicraft_engine::brush_library::{BUILTIN, BrushPreset, builtin, builtin_hint};
|
||||
use anicraft_engine::geom::pressure::{CURVE_PRESETS, PressureCurve};
|
||||
use egui::{Rect, Sense, Stroke, WidgetType, pos2, vec2};
|
||||
use egui::{Rect, Sense, Stroke, Role, pos2, vec2};
|
||||
use serde_json::json;
|
||||
use std::collections::HashMap;
|
||||
|
||||
@@ -127,7 +127,7 @@ pub fn show(app: &mut App, ctx: &egui::Context) {
|
||||
}
|
||||
let mut open = true;
|
||||
let at = ctx.content_rect().right_top() + vec2(-620.0, 90.0);
|
||||
let shown = crate::windows::new(ctx, tr!("Brush Library")).id(egui::Id::new("brush_library")).open(&mut open).default_pos(at).default_width(300.0).resizable(true).collapsible(false).show(ctx, |ui| panel(app, ui));
|
||||
let shown = crate::windows::new(ctx, tr!("Brush Library")).id(egui::Id::unique("brush_library")).open(&mut open).default_pos(at).default_width(300.0).resizable(true).collapsible(false).show(ctx, |ui| panel(app, ui));
|
||||
a11y::name_title_bar(&shown, tr!("Brush Library"));
|
||||
app.brush_lib.open &= open;
|
||||
}
|
||||
@@ -188,7 +188,7 @@ fn panel(app: &mut App, ui: &mut egui::Ui) {
|
||||
let name_at = pos2(img.right() + 8.0, rect.center().y);
|
||||
let color = if selected { T.on_active } else { T.text };
|
||||
ui.painter().text(name_at, egui::Align2::LEFT_CENTER, shown, crate::theme::font(Type::Body), color);
|
||||
a11y::control(ui, &resp, WidgetType::SelectableLabel, &tr!("{name} brush", name = shown), Some(selected));
|
||||
a11y::control(ui, &resp, Role::Button, &tr!("{name} brush", name = shown), Some(selected));
|
||||
let hint = key.map(|k| crate::i18n::t(builtin_hint(k)).to_string()).unwrap_or_else(|| tr!("Your brush. Right-click to rename, export or delete it.").to_string());
|
||||
let resp = resp.on_hover_text(hint);
|
||||
if resp.clicked() {
|
||||
@@ -384,7 +384,7 @@ pub fn props(app: &mut App, ui: &mut egui::Ui, row: impl Fn(&mut egui::Ui, &str,
|
||||
/// elsewhere to add one, double-click or right-click a point to remove it.
|
||||
pub fn curve_editor(ui: &mut egui::Ui, curve: &mut PressureCurve) -> egui::Response {
|
||||
let (rect, resp) = ui.allocate_exact_size(vec2(CURVE_SIDE, CURVE_SIDE), Sense::click_and_drag());
|
||||
a11y::control(ui, &resp, WidgetType::Button, tr!("Pressure curve"), None);
|
||||
a11y::control(ui, &resp, Role::Button, tr!("Pressure curve"), None);
|
||||
let resp = resp.on_hover_text(tr!("Pen pressure (across) to the brush's size or opacity (up). Drag a point to move it, drag elsewhere to add one, double-click a point to remove it"));
|
||||
let inner = rect.shrink(5.0);
|
||||
let to_screen = |p: [f32; 2]| pos2(inner.left() + p[0] * inner.width(), inner.bottom() - p[1] * inner.height());
|
||||
|
||||
+2
-2
@@ -547,7 +547,7 @@ fn draw_sweep_alpha(painter: &egui::Painter, xf: Xf, o: &BrushOptions, samples:
|
||||
|
||||
/// One reused texture for the live wash, so a stroke does not leak a texture every frame.
|
||||
fn sweep_texture(ctx: &egui::Context, image: egui::ColorImage) -> egui::TextureHandle {
|
||||
let id = egui::Id::new("anicraft.brush.sweep");
|
||||
let id = egui::Id::unique("anicraft.brush.sweep");
|
||||
let options = egui::TextureOptions::LINEAR;
|
||||
if let Some(mut tex) = ctx.data(|d| d.get_temp::<egui::TextureHandle>(id)) {
|
||||
tex.set(image, options);
|
||||
@@ -661,7 +661,7 @@ mod tests {
|
||||
// A stroke that crosses itself, with a dab's worth of pressure readings.
|
||||
app.brush_samples = vec![(Vec2::new(40.0, 40.0), Some(0.8)), (Vec2::new(160.0, 120.0), Some(0.6)), (Vec2::new(40.0, 120.0), None), (Vec2::new(160.0, 40.0), Some(0.9))];
|
||||
let xf = Xf { origin: egui::pos2(20.0, 20.0), zoom: 1.5 };
|
||||
let sweep = egui::Id::new("anicraft.brush.sweep");
|
||||
let sweep = egui::Id::unique("anicraft.brush.sweep");
|
||||
let texture = |ctx: &egui::Context| ctx.data(|d| d.get_temp::<egui::TextureHandle>(sweep));
|
||||
let frame = |app: &App| {
|
||||
let input = egui::RawInput { screen_rect: Some(egui::Rect::from_min_size(Pos2::ZERO, egui::vec2(800.0, 600.0))), ..Default::default() };
|
||||
|
||||
+10
-10
@@ -107,7 +107,7 @@ struct Recent {
|
||||
}
|
||||
|
||||
fn recent_id() -> Id {
|
||||
Id::new("anicraft.colour.recent")
|
||||
Id::unique("anicraft.colour.recent")
|
||||
}
|
||||
|
||||
fn remember(ctx: &egui::Context, popup: Id, c: [u8; 3]) {
|
||||
@@ -138,7 +138,7 @@ struct Dropper {
|
||||
}
|
||||
|
||||
fn dropper_id() -> Id {
|
||||
Id::new("anicraft.colour.dropper")
|
||||
Id::unique("anicraft.colour.dropper")
|
||||
}
|
||||
|
||||
fn dropper(ctx: &egui::Context) -> Dropper {
|
||||
@@ -208,7 +208,7 @@ pub fn button_alpha(ui: &mut egui::Ui, c: &mut [u8; 4]) -> Response {
|
||||
fn button_inner(ui: &mut egui::Ui, c: &mut [u8; 4], alpha: bool) -> Response {
|
||||
let size = ui.spacing().interact_size;
|
||||
let (rect, mut resp) = ui.allocate_exact_size(size, Sense::click());
|
||||
resp.widget_info(|| egui::WidgetInfo::new(egui::WidgetType::ColorButton));
|
||||
resp.widget_info(|| egui::WidgetInfo::new(egui::Role::ColorWell));
|
||||
let popup = resp.id.with("colour_popup");
|
||||
let open = egui::Popup::is_id_open(ui.ctx(), popup);
|
||||
if ui.is_rect_visible(rect) {
|
||||
@@ -257,7 +257,7 @@ pub(crate) fn name_popup(r: &Response, name: &str) {
|
||||
|
||||
/// The picker itself: swatches or mixer, then the colour, its hex and its alpha.
|
||||
pub(crate) fn picker(ui: &mut egui::Ui, popup: Id, c: &mut [u8; 4], alpha: bool, none: Option<&mut bool>) -> bool {
|
||||
let view_id = Id::new("anicraft.colour.view");
|
||||
let view_id = Id::unique("anicraft.colour.view");
|
||||
let mut view: View = ui.data(|d| d.get_temp(view_id)).unwrap_or_default();
|
||||
let mut changed = false;
|
||||
// The eyedropper: this picker is the one a click on the stage gives its colour to; the
|
||||
@@ -402,7 +402,7 @@ fn view_toggle(ui: &mut egui::Ui, view: View) -> Response {
|
||||
}
|
||||
}
|
||||
}
|
||||
crate::a11y::control(ui, &resp, egui::WidgetType::Button, name, None);
|
||||
crate::a11y::control(ui, &resp, egui::Role::Button, name, None);
|
||||
resp.on_hover_text(tip)
|
||||
}
|
||||
|
||||
@@ -510,7 +510,7 @@ fn swatches(ui: &mut egui::Ui, current: [u8; 3]) -> (Option<[u8; 3]>, Option<[u8
|
||||
resp.clone().on_hover_text(text(Type::Data, tip));
|
||||
}
|
||||
// One control for the whole grid (a click picks the cell under the pointer).
|
||||
crate::a11y::control(ui, &resp, egui::WidgetType::Button, if doc.is_empty() { tr!("Colour swatches") } else { tr!("Colour swatches and the document's swatches") }, None);
|
||||
crate::a11y::control(ui, &resp, egui::Role::Button, if doc.is_empty() { tr!("Colour swatches") } else { tr!("Colour swatches and the document's swatches") }, None);
|
||||
let over = hovered.and_then(|i| cells.get(i)).map(|(_, c)| *c);
|
||||
(if resp.clicked() { resp.interact_pointer_pos().and_then(hit).map(|(_, c)| c) } else { None }, over)
|
||||
}
|
||||
@@ -570,7 +570,7 @@ mod tests {
|
||||
let ctx = egui::Context::default();
|
||||
ctx.enable_accesskit();
|
||||
crate::theme::apply(&ctx);
|
||||
let id = Id::new("fill_popup");
|
||||
let id = Id::unique("fill_popup");
|
||||
let mut c = [255, 255, 255, 255];
|
||||
let frame = |ctx: &egui::Context, c: &mut [u8; 4], events: Vec<Event>| -> (bool, TreeUpdate) {
|
||||
let mut changed = false;
|
||||
@@ -622,13 +622,13 @@ mod tests {
|
||||
click(&ctx, &mut c, back);
|
||||
let (_, t) = frame(&ctx, &mut c, Vec::new());
|
||||
assert!(find(&t, "Colour swatches").is_some());
|
||||
ctx.data_mut(|d| d.remove::<View>(Id::new("anicraft.colour.view")));
|
||||
ctx.data_mut(|d| d.remove::<View>(Id::unique("anicraft.colour.view")));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn recent_colours_keep_one_entry_per_popup_session() {
|
||||
let ctx = egui::Context::default();
|
||||
let (a, b) = (Id::new("a"), Id::new("b"));
|
||||
let (a, b) = (Id::unique("a"), Id::unique("b"));
|
||||
let list = |ctx: &egui::Context| ctx.data(|d| d.get_temp::<Recent>(recent_id())).map(|r| r.colours).unwrap_or_default();
|
||||
// A drag in the mixer: one entry, the last colour.
|
||||
for v in [10, 20, 30] {
|
||||
@@ -651,7 +651,7 @@ mod tests {
|
||||
#[test]
|
||||
fn a_click_on_the_stage_gives_the_open_picker_its_colour_once() {
|
||||
let ctx = egui::Context::default();
|
||||
let (a, b) = (Id::new("fill_popup"), Id::new("stroke_popup"));
|
||||
let (a, b) = (Id::unique("fill_popup"), Id::unique("stroke_popup"));
|
||||
let mut c = [10, 20, 30, 128];
|
||||
let frame = |ctx: &egui::Context, id: Id, c: &mut [u8; 4]| {
|
||||
let mut changed = false;
|
||||
|
||||
+6
-6
@@ -15,7 +15,7 @@ use crate::a11y::{self, Named};
|
||||
use crate::app::App;
|
||||
use crate::theme::{T, Type, text, to_color32, with_type};
|
||||
use anicraft_engine::doc::{ElementKind, GradientStop, MAX_FOCAL, MAX_GRADIENT_STOPS, Paint, Rgba, Spread, ramp_at};
|
||||
use egui::{Id, Key, Rect, Response, Sense, Stroke, StrokeKind, WidgetType, pos2, vec2};
|
||||
use egui::{Id, Key, Rect, Response, Sense, Stroke, StrokeKind, Role, pos2, vec2};
|
||||
use serde_json::{Value, json};
|
||||
|
||||
/// How far (screen points) a stop dragged off the bar must go to be removed.
|
||||
@@ -128,7 +128,7 @@ fn paint_preview(p: &egui::Painter, r: Rect, paint: Option<&Paint>) {
|
||||
pub fn swatch(ui: &mut egui::Ui, paint: Option<&Paint>, bitmaps: &[(u64, String)]) -> (Response, Option<FillEdit>) {
|
||||
let size = ui.spacing().interact_size;
|
||||
let (rect, mut resp) = ui.allocate_exact_size(size, Sense::click());
|
||||
resp.widget_info(|| egui::WidgetInfo::new(WidgetType::ColorButton));
|
||||
resp.widget_info(|| egui::WidgetInfo::new(Role::ColorWell));
|
||||
let popup = resp.id.with("colour_popup");
|
||||
let open = egui::Popup::is_id_open(ui.ctx(), popup);
|
||||
if ui.is_rect_visible(rect) {
|
||||
@@ -262,7 +262,7 @@ fn gradient_swatches(ui: &mut egui::Ui, paint: Option<&Paint>) -> Option<FillEdi
|
||||
let edge = if on { Stroke::new(2.0, T.accent) } else if resp.hovered() { Stroke::new(1.5, T.selection) } else { Stroke::new(1.0, T.border) };
|
||||
ui.painter().rect_stroke(r, 0.0, edge, StrokeKind::Outside);
|
||||
let name = crate::swatches_panel::describe(&sw.paint, &sw.name);
|
||||
a11y::control(ui, &resp, WidgetType::Button, &tr!("Gradient swatch: {name}", name = name.as_str()), Some(on));
|
||||
a11y::control(ui, &resp, Role::Button, &tr!("Gradient swatch: {name}", name = name.as_str()), Some(on));
|
||||
if resp.on_hover_text(name).clicked() {
|
||||
out = Some(FillEdit::Set { label: tr_noop!("Fill"), live: false, params: crate::swatches_panel::fill_params(&sw.paint) });
|
||||
}
|
||||
@@ -368,7 +368,7 @@ fn stop_bar(ui: &mut egui::Ui, popup: Id, stops: &mut Vec<GradientStop>) -> Opti
|
||||
let can_remove = stops.len() > 2;
|
||||
let w = BAR_WIDTH;
|
||||
let (strip, resp) = ui.allocate_exact_size(vec2(w, 18.0), Sense::click());
|
||||
a11y::control(ui, &resp, WidgetType::Button, tr!("Gradient: add a colour stop"), None);
|
||||
a11y::control(ui, &resp, Role::Button, tr!("Gradient: add a colour stop"), None);
|
||||
let resp = resp.on_hover_text(tr!("Click to add a colour stop. Drag a stop to move it, or off the bar to remove it. With a stop focused, the arrow keys move it and Delete removes it."));
|
||||
let p = ui.painter();
|
||||
// A checkerboard under the ramp shows its opacity.
|
||||
@@ -407,7 +407,7 @@ fn stop_bar(ui: &mut egui::Ui, popup: Id, stops: &mut Vec<GradientStop>) -> Opti
|
||||
let r = ui.interact(hit, popup.with(("fill_stop_marker", i)), Sense::click_and_drag());
|
||||
let at = format!("{:.0}", off * 100.0);
|
||||
let alpha = stops.get(i).map(|s| format!("{:.0}", s.color.sanitized().a * 100.0)).unwrap_or_else(|| "100".into());
|
||||
a11y::control(ui, &r, WidgetType::Button, &tr!("Colour stop {stop} of {count} at {at}%, alpha {alpha}%", stop = i + 1, count = count, at = at, alpha = alpha), Some(i == sel));
|
||||
a11y::control(ui, &r, Role::Button, &tr!("Colour stop {stop} of {count} at {at}%, alpha {alpha}%", stop = i + 1, count = count, at = at, alpha = alpha), Some(i == sel));
|
||||
if r.clicked() || r.drag_started() || r.gained_focus() {
|
||||
sel = i;
|
||||
}
|
||||
@@ -559,7 +559,7 @@ mod tests {
|
||||
fn picker_once(paint: Option<&Paint>, bitmaps: &[(u64, String)]) -> Option<FillEdit> {
|
||||
let ctx = egui::Context::default();
|
||||
let mut edit = Some(FillEdit::None(false));
|
||||
let mut out = ctx.run_ui(egui::RawInput::default(), |ui| edit = fill_picker(ui, Id::new("test_fill"), paint, bitmaps));
|
||||
let mut out = ctx.run_ui(egui::RawInput::default(), |ui| edit = fill_picker(ui, Id::unique("test_fill"), paint, bitmaps));
|
||||
out.textures_delta.clear();
|
||||
edit
|
||||
}
|
||||
|
||||
+2
-2
@@ -336,11 +336,11 @@ pub fn offer(app: &mut App, ctx: &egui::Context, subject: Subject) {
|
||||
|
||||
/// The dialog drawn on `layer`, if it is one of ours.
|
||||
fn dialog_on(layer: egui::LayerId) -> Option<Dialog> {
|
||||
Dialog::ALL.into_iter().find(|d| d.window_id().is_some_and(|w| layer.id == egui::Id::new(w)))
|
||||
Dialog::ALL.into_iter().find(|d| d.window_id().is_some_and(|w| layer.id == egui::Id::unique(w)))
|
||||
}
|
||||
|
||||
fn visible(ctx: &egui::Context, d: Dialog) -> bool {
|
||||
d.window_id().is_some_and(|w| ctx.memory(|m| m.areas().is_visible(&egui::LayerId::new(egui::Order::Middle, egui::Id::new(w)))))
|
||||
d.window_id().is_some_and(|w| ctx.memory(|m| m.areas().is_visible(&egui::LayerId::new(egui::Order::Middle, egui::Id::unique(w)))))
|
||||
}
|
||||
|
||||
/// What F1 is about now. `pointer`: whether the pointer counts (not when the request comes from
|
||||
|
||||
@@ -81,7 +81,7 @@ pub fn window(app: &mut App, ctx: &egui::Context) {
|
||||
folders.sort_by_key(|(_, p)| p.to_lowercase());
|
||||
let (mut submit, mut cancel) = (false, false);
|
||||
let title = tr!("Convert to Symbol");
|
||||
crate::windows::new(ctx, title).id(egui::Id::new("convert_symbol")).collapsible(false).resizable(false).anchor(egui::Align2::CENTER_CENTER, [0.0, -80.0]).show(ctx, |ui| {
|
||||
crate::windows::new(ctx, title).id(egui::Id::unique("convert_symbol")).collapsible(false).resizable(false).anchor(egui::Align2::CENTER_CENTER, [0.0, -80.0]).show(ctx, |ui| {
|
||||
ui.set_min_width(380.0);
|
||||
form_row(ui, FORM_LABEL_DOCK, tr!("Name"), |ui| {
|
||||
let r = ui.add(egui::TextEdit::singleline(&mut d.name).desired_width(f32::INFINITY)).named(tr!("Symbol name"));
|
||||
|
||||
+4
-4
@@ -15,7 +15,7 @@ use crate::app::App;
|
||||
use crate::theme::{self, FORM_LABEL_DOCK, Section, T, Type, color, font, form_row, text, with_type};
|
||||
use anicraft_engine::doc::data::{MAX_SPAN, MAX_VALUE};
|
||||
use anicraft_engine::doc::{Binding, BoundProperty, DataId, DataTable, ElementId, ElementKind, Interp, LibraryItem, SymbolKind};
|
||||
use egui::{Align2, Rect, Sense, Stroke, StrokeKind, WidgetType, pos2, vec2};
|
||||
use egui::{Align2, Rect, Sense, Stroke, StrokeKind, Role, pos2, vec2};
|
||||
use serde_json::{Value, json};
|
||||
|
||||
/// The engine's English for what the section lists, for the catalogs: translated where drawn.
|
||||
@@ -82,7 +82,7 @@ fn key_combo(app: &mut App, ui: &mut egui::Ui, id: DataId, place: &str) {
|
||||
let Some((key, names)) = app.s.doc.data_table(id).map(|t| (t.key.clone(), t.columns.iter().map(|c| c.name.clone()).collect::<Vec<_>>())) else { return };
|
||||
let shown = key.clone().unwrap_or_else(|| tr!("Row number").to_string());
|
||||
let mut pick: Option<Option<String>> = None;
|
||||
egui::ComboBox::from_id_salt(egui::Id::new("data_key").with(place))
|
||||
egui::ComboBox::from_id_salt(egui::Id::unique("data_key").with(place))
|
||||
.width(theme::fit(ui, 150.0))
|
||||
.selected_text(text(Type::Body, shown))
|
||||
.show_ui(ui, |ui| {
|
||||
@@ -139,7 +139,7 @@ fn grid(ui: &mut egui::Ui, t: &DataTable) {
|
||||
let size = vec2(NUMBER_W + cols as f32 * CELL_W, (rows + 1) as f32 * ROW_H);
|
||||
egui::ScrollArea::both().id_salt("data_grid").auto_shrink([false, false]).show_viewport(ui, |ui, view| {
|
||||
let (rect, resp) = ui.allocate_exact_size(size, Sense::hover());
|
||||
a11y::control(ui, &resp, WidgetType::Label, &tr!("{name}: {detail}", name = t.name, detail = table_detail(t)), None);
|
||||
a11y::control(ui, &resp, Role::Label, &tr!("{name}: {detail}", name = t.name, detail = table_detail(t)), None);
|
||||
let p = ui.painter_at(ui.clip_rect());
|
||||
let o = rect.min;
|
||||
let (top, left) = (o.y + view.min.y, o.x + view.min.x);
|
||||
@@ -188,7 +188,7 @@ pub fn show(app: &mut App, ctx: &egui::Context) {
|
||||
};
|
||||
let mut open = true;
|
||||
let at = crate::windows::work_area(ctx).center() - vec2(280.0, 220.0);
|
||||
let shown = crate::windows::new(ctx, tr!("Data Table")).id(egui::Id::new("data_table_view")).open(&mut open).default_pos(at).default_size([560.0, 400.0]).min_width(320.0).resizable(true).collapsible(false).show(ctx, |ui| {
|
||||
let shown = crate::windows::new(ctx, tr!("Data Table")).id(egui::Id::unique("data_table_view")).open(&mut open).default_pos(at).default_size([560.0, 400.0]).min_width(320.0).resizable(true).collapsible(false).show(ctx, |ui| {
|
||||
ui.horizontal_wrapped(|ui| {
|
||||
ui.label(text(Type::Heading, t.name.as_str()));
|
||||
ui.label(text(Type::Caption, table_detail(&t)));
|
||||
|
||||
+3
-3
@@ -117,7 +117,7 @@ pub fn offer(app: &mut App, ctx: &egui::Context) {
|
||||
return;
|
||||
}
|
||||
let mut act: Option<bool> = None;
|
||||
egui::Area::new(egui::Id::new("desktop_offer")).order(egui::Order::Foreground).anchor(egui::Align2::RIGHT_BOTTOM, [-16.0, -40.0]).show(ctx, |ui| {
|
||||
egui::Area::new(egui::Id::unique("desktop_offer")).order(egui::Order::Foreground).anchor(egui::Align2::RIGHT_BOTTOM, [-16.0, -40.0]).show(ctx, |ui| {
|
||||
egui::Frame::popup(ui.style()).fill(T.panel_alt).inner_margin(egui::Margin::same(12)).show(ui, |ui| {
|
||||
ui.set_width(340.0);
|
||||
ui.label(text(Type::Label, tr!("Add AniCraft to your applications menu?")).strong());
|
||||
@@ -316,7 +316,7 @@ mod tests {
|
||||
let data = app.desktop.as_ref().map(|d| d.data_home.clone()).unwrap();
|
||||
assert!(app.desktop.as_ref().is_some_and(|d| d.offer));
|
||||
frames(&ctx, &mut app, 3, vec![]);
|
||||
let card = ctx.memory(|m| m.area_rect(egui::Id::new("desktop_offer"))).expect("the card is drawn");
|
||||
let card = ctx.memory(|m| m.area_rect(egui::Id::unique("desktop_offer"))).expect("the card is drawn");
|
||||
// Add to Menu: the first button on the card's bottom row.
|
||||
frames(&ctx, &mut app, 2, click(egui::pos2(card.min.x + 40.0, card.max.y - 24.0)));
|
||||
assert!(app.prefs.desktop_offered, "answered");
|
||||
@@ -334,7 +334,7 @@ mod tests {
|
||||
let _ = std::fs::remove_dir_all(&d.data_home);
|
||||
start_with(&mut app, d, false);
|
||||
frames(&ctx, &mut app, 3, vec![]);
|
||||
let card = ctx.memory(|m| m.area_rect(egui::Id::new("desktop_offer"))).expect("the card is drawn");
|
||||
let card = ctx.memory(|m| m.area_rect(egui::Id::unique("desktop_offer"))).expect("the card is drawn");
|
||||
frames(&ctx, &mut app, 2, click(egui::pos2(card.min.x + 170.0, card.max.y - 24.0)));
|
||||
assert!(app.prefs.desktop_offered);
|
||||
assert_eq!(app.desktop.as_ref().map(|d| (d.offer, d.entry.clone())), Some((false, Entry::None)));
|
||||
|
||||
+9
-9
@@ -43,7 +43,7 @@ fn confirm_modal(app: &mut App, ctx: &egui::Context) {
|
||||
let Some(p) = &mut app.confirm else { return };
|
||||
let mut decision: Option<bool> = None;
|
||||
let irreversible = p.conf.irreversible;
|
||||
egui::Modal::new(egui::Id::new("confirm")).show(ctx, |ui| {
|
||||
egui::Modal::new(egui::Id::unique("confirm")).show(ctx, |ui| {
|
||||
ui.set_width(420.0);
|
||||
ui.add_space(4.0);
|
||||
// The engine's English, translated when a catalog has that exact text.
|
||||
@@ -110,7 +110,7 @@ fn close_modal(app: &mut App, ctx: &egui::Context) {
|
||||
let Some(name) = names.first().cloned() else { return };
|
||||
let several = names.len() > 1;
|
||||
let mut choice = None;
|
||||
egui::Modal::new(egui::Id::new("close_guard")).show(ctx, |ui| {
|
||||
egui::Modal::new(egui::Id::unique("close_guard")).show(ctx, |ui| {
|
||||
ui.set_width(440.0);
|
||||
if several {
|
||||
ui.label(text(Type::Title, trn!("Save changes to {n} document before closing?", "Save changes to {n} documents before closing?", names.len())));
|
||||
@@ -286,7 +286,7 @@ fn palette(app: &mut App, ctx: &egui::Context) {
|
||||
let mut close = esc;
|
||||
let selected = p.selected;
|
||||
p.help = matches.get(selected).and_then(|(_, e, _)| e.help());
|
||||
egui::Area::new(egui::Id::new("palette")).order(egui::Order::Foreground).anchor(egui::Align2::CENTER_TOP, [0.0, 70.0]).show(ctx, |ui| {
|
||||
egui::Area::new(egui::Id::unique("palette")).order(egui::Order::Foreground).anchor(egui::Align2::CENTER_TOP, [0.0, 70.0]).show(ctx, |ui| {
|
||||
egui::Frame::popup(ui.style()).fill(T.panel_alt).inner_margin(egui::Margin::same(10)).show(ui, |ui| {
|
||||
ui.set_width(560.0);
|
||||
let r = ui.add(egui::TextEdit::singleline(&mut p.query).hint_text(tr!("Type a command, tool or setting…")).desired_width(f32::INFINITY).font(egui::TextStyle::Heading)).named(tr!("Command palette"));
|
||||
@@ -340,7 +340,7 @@ fn palette(app: &mut App, ctx: &egui::Context) {
|
||||
/// A font picker: the bundled default plus every installed family, filterable.
|
||||
fn font_picker(ui: &mut egui::Ui, id: &str, name: &str, current: &FontChoice, families: Option<&[String]>, bundled: &str) -> Option<FontChoice> {
|
||||
let mut picked = None;
|
||||
let filter_id = egui::Id::new(("font_filter", id));
|
||||
let filter_id = egui::Id::unique(("font_filter", id));
|
||||
let shown = match current {
|
||||
FontChoice::Bundled => tr!("Default ({font})", font = bundled),
|
||||
FontChoice::System(name) => name.clone(),
|
||||
@@ -390,7 +390,7 @@ fn preferences(app: &mut App, ctx: &egui::Context) {
|
||||
let title = if crate::platform::OS == crate::platform::Os::Mac { tr!("Settings") } else { tr!("Preferences") };
|
||||
let shown = crate::windows::new(ctx, title)
|
||||
// An id of its own: the window keeps its place when the language changes.
|
||||
.id(egui::Id::new("prefs_window"))
|
||||
.id(egui::Id::unique("prefs_window"))
|
||||
.open(&mut open)
|
||||
.collapsible(false)
|
||||
.resizable(false)
|
||||
@@ -782,7 +782,7 @@ fn licenses(app: &mut App, ctx: &egui::Context) {
|
||||
let mut open = true;
|
||||
let title = tr!("Licenses & Notices");
|
||||
let shown = crate::windows::new(ctx, title)
|
||||
.id(egui::Id::new("licenses_window"))
|
||||
.id(egui::Id::unique("licenses_window"))
|
||||
.open(&mut open)
|
||||
.collapsible(false)
|
||||
.pivot(egui::Align2::CENTER_CENTER)
|
||||
@@ -937,7 +937,7 @@ fn take_key_press(ctx: &egui::Context) -> Option<(egui::Modifiers, Key)> {
|
||||
/// Opens the shortcut editor filtered to `filter` and waiting for a new key for `id` (Manage
|
||||
/// Saved Commands' Shortcut…, ADR 0097).
|
||||
pub(crate) fn shortcuts_for(app: &mut App, ctx: &egui::Context, filter: &str, id: &'static str) {
|
||||
let state_id = egui::Id::new("shortcut_editor");
|
||||
let state_id = egui::Id::unique("shortcut_editor");
|
||||
let mut st: SheetState = ctx.data_mut(|d| d.get_temp(state_id).unwrap_or_default());
|
||||
st.filter = filter.to_string();
|
||||
st.notice = None;
|
||||
@@ -953,7 +953,7 @@ fn shortcut_sheet(app: &mut App, ctx: &egui::Context) {
|
||||
app.key_capture = None;
|
||||
return;
|
||||
}
|
||||
let state_id = egui::Id::new("shortcut_editor");
|
||||
let state_id = egui::Id::unique("shortcut_editor");
|
||||
let mut st: SheetState = ctx.data_mut(|d| d.get_temp(state_id).unwrap_or_default());
|
||||
let key = crate::platform::shortcut_label;
|
||||
|
||||
@@ -989,7 +989,7 @@ fn shortcut_sheet(app: &mut App, ctx: &egui::Context) {
|
||||
let changed = app.prefs.shortcuts.len();
|
||||
let title = tr!("Keyboard Shortcuts");
|
||||
let shown = crate::windows::new(ctx, title)
|
||||
.id(egui::Id::new("shortcuts_window"))
|
||||
.id(egui::Id::unique("shortcuts_window"))
|
||||
.open(&mut open)
|
||||
.collapsible(false)
|
||||
.pivot(egui::Align2::CENTER_CENTER)
|
||||
|
||||
+1
-1
@@ -53,7 +53,7 @@ pub fn params(d: &DocSettings) -> serde_json::Value {
|
||||
pub fn window(app: &mut App, ctx: &egui::Context) {
|
||||
let Some(d) = &mut app.doc_settings else { return };
|
||||
let (mut submit, mut cancel) = (false, false);
|
||||
crate::windows::new(ctx, tr!("Document Settings")).id(egui::Id::new("doc_settings")).collapsible(false).resizable(false).anchor(egui::Align2::CENTER_CENTER, [0.0, -80.0]).show(ctx, |ui| {
|
||||
crate::windows::new(ctx, tr!("Document Settings")).id(egui::Id::unique("doc_settings")).collapsible(false).resizable(false).anchor(egui::Align2::CENTER_CENTER, [0.0, -80.0]).show(ctx, |ui| {
|
||||
ui.set_min_width(340.0);
|
||||
let entered = |ui: &egui::Ui, r: &egui::Response| r.lost_focus() && ui.input(|i| i.key_pressed(Key::Enter));
|
||||
form_row(ui, FORM_LABEL_DIALOG, tr!("Stage size"), |ui| {
|
||||
|
||||
+3
-3
@@ -12,7 +12,7 @@ use crate::app::App;
|
||||
use crate::dock::{Float, Layout, Panel};
|
||||
use crate::dock_ui::{Act, Drag, Drawn, MENU_W, Over, Where, apply, end_drag, menu_button, panel_body, region, tab_row};
|
||||
use crate::theme::T;
|
||||
use egui::{Id, Rect, Sense, WidgetType, pos2, vec2};
|
||||
use egui::{Id, Rect, Sense, Role, pos2, vec2};
|
||||
|
||||
/// Draws every floating window.
|
||||
pub fn floating(app: &mut App, ctx: &egui::Context) {
|
||||
@@ -42,7 +42,7 @@ fn strip(app: &mut App, ui: &mut egui::Ui, f: &Float, layout: &Layout, anchor: b
|
||||
ui.horizontal(|ui| {
|
||||
// The grip: dragged, the whole window; clicked, the shown panel's menu.
|
||||
let (g, resp) = ui.allocate_exact_size(vec2(14.0, 24.0), Sense::click_and_drag());
|
||||
a11y::control(ui, &resp, WidgetType::Button, tr!("Window grip: drag to dock this window"), None);
|
||||
a11y::control(ui, &resp, Role::Button, tr!("Window grip: drag to dock this window"), None);
|
||||
a11y::focus_ring(ui, &resp);
|
||||
let colour = if resp.hovered() || resp.dragged() { T.icon_hot } else { T.text_faint };
|
||||
for i in -1..=1 {
|
||||
@@ -108,7 +108,7 @@ fn float_body(app: &mut App, ui: &mut egui::Ui, f: &Float, layout: &Layout, anch
|
||||
/// Floating inside the editor: an egui window.
|
||||
fn inside(app: &mut App, ctx: &egui::Context, f: &Float, layout: &Layout, acts: &mut Vec<Act>) {
|
||||
let Some(p) = f.shown() else { return };
|
||||
let id = Id::new(("dock_float", f.id));
|
||||
let id = Id::unique(("dock_float", f.id));
|
||||
let title = crate::i18n::t(p.label());
|
||||
let mut open = true;
|
||||
let size = vec2(f.size[0], f.size[1]);
|
||||
|
||||
+36
-36
@@ -10,7 +10,7 @@ use crate::app::App;
|
||||
use crate::dock::{Group, Layout, Panel, Place, Side, Target, Zone};
|
||||
use crate::icons::Icon;
|
||||
use crate::theme::{self, T, Type, font, text};
|
||||
use egui::{Id, Pos2, Rect, Sense, Stroke, StrokeKind, WidgetType, pos2, vec2};
|
||||
use egui::{Id, Pos2, Rect, Sense, Stroke, StrokeKind, Role, pos2, vec2};
|
||||
use std::collections::{HashMap, HashSet};
|
||||
|
||||
/// A side dock's group header (the band look of Properties and the Library before docking).
|
||||
@@ -413,7 +413,7 @@ pub fn workspace(app: &mut App, ui: &mut egui::Ui) {
|
||||
strip(app, ui, side, zone, &layout, &mut acts);
|
||||
continue;
|
||||
}
|
||||
let id = Id::new(("dock_zone", side, app.dock_view.epoch));
|
||||
let id = Id::unique(("dock_zone", side, app.dock_view.epoch));
|
||||
let (auto, max, min) = if side.stacks() { (dock_w, (room.x * 0.5).max(MIN_SIDE + 20.0), MIN_SIDE) } else { (dock_h, (room.y * 0.6).max(200.0), MIN_ROW) };
|
||||
let size = zone.size.unwrap_or(auto).clamp(min, max);
|
||||
let panel = match side {
|
||||
@@ -466,7 +466,7 @@ impl DockView {
|
||||
/// The tools as a slim bar on a side of the editor, outside the docks, with a grip to drag
|
||||
/// them elsewhere (and their menu).
|
||||
fn tools_bar(app: &mut App, ui: &mut egui::Ui, side: Side, layout: &Layout, acts: &mut Vec<Act>) {
|
||||
let id = if side == Side::Left { Id::new("tools") } else { Id::new(("tools", side)) };
|
||||
let id = if side == Side::Left { Id::unique("tools") } else { Id::unique(("tools", side)) };
|
||||
let margin = if side.stacks() { egui::Margin { left: 0, right: 0, top: 2, bottom: 8 } } else { egui::Margin { left: 2, right: 8, top: 0, bottom: 0 } };
|
||||
let frame = egui::Frame::NONE.fill(T.panel).inner_margin(margin);
|
||||
let panel = match side {
|
||||
@@ -494,8 +494,8 @@ fn tools_bar(app: &mut App, ui: &mut egui::Ui, side: Side, layout: &Layout, acts
|
||||
|
||||
/// The tools bar's grip: drag it to move the tools, click it for their menu.
|
||||
fn grip(ui: &mut egui::Ui, r: Rect, across: bool, at: Where, layout: &Layout, acts: &mut Vec<Act>) {
|
||||
let resp = ui.interact(r, Id::new("dock_grip_tools"), Sense::click_and_drag());
|
||||
a11y::control(ui, &resp, WidgetType::Button, tr!("Tools panel menu"), None);
|
||||
let resp = ui.interact(r, Id::unique("dock_grip_tools"), Sense::click_and_drag());
|
||||
a11y::control(ui, &resp, Role::Button, tr!("Tools panel menu"), None);
|
||||
let hot = resp.hovered() || resp.has_focus() || resp.dragged();
|
||||
if resp.hovered() {
|
||||
ui.painter().rect_filled(r, T.rc(), T.hover);
|
||||
@@ -511,7 +511,7 @@ fn grip(ui: &mut egui::Ui, r: Rect, across: bool, at: Where, layout: &Layout, ac
|
||||
}
|
||||
}
|
||||
if resp.drag_started() {
|
||||
ui.ctx().data_mut(|d| d.insert_temp(Id::new("dock_drag_start"), Some(Drag::Panel(Panel::Tools))));
|
||||
ui.ctx().data_mut(|d| d.insert_temp(Id::unique("dock_drag_start"), Some(Drag::Panel(Panel::Tools))));
|
||||
}
|
||||
let resp = resp.on_hover_text(tr!("Drag to move the tools; click for more"));
|
||||
egui::Popup::menu(&resp).show(|ui| panel_menu(ui, at, Panel::Tools, layout, acts));
|
||||
@@ -552,7 +552,7 @@ fn zone_ui(app: &mut App, ui: &mut egui::Ui, side: Side, groups: &[Group], layou
|
||||
} else {
|
||||
Rect::from_center_size(pos2(area.left() + edge, area.center().y), vec2(6.0, area.height()))
|
||||
};
|
||||
let id = Id::new(("dock_split", side, i));
|
||||
let id = Id::unique(("dock_split", side, i));
|
||||
let resp = ui.interact(grab, id, Sense::drag());
|
||||
let (an, bn) = (a.shown().map_or("", |p| crate::i18n::t(p.label())), b.shown().map_or("", |p| crate::i18n::t(p.label())));
|
||||
ui.ctx().accesskit_node_builder(id, |node| {
|
||||
@@ -622,10 +622,10 @@ fn band_header(ui: &mut egui::Ui, side: Side, g: &Group, rect: Rect, first_group
|
||||
crate::theme::accent_bar(&p, Rect::from_min_size(rect.left_top() + vec2(0.0, 1.0), vec2(3.0, rect.height() - 1.0)));
|
||||
// Fold: the group keeps only its header, giving the others its room.
|
||||
let chevron = Rect::from_center_size(pos2(rect.left() + 17.0, rect.center().y), vec2(22.0, 22.0));
|
||||
let resp = ui.interact(chevron, Id::new(("dock_fold", shown.id())), Sense::click());
|
||||
let resp = ui.interact(chevron, Id::unique(("dock_fold", shown.id())), Sense::click());
|
||||
let open = !g.folded;
|
||||
let name = crate::i18n::t(shown.label());
|
||||
resp.widget_info(|| egui::WidgetInfo::selected(WidgetType::CollapsingHeader, true, open, name));
|
||||
resp.widget_info(|| egui::WidgetInfo::selected(Role::DisclosureTriangle, true, open, name));
|
||||
a11y::focus_ring(ui, &resp);
|
||||
let hot = resp.hovered() || resp.has_focus();
|
||||
crate::icons::paint(&p, Rect::from_center_size(chevron.center(), vec2(14.0, 14.0)), if open { Icon::ChevronDown } else { Icon::ChevronRight }, if hot { T.text } else { T.text_dim });
|
||||
@@ -638,7 +638,7 @@ fn band_header(ui: &mut egui::Ui, side: Side, g: &Group, rect: Rect, first_group
|
||||
let r = Rect::from_center_size(pos2(right - MENU_W * 0.5 + 2.0, rect.center().y), vec2(MENU_W - 4.0, 24.0));
|
||||
right -= MENU_W - 2.0;
|
||||
let icon = if side == Side::Left { Icon::First } else { Icon::Last };
|
||||
if icon_button(ui, r, Id::new(("dock_collapse", side)), icon, tr!("Collapse to icons"), None).clicked() {
|
||||
if icon_button(ui, r, Id::unique(("dock_collapse", side)), icon, tr!("Collapse to icons"), None).clicked() {
|
||||
acts.push(Act::Collapse(side, true));
|
||||
}
|
||||
}
|
||||
@@ -659,7 +659,7 @@ fn band_header(ui: &mut egui::Ui, side: Side, g: &Group, rect: Rect, first_group
|
||||
}
|
||||
let total = widths.iter().sum::<f32>() + TAB_GAP * widths.len().saturating_sub(1) as f32;
|
||||
let overflow = (total - strip.width()).max(0.0);
|
||||
let key = Id::new(("dock_tab_scroll", shown.id(), g.tabs.first().map_or("", |t| t.id())));
|
||||
let key = Id::unique(("dock_tab_scroll", shown.id(), g.tabs.first().map_or("", |t| t.id())));
|
||||
let (mut scroll, last_active) = ui.ctx().data(|d| d.get_temp::<(f32, usize)>(key)).unwrap_or((0.0, usize::MAX));
|
||||
if overflow > 0.0 && ui.rect_contains_pointer(strip) {
|
||||
let d = ui.input(|i| i.smooth_scroll_delta);
|
||||
@@ -675,7 +675,7 @@ fn band_header(ui: &mut egui::Ui, side: Side, g: &Group, rect: Rect, first_group
|
||||
ui.ctx().data_mut(|d| d.insert_temp(key, (scroll, active_i)));
|
||||
ui.ctx().data_mut(|d| {
|
||||
for t in &g.tabs {
|
||||
d.remove::<(Rect, bool)>(Id::new(("dock_tab_rect", t.id())));
|
||||
d.remove::<(Rect, bool)>(Id::unique(("dock_tab_rect", t.id())));
|
||||
}
|
||||
});
|
||||
let mut x = strip.left() - scroll;
|
||||
@@ -691,7 +691,7 @@ fn band_header(ui: &mut egui::Ui, side: Side, g: &Group, rect: Rect, first_group
|
||||
let cut = natural.get(i).is_some_and(|n| *n > w + 0.5);
|
||||
let galley = if cut { elided(&p, name, w - TAB_PAD) } else { p.layout_no_wrap(name.to_string(), font(Type::Heading), T.text) };
|
||||
let resp = tab_widget(ui, *tab, r, shown_r, i == active_i, &galley, several);
|
||||
ui.ctx().data_mut(|d| d.insert_temp(Id::new(("dock_tab_rect", tab.id())), (shown_r, cut)));
|
||||
ui.ctx().data_mut(|d| d.insert_temp(Id::unique(("dock_tab_rect", tab.id())), (shown_r, cut)));
|
||||
tab_actions(ui, at, *tab, &resp, cut, layout, acts);
|
||||
if i == active_i {
|
||||
a11y::anchor(ui, region(*tab), Rect::from_min_max(rect.min, pos2(rect.right(), ui.max_rect().bottom().max(rect.bottom()))), &resp);
|
||||
@@ -715,7 +715,7 @@ fn band_header(ui: &mut egui::Ui, side: Side, g: &Group, rect: Rect, first_group
|
||||
/// A small square button drawn with an icon, named for screen readers, with its tooltip.
|
||||
pub(crate) fn icon_button(ui: &mut egui::Ui, r: Rect, id: Id, icon: Icon, name: &str, selected: Option<bool>) -> egui::Response {
|
||||
let resp = ui.interact(r, id, Sense::click());
|
||||
a11y::control(ui, &resp, if selected.is_some() { WidgetType::SelectableLabel } else { WidgetType::Button }, name, selected);
|
||||
a11y::control(ui, &resp, Role::Button, name, selected);
|
||||
let on = selected == Some(true);
|
||||
if on {
|
||||
ui.painter().rect_filled(r, T.rc(), T.active);
|
||||
@@ -802,9 +802,9 @@ fn elided(p: &egui::Painter, name: &str, width: f32) -> std::sync::Arc<egui::Gal
|
||||
/// A side dock's tab: named and selectable for screen readers, dragged to move its panel.
|
||||
/// `shown` is the part of `r` inside the tab strip (it scrolls).
|
||||
fn tab_widget(ui: &mut egui::Ui, tab: Panel, r: Rect, shown: Rect, active: bool, galley: &std::sync::Arc<egui::Galley>, several: bool) -> egui::Response {
|
||||
let resp = ui.interact(shown, Id::new(("dock_tab", tab.id())), Sense::click_and_drag());
|
||||
let resp = ui.interact(shown, Id::unique(("dock_tab", tab.id())), Sense::click_and_drag());
|
||||
let name = crate::i18n::t(tab.label());
|
||||
resp.widget_info(|| egui::WidgetInfo::selected(WidgetType::SelectableLabel, true, active, name));
|
||||
resp.widget_info(|| egui::WidgetInfo::selected(Role::Button, true, active, name));
|
||||
let p = ui.painter().with_clip_rect(shown.intersect(ui.painter().clip_rect()));
|
||||
if resp.hovered() && !active {
|
||||
p.rect_filled(r, T.rc(), T.hover);
|
||||
@@ -825,7 +825,7 @@ fn tab_widget(ui: &mut egui::Ui, tab: Panel, r: Rect, shown: Rect, active: bool,
|
||||
/// move it (drag). A `cut` name shows whole in the tooltip.
|
||||
fn tab_actions(ui: &egui::Ui, at: Where, tab: Panel, resp: &egui::Response, cut: bool, layout: &Layout, acts: &mut Vec<Act>) {
|
||||
if resp.drag_started() {
|
||||
ui.ctx().data_mut(|d| d.insert_temp(Id::new("dock_drag_start"), Some(Drag::Panel(tab))));
|
||||
ui.ctx().data_mut(|d| d.insert_temp(Id::unique("dock_drag_start"), Some(Drag::Panel(tab))));
|
||||
}
|
||||
if resp.double_clicked() && matches!(at, Where::Docked { side, .. } if side.stacks()) {
|
||||
acts.push(Act::Fold(tab));
|
||||
@@ -839,9 +839,9 @@ fn tab_actions(ui: &egui::Ui, at: Where, tab: Panel, resp: &egui::Response, cut:
|
||||
|
||||
/// The ≡ button at the end of a group's header: the shown panel's menu.
|
||||
pub(crate) fn menu_button(ui: &mut egui::Ui, at: Where, p: Panel, r: Rect, layout: &Layout, acts: &mut Vec<Act>) {
|
||||
let resp = ui.interact(r, Id::new(("dock_menu", p.id(), wkey(at))), Sense::click());
|
||||
let resp = ui.interact(r, Id::unique(("dock_menu", p.id(), wkey(at))), Sense::click());
|
||||
let name = tr!("{panel} panel menu", panel = crate::i18n::t(p.label()));
|
||||
a11y::control(ui, &resp, WidgetType::Button, &name, None);
|
||||
a11y::control(ui, &resp, Role::Button, &name, None);
|
||||
let hot = resp.hovered() || resp.has_focus();
|
||||
if resp.hovered() {
|
||||
ui.painter().rect_filled(r, T.rc(), T.hover);
|
||||
@@ -1013,7 +1013,7 @@ pub fn panel_body(app: &mut App, ui: &mut egui::Ui, p: Panel) {
|
||||
/// A dock collapsed to icons: a strip with the expand button, then one icon per panel (named
|
||||
/// for screen readers, its name as its tooltip); a click opens the panel over the stage.
|
||||
fn strip(app: &mut App, ui: &mut egui::Ui, side: Side, zone: &Zone, layout: &Layout, acts: &mut Vec<Act>) {
|
||||
let id = Id::new(("dock_strip", side));
|
||||
let id = Id::unique(("dock_strip", side));
|
||||
let panel = match side {
|
||||
Side::Left => egui::Panel::left(id),
|
||||
Side::Right => egui::Panel::right(id),
|
||||
@@ -1046,7 +1046,7 @@ fn strip(app: &mut App, ui: &mut egui::Ui, side: Side, zone: &Zone, layout: &Lay
|
||||
Side::Bottom => Icon::ChevronUp,
|
||||
};
|
||||
let r = Rect::from_min_size(at, vec2(b, b * 0.75));
|
||||
if icon_button(ui, r, Id::new(("dock_expand", side)), expand, tr!("Expand the dock"), None).clicked() {
|
||||
if icon_button(ui, r, Id::unique(("dock_expand", side)), expand, tr!("Expand the dock"), None).clicked() {
|
||||
acts.push(Act::Collapse(side, false));
|
||||
}
|
||||
step(&mut at, b * 0.75 + 4.0);
|
||||
@@ -1068,7 +1068,7 @@ fn strip(app: &mut App, ui: &mut egui::Ui, side: Side, zone: &Zone, layout: &Lay
|
||||
let open = flyout == Some(*p);
|
||||
let name = crate::i18n::t(p.label());
|
||||
// Dragged, the icon moves its panel, as a tab does.
|
||||
let resp = icon_button(ui, r, Id::new(("dock_icon", p.id())), panel_icon(*p), name, Some(open)).interact(Sense::drag());
|
||||
let resp = icon_button(ui, r, Id::unique(("dock_icon", p.id())), panel_icon(*p), name, Some(open)).interact(Sense::drag());
|
||||
if resp.drag_started() && app.dock_view.drag.is_none() {
|
||||
app.dock_view.drag = Some(Drag::Panel(*p));
|
||||
}
|
||||
@@ -1113,7 +1113,7 @@ fn flyout(app: &mut App, ctx: &egui::Context, auto: (f32, f32), layout: &Layout,
|
||||
let Some(Place::Docked { group, .. }) = layout.place(p) else { return };
|
||||
let tabs = layout.zone(side).groups.get(group).map_or(1, |g| g.tabs.len());
|
||||
let at = Where::Docked { side, folded: false, tabs };
|
||||
egui::Area::new(Id::new("dock_flyout")).order(egui::Order::Foreground).fixed_pos(rect.min).constrain(false).show(ctx, |ui| {
|
||||
egui::Area::new(Id::unique("dock_flyout")).order(egui::Order::Foreground).fixed_pos(rect.min).constrain(false).show(ctx, |ui| {
|
||||
ui.set_clip_rect(rect);
|
||||
ui.painter().rect_filled(rect, theme::SQUARE, T.panel);
|
||||
ui.painter().rect_stroke(rect, theme::SQUARE, Stroke::new(1.0, T.border), StrokeKind::Inside);
|
||||
@@ -1125,7 +1125,7 @@ fn flyout(app: &mut App, ctx: &egui::Context, auto: (f32, f32), layout: &Layout,
|
||||
let tr = Rect::from_min_max(header.min + vec2(12.0, 0.0), pos2(header.right() - 2.0 * MENU_W - 6.0, header.bottom()));
|
||||
ui.painter().with_clip_rect(tr).galley(pos2(tr.left(), header.center().y - galley.rect.height() * 0.5), galley, theme::color(Type::Heading));
|
||||
let close = Rect::from_center_size(pos2(header.right() - MENU_W * 0.5 - 2.0, header.center().y), vec2(MENU_W - 2.0, 24.0));
|
||||
let resp = icon_button(ui, close, Id::new("dock_flyout_close"), Icon::ChevronRight, &tr!("Close {panel}", panel = title), None);
|
||||
let resp = icon_button(ui, close, Id::unique("dock_flyout_close"), Icon::ChevronRight, &tr!("Close {panel}", panel = title), None);
|
||||
// Its first control: Ctrl+F6's stop while it is open.
|
||||
a11y::anchor(ui, region(p), rect, &resp);
|
||||
if resp.clicked() {
|
||||
@@ -1143,7 +1143,7 @@ fn flyout(app: &mut App, ctx: &egui::Context, auto: (f32, f32), layout: &Layout,
|
||||
let popup = egui::Popup::is_any_open(ctx);
|
||||
if app.dock_view.drag.is_none() && !popup && ctx.input_mut(|i| i.consume_key(egui::Modifiers::NONE, egui::Key::Escape)) {
|
||||
acts.push(Act::Flyout(None));
|
||||
let icon = Id::new(("dock_icon", p.id()));
|
||||
let icon = Id::unique(("dock_icon", p.id()));
|
||||
ctx.memory_mut(|m| m.request_focus(icon));
|
||||
return;
|
||||
}
|
||||
@@ -1234,7 +1234,7 @@ pub(crate) fn drop_target(view: &DockView, layout: &Layout, what: Drag, at: Pos2
|
||||
/// While a tab or a floating window is dragged: where it would go, shown over the editor;
|
||||
/// dropped, it goes there. Esc cancels.
|
||||
fn drag_and_drop(app: &mut App, ctx: &egui::Context, acts: &mut Vec<Act>) {
|
||||
if let Some(d) = ctx.data_mut(|d| d.remove_temp::<Option<Drag>>(Id::new("dock_drag_start"))).flatten() {
|
||||
if let Some(d) = ctx.data_mut(|d| d.remove_temp::<Option<Drag>>(Id::unique("dock_drag_start"))).flatten() {
|
||||
app.dock_view.drag = Some(d);
|
||||
app.dock_view.from_window = None;
|
||||
}
|
||||
@@ -1273,7 +1273,7 @@ fn drag_and_drop(app: &mut App, ctx: &egui::Context, acts: &mut Vec<Act>) {
|
||||
return;
|
||||
}
|
||||
ctx.set_cursor_icon(egui::CursorIcon::Grabbing);
|
||||
let painter = ctx.layer_painter(egui::LayerId::new(egui::Order::Tooltip, Id::new("dock_drop")));
|
||||
let painter = ctx.layer_painter(egui::LayerId::new(egui::Order::Tooltip, Id::unique("dock_drop")));
|
||||
if let Some(r) = area {
|
||||
painter.rect_filled(r, theme::SQUARE, theme::dock_drop());
|
||||
painter.rect_stroke(r, theme::SQUARE, Stroke::new(2.0, T.accent), StrokeKind::Inside);
|
||||
@@ -1572,7 +1572,7 @@ mod tests {
|
||||
#[test]
|
||||
fn at_the_narrowest_dock_no_tab_runs_under_the_menu_button() {
|
||||
let tabs = [Panel::Library, Panel::MovieExplorer, Panel::LayerDepth];
|
||||
let rect = |ctx: &egui::Context, t: Panel| ctx.data(|m| m.get_temp::<(Rect, bool)>(Id::new(("dock_tab_rect", t.id()))));
|
||||
let rect = |ctx: &egui::Context, t: Panel| ctx.data(|m| m.get_temp::<(Rect, bool)>(Id::unique(("dock_tab_rect", t.id()))));
|
||||
for size in [MIN_SIDE, 260.0, 292.0] {
|
||||
// Three long names in one group, the dock at `size` (egui keeps a panel's size, so
|
||||
// a fresh window for each).
|
||||
@@ -1665,7 +1665,7 @@ mod tests {
|
||||
settle(&ctx, &mut app);
|
||||
let id = app.dock.floating[0].id;
|
||||
assert!(app.dock_view.placed.contains(&id), "drawn inside the editor");
|
||||
let area = ctx.memory(|m| m.area_rect(Id::new(("dock_float", id))));
|
||||
let area = ctx.memory(|m| m.area_rect(Id::unique(("dock_float", id))));
|
||||
assert!(area.is_some_and(|r| (r.left() - 300.0).abs() < 1.0 && (r.top() - 200.0).abs() < 1.0), "where it was put: {area:?}");
|
||||
// A window of its own where there can be one: drawn in its viewport, not inside.
|
||||
let (mut app, ctx) = self::app();
|
||||
@@ -1737,14 +1737,14 @@ mod tests {
|
||||
settle(&ctx, &mut app);
|
||||
// The grip at the top of the tools' bar, dragged to the stage's right edge: the bar
|
||||
// goes to the right.
|
||||
let grip = ctx.read_response(Id::new("dock_grip_tools")).map(|r| r.rect.center());
|
||||
let grip = ctx.read_response(Id::unique("dock_grip_tools")).map(|r| r.rect.center());
|
||||
let stage = app.dock_view.stage;
|
||||
let (Some(grip), Some(stage)) = (grip, stage) else { panic!("drawn") };
|
||||
drag(&ctx, &mut app, grip, pos2(stage.right() - 10.0, stage.center().y));
|
||||
assert_eq!(app.dock.tools_bar, Some(Side::Right));
|
||||
// Onto the Library's header: a tab there, drawn as a grid of tools.
|
||||
let library = app.dock_view.drawn.iter().find(|d| d.first == Panel::Library).map(|d| d.header.center());
|
||||
let grip = ctx.read_response(Id::new("dock_grip_tools")).map(|r| r.rect.center());
|
||||
let grip = ctx.read_response(Id::unique("dock_grip_tools")).map(|r| r.rect.center());
|
||||
let (Some(library), Some(grip)) = (library, grip) else { panic!("drawn") };
|
||||
drag(&ctx, &mut app, grip, library);
|
||||
assert_eq!(app.dock.tools_bar, None);
|
||||
@@ -1787,7 +1787,7 @@ mod tests {
|
||||
click(&ctx, &mut app, colour);
|
||||
assert!(app.dock.is_shown(Panel::Colour));
|
||||
// The window dragged by its title bar onto the Library's header: both tabs join it.
|
||||
let title = ctx.memory(|m| m.area_rect(Id::new(("dock_float", id)))).map(|r| r.left_top() + vec2(30.0, 12.0));
|
||||
let title = ctx.memory(|m| m.area_rect(Id::unique(("dock_float", id)))).map(|r| r.left_top() + vec2(30.0, 12.0));
|
||||
let library = app.dock_view.drawn.iter().find(|d| d.first == Panel::Library).map(|d| d.header.center());
|
||||
let (Some(title), Some(library)) = (title, library) else { panic!("drawn") };
|
||||
frame(&ctx, &mut app, pointer(title, None));
|
||||
@@ -1808,7 +1808,7 @@ mod tests {
|
||||
fn a_dock_collapses_to_icons_with_flyouts() {
|
||||
let (mut app, ctx) = app();
|
||||
settle(&ctx, &mut app);
|
||||
let collapse = ctx.read_response(Id::new(("dock_collapse", Side::Right))).map(|r| r.rect.center());
|
||||
let collapse = ctx.read_response(Id::unique(("dock_collapse", Side::Right))).map(|r| r.rect.center());
|
||||
let Some(collapse) = collapse else { panic!("drawn") };
|
||||
click(&ctx, &mut app, collapse);
|
||||
assert!(app.dock.right.collapsed);
|
||||
@@ -1817,12 +1817,12 @@ mod tests {
|
||||
assert!((strip.width() - STRIP).abs() < 2.0, "a slim strip: {}", strip.width());
|
||||
let stage = app.dock_view.stage.map_or(0.0, |s| s.width());
|
||||
// An icon opens its panel over the stage, which keeps its size.
|
||||
let icon = ctx.read_response(Id::new(("dock_icon", Panel::Library.id()))).map(|r| r.rect.center());
|
||||
let icon = ctx.read_response(Id::unique(("dock_icon", Panel::Library.id()))).map(|r| r.rect.center());
|
||||
let Some(icon) = icon else { panic!("an icon") };
|
||||
click(&ctx, &mut app, icon);
|
||||
assert_eq!(app.dock_view.flyout, Some(Panel::Library));
|
||||
assert!(app.panel_visible(Panel::Library) && !app.panel_visible(Panel::Properties));
|
||||
let fly = ctx.memory(|m| m.area_rect(Id::new("dock_flyout")));
|
||||
let fly = ctx.memory(|m| m.area_rect(Id::unique("dock_flyout")));
|
||||
assert!(fly.is_some_and(|r| r.right() <= strip.left() + 1.0 && r.width() >= MIN_SIDE), "beside the strip: {fly:?}");
|
||||
assert_eq!(app.dock_view.stage.map_or(0.0, |s| s.width()), stage);
|
||||
// Esc closes it; so does a click outside it.
|
||||
@@ -1840,7 +1840,7 @@ mod tests {
|
||||
assert_eq!(app.dock_view.flyout, Some(Panel::Properties));
|
||||
assert!(a11y::order(&ctx).contains(&Region::Panel(Panel::Properties)));
|
||||
// Expanded again: the dock as it was.
|
||||
let expand = ctx.read_response(Id::new(("dock_expand", Side::Right))).map(|r| r.rect.center());
|
||||
let expand = ctx.read_response(Id::unique(("dock_expand", Side::Right))).map(|r| r.rect.center());
|
||||
let Some(expand) = expand else { panic!("drawn") };
|
||||
click(&ctx, &mut app, expand);
|
||||
assert!(!app.dock.right.collapsed && app.dock_view.flyout.is_none());
|
||||
|
||||
+1
-1
@@ -448,7 +448,7 @@ fn preview_point(app: &App, at: PreviewAt) -> Option<Pos2> {
|
||||
|
||||
/// The drop highlight: what lands where, drawn over everything.
|
||||
fn highlight(app: &App, ctx: &egui::Context, files: &[PathBuf], p: Option<Pos2>) {
|
||||
let painter = ctx.layer_painter(egui::LayerId::new(egui::Order::Foreground, egui::Id::new("file_drop")));
|
||||
let painter = ctx.layer_painter(egui::LayerId::new(egui::Order::Foreground, egui::Id::unique("file_drop")));
|
||||
let screen = ctx.content_rect().shrink(3.0);
|
||||
// Only the names are known while a browser drags (and sometimes not even those).
|
||||
let known: Vec<&PathBuf> = files.iter().filter(|f| !f.as_os_str().is_empty()).collect();
|
||||
|
||||
+4
-4
@@ -21,7 +21,7 @@ use crate::theme::{SQUARE, T, Type, font, text, with_type};
|
||||
use anicraft_engine::cmds_ease::{ease_target, read, saved_name};
|
||||
use anicraft_engine::doc::{CustomEase, Document, EaseDir, EaseFamily, EaseGroup, Easing, Handle, Property, TweenKind};
|
||||
use anicraft_engine::params::easing_json;
|
||||
use egui::{Align2, Key, Modifiers, Pos2, Rect, Sense, Stroke, WidgetType, pos2, vec2};
|
||||
use egui::{Align2, Key, Modifiers, Pos2, Rect, Sense, Stroke, Role, pos2, vec2};
|
||||
use serde_json::{Value, json};
|
||||
|
||||
/// The graph's height, and the room around the curve inside it.
|
||||
@@ -247,7 +247,7 @@ fn thumb(ui: &mut egui::Ui, e: &Easing, on: bool, name: &str) -> egui::Response
|
||||
let p = ui.painter();
|
||||
p.rect_filled(rect, T.rc(), if on { T.accent_dim } else if resp.hovered() { T.hover } else { T.field });
|
||||
plot(p, rect.shrink(4.0), e, -0.35, 1.35, Stroke::new(1.5, if on { T.accent_text } else { T.tween }));
|
||||
a11y::control(ui, &resp, WidgetType::SelectableLabel, name, Some(on));
|
||||
a11y::control(ui, &resp, Role::Button, name, Some(on));
|
||||
resp.on_hover_text(name)
|
||||
}
|
||||
|
||||
@@ -273,7 +273,7 @@ pub fn preview(app: &mut App, ui: &mut egui::Ui, e: &Easing) {
|
||||
let y = |v: f32| inner.bottom() - (v - lo) / (hi - lo) * inner.height();
|
||||
p.line_segment([pos2(inner.left(), y(0.0)), pos2(inner.right(), y(1.0))], Stroke::new(1.0, T.border));
|
||||
plot(p, inner, e, lo, hi, Stroke::new(2.0, T.tween));
|
||||
a11y::control(ui, &resp, WidgetType::Button, tr!("Edit Ease…"), None);
|
||||
a11y::control(ui, &resp, Role::Button, tr!("Edit Ease…"), None);
|
||||
if resp.on_hover_text(tr!("Edit the ease: drag its points and handles")).clicked() {
|
||||
open_here(app);
|
||||
}
|
||||
@@ -305,7 +305,7 @@ pub fn show(app: &mut App, ctx: &egui::Context) {
|
||||
let mut open = true;
|
||||
let title = tr!("Custom Ease");
|
||||
let shown = crate::windows::new(ctx, title)
|
||||
.id(egui::Id::new("ease_editor"))
|
||||
.id(egui::Id::unique("ease_editor"))
|
||||
.open(&mut open)
|
||||
.collapsible(false)
|
||||
.resizable(true)
|
||||
|
||||
+5
-5
@@ -13,7 +13,7 @@ use crate::theme::{T, Type, font, text, with_type};
|
||||
use anicraft_engine::doc::audio::{Peaks, Voice, VoiceKind};
|
||||
use anicraft_engine::doc::sound::{MAX_ENVELOPE_POINTS, MAX_ENVELOPE_SECONDS, clean_points, frame_start};
|
||||
use anicraft_engine::doc::{EnvelopePoint, FrameSound, LayerId, Sound, SoundEffect, SoundId};
|
||||
use egui::{Align2, Rect, Sense, Stroke, WidgetType, pos2, vec2};
|
||||
use egui::{Align2, Rect, Sense, Stroke, Role, pos2, vec2};
|
||||
use serde_json::json;
|
||||
use std::sync::Arc;
|
||||
|
||||
@@ -89,7 +89,7 @@ pub fn show(app: &mut App, ctx: &egui::Context) {
|
||||
let mut open = true;
|
||||
let title = tr!("Edit Envelope — {name}", name = t.sound.name);
|
||||
let shown = crate::windows::new(ctx, title.clone())
|
||||
.id(egui::Id::new("envelope_editor"))
|
||||
.id(egui::Id::unique("envelope_editor"))
|
||||
.open(&mut open)
|
||||
.collapsible(false)
|
||||
.resizable(true)
|
||||
@@ -202,7 +202,7 @@ fn body(app: &mut App, ed: &mut EnvelopeEditor, ui: &mut egui::Ui, t: &Target) {
|
||||
let mut changed: Option<(&str, bool)> = None;
|
||||
for (c, lane) in lanes.iter().enumerate() {
|
||||
let name = if c == 0 { tr!("Left channel") } else { tr!("Right channel") };
|
||||
let bg = ui.interact(*lane, ui.id().with(("env_lane", c)), Sense::click());
|
||||
let bg = ui.interact(*lane, ui.scope_id().with(("env_lane", c)), Sense::click());
|
||||
crate::a11y::surface(ui, &bg, &tr!("{channel}: click to add a volume point", channel = name));
|
||||
p.rect_filled(*lane, crate::theme::SQUARE, T.field);
|
||||
p.line_segment([pos2(lane.left(), lane.center().y), pos2(lane.right(), lane.center().y)], Stroke::new(1.0, T.separator));
|
||||
@@ -246,9 +246,9 @@ fn body(app: &mut App, ed: &mut EnvelopeEditor, ui: &mut egui::Ui, t: &Target) {
|
||||
continue;
|
||||
}
|
||||
let hit = Rect::from_center_size(centre, vec2(2.0 * REACH, 2.0 * REACH));
|
||||
let r = ui.interact(hit, ui.id().with(("env_point", c, i)), Sense::click_and_drag());
|
||||
let r = ui.interact(hit, ui.scope_id().with(("env_point", c, i)), Sense::click_and_drag());
|
||||
let secs = time_label(q.at, ed.frames, fps);
|
||||
crate::a11y::control(ui, &r, WidgetType::Slider, &tr!("Point {index} of {count}, {channel}: {level} % at {time}", index = i + 1, count = pts.len(), channel = name, level = format!("{:.0}", level(&q) * 100.0), time = secs), None);
|
||||
crate::a11y::control(ui, &r, Role::Slider, &tr!("Point {index} of {count}, {channel}: {level} % at {time}", index = i + 1, count = pts.len(), channel = name, level = format!("{:.0}", level(&q) * 100.0), time = secs), None);
|
||||
let hot = r.hovered() || r.dragged() || ed.selected == Some(i);
|
||||
let h = Rect::from_center_size(centre, vec2(2.0 * HANDLE, 2.0 * HANDLE));
|
||||
p.rect_filled(h, crate::theme::SQUARE, if hot { T.accent } else { T.panel });
|
||||
|
||||
+1
-1
@@ -170,7 +170,7 @@ pub fn picker_dropper(app: &mut App, ui: &egui::Ui, resp: &egui::Response, picke
|
||||
// changes.
|
||||
let scale = (zoom * ctx.pixels_per_point()).clamp(0.01, 64.0);
|
||||
let key = (app.s.state, p.x.to_bits(), p.y.to_bits(), scale.to_bits());
|
||||
let cache = egui::Id::new("anicraft.stage.picker_dropper");
|
||||
let cache = egui::Id::unique("anicraft.stage.picker_dropper");
|
||||
type Sampled = ((anicraft_engine::StateId, u32, u32, u32), [u8; 3]);
|
||||
let known: Option<Sampled> = ctx.data(|d| d.get_temp(cache));
|
||||
let rgb = match known.filter(|(k, _)| *k == key) {
|
||||
|
||||
+3
-3
@@ -9,7 +9,7 @@ use crate::app::App;
|
||||
use crate::theme::{T, TARGET, Type, color, font, text};
|
||||
use anicraft_engine::StateId;
|
||||
use anicraft_engine::find::{self, Field, Hit, Kind, Query, TextOptions, Where};
|
||||
use egui::{Align2, Rect, Sense, WidgetType, pos2, vec2};
|
||||
use egui::{Align2, Rect, Sense, Role, pos2, vec2};
|
||||
use serde_json::{Value, json};
|
||||
use std::sync::Arc;
|
||||
|
||||
@@ -243,7 +243,7 @@ pub fn show(app: &mut App, ctx: &egui::Context) {
|
||||
}
|
||||
let mut open = app.find.open;
|
||||
let at = ctx.content_rect().right_top() + vec2(-720.0, 110.0);
|
||||
let shown = crate::windows::new(ctx, tr!("Find and Replace")).id(egui::Id::new("find_replace")).open(&mut open).default_pos(at).default_width(400.0).resizable(true).collapsible(false).show(ctx, |ui| panel(app, ui));
|
||||
let shown = crate::windows::new(ctx, tr!("Find and Replace")).id(egui::Id::unique("find_replace")).open(&mut open).default_pos(at).default_width(400.0).resizable(true).collapsible(false).show(ctx, |ui| panel(app, ui));
|
||||
a11y::name_title_bar(&shown, tr!("Find and Replace"));
|
||||
app.find.open = open;
|
||||
}
|
||||
@@ -494,7 +494,7 @@ fn results_list(app: &mut App, ui: &mut egui::Ui, list: &[Hit]) {
|
||||
let label = format!("{field} · {place}");
|
||||
p.with_clip_rect(right.intersect(ui.clip_rect())).text(pos2(right.left(), r.center().y), Align2::LEFT_CENTER, &label, font(Type::Caption), color(Type::Caption));
|
||||
let name = tr!("{what}, {field}, {place}", what = what, field = field, place = place);
|
||||
a11y::control(ui, &resp, WidgetType::SelectableLabel, &name, Some(on));
|
||||
a11y::control(ui, &resp, Role::Button, &name, Some(on));
|
||||
if resp.on_hover_text(&name).clicked() {
|
||||
clicked = Some(i);
|
||||
}
|
||||
|
||||
+35
-4
@@ -53,7 +53,7 @@ fn without_tests(src: &str) -> String {
|
||||
/// Code before a literal, on its line, that makes it something other than interface text:
|
||||
/// logs and console output, ids and keys, commands and their parameters, attributes.
|
||||
const NOT_UI: &[&str] = &[
|
||||
"eprintln!(", "println!(", "print!(", "panic!(", "assert", "unreachable!(", "Id::new(", "id_salt(", "persistent_id(", "json!(", "execute(", "perform(", "invoke(", ".run(", "find_command(", "#[", "env!(", "include_str!(", "include_bytes!(", "concat!(", "var(",
|
||||
"eprintln!(", "println!(", "print!(", "panic!(", "assert", "unreachable!(", "Id::unique(", "id_salt(", "persistent_id(", "json!(", "execute(", "perform(", "invoke(", ".run(", "find_command(", "#[", "env!(", "include_str!(", "include_bytes!(", "concat!(", "var(",
|
||||
"contains(", "starts_with(", "ends_with(", "strip_prefix(", "strip_suffix(", "matches!(", "== ", "!= ",
|
||||
// The start-up log (`startup::line`): English, like console messages, for bug reports.
|
||||
"line(&", "write(&format!(",
|
||||
@@ -575,8 +575,27 @@ fn strings_in(v: &serde_json::Value, out: &mut BTreeSet<String>) {
|
||||
}
|
||||
}
|
||||
|
||||
/// Names egui gives its own parts.
|
||||
const EGUI_OWN: [&str; 1] = ["Close window"];
|
||||
/// Names egui gives its own parts: a window's close button, and (since egui 0.37) the handles
|
||||
/// that resize a panel or a window. egui offers no way to name them ourselves.
|
||||
const EGUI_OWN: [&str; 10] = [
|
||||
"Close window",
|
||||
"Resize panel",
|
||||
"Resize window right edge",
|
||||
"Resize window left edge",
|
||||
"Resize window bottom edge",
|
||||
"Resize window top edge",
|
||||
"Resize window bottom-right corner",
|
||||
"Resize window top-right corner",
|
||||
"Resize window bottom-left corner",
|
||||
"Resize window top-left corner",
|
||||
];
|
||||
|
||||
/// A file's path, as a recent file's or a template's tooltip shows it (egui 0.37 hands a tooltip
|
||||
/// to screen readers as the control's description): data, not words to translate.
|
||||
fn is_file_path(name: &str) -> bool {
|
||||
let ext = std::path::Path::new(name).extension().and_then(|e| e.to_str());
|
||||
name.contains(['/', '\\']) && !name.ends_with('…') && ext.is_some_and(|e| !e.is_empty() && e.chars().all(|c| c.is_ascii_alphanumeric()))
|
||||
}
|
||||
|
||||
/// Names a screen reader would announce that are still plain English in the pseudo-locale,
|
||||
/// for the window after `setup` (a few frames to settle).
|
||||
@@ -612,6 +631,16 @@ fn pseudo_a11y_name_exception_is_only_the_product_name() {
|
||||
assert!(!pseudo_name_is_translated_or_exempt("Save AniCraft"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn a_file_path_is_data_but_a_sentence_with_a_slash_is_not() {
|
||||
assert!(is_file_path("Characters/Walk cycle.anicraft"));
|
||||
assert!(is_file_path("/tmp/AniCraft samples/Title card.anicraft"));
|
||||
assert!(is_file_path(r"C:\Users\me\Walk cycle.fla"));
|
||||
assert!(!is_file_path("Import/Export…"));
|
||||
assert!(!is_file_path("Open an .fla or .xfl"));
|
||||
assert!(!is_file_path("Show or hide the layer"));
|
||||
}
|
||||
|
||||
/// Names in `nodes` that are ours and still plain English.
|
||||
fn plain_names(what: &str, app: &crate::app::App, nodes: Vec<(egui::accesskit::NodeId, egui::accesskit::Node)>) -> Vec<String> {
|
||||
// Document text is the document's (layer, symbol and scene names): not ours to translate.
|
||||
@@ -619,6 +648,8 @@ fn plain_names(what: &str, app: &crate::app::App, nodes: Vec<(egui::accesskit::N
|
||||
if let Ok(v) = serde_json::to_value(&app.s.doc) {
|
||||
strings_in(&v, &mut doc_text);
|
||||
}
|
||||
// So are open documents' names (their file names, in the Window menu); "Untitled" is ours.
|
||||
doc_text.extend(crate::tabs::infos(app).into_iter().map(|t| t.name).filter(|n| n.chars().any(char::is_alphanumeric) && !n.chars().any(pseudo::is_accented)));
|
||||
let mut found = BTreeSet::new();
|
||||
for (_, n) in nodes {
|
||||
for name in [n.label(), n.description()].into_iter().flatten() {
|
||||
@@ -626,7 +657,7 @@ fn plain_names(what: &str, app: &crate::app::App, nodes: Vec<(egui::accesskit::N
|
||||
// (docs/localisation.md › Not yet). The product name stays as it is in every
|
||||
// language (the macOS app menu is titled with it, ADR 0006), as the source scan allows.
|
||||
let translated = pseudo_name_is_translated_or_exempt(name);
|
||||
let ours = scan::is_prose(name) && !doc_text.contains(name) && !doc_text.iter().any(|d| name.contains(d.as_str()));
|
||||
let ours = scan::is_prose(name) && !is_file_path(name) && !doc_text.contains(name) && !doc_text.iter().any(|d| name.contains(d.as_str()));
|
||||
if ours && !translated {
|
||||
found.insert(format!("[{what}] {:?} {name:?}", n.role()));
|
||||
}
|
||||
|
||||
+2
-2
@@ -62,7 +62,7 @@ fn key_button(app: &mut App, ui: &mut egui::Ui, layer: &Layer, frame: u32) {
|
||||
let fill = if here { color } else { egui::Color32::TRANSPARENT };
|
||||
ui.painter().add(egui::Shape::convex_polygon(pts, fill, Stroke::new(1.5, color)));
|
||||
let tip = if here { tr!("Remove the depth key on this frame") } else { tr!("Key the depth on this frame: the depth then tweens between keys") };
|
||||
a11y::control(ui, &resp, egui::WidgetType::Button, tr!("Depth key"), Some(here));
|
||||
a11y::control(ui, &resp, egui::Role::Button, tr!("Depth key"), Some(here));
|
||||
if resp.on_hover_text(tip).clicked() {
|
||||
if here {
|
||||
app.run("layer.remove_depth_key", json!({"layer": layer.id.0, "frame": frame}));
|
||||
@@ -142,7 +142,7 @@ fn layer_row(app: &mut App, ui: &mut egui::Ui, layer: &Layer, frame: u32) {
|
||||
let handle = egui::Rect::from_center_size(pos2(hx, y), vec2(8.0, track.height() * 0.8));
|
||||
let fill = if layer.attached { T.text_faint } else { to_color32(layer.color) };
|
||||
p.rect(handle, 2.0, fill, Stroke::new(if hot { 1.5 } else { 1.0 }, if hot { T.icon_hot } else { T.border }), StrokeKind::Inside);
|
||||
a11y::control(ui, &resp, egui::WidgetType::Slider, &label, None);
|
||||
a11y::control(ui, &resp, egui::Role::Slider, &label, None);
|
||||
if (resp.dragged() || resp.clicked())
|
||||
&& let Some(at) = resp.interact_pointer_pos()
|
||||
{
|
||||
|
||||
+1
-1
@@ -104,7 +104,7 @@ pub fn window(app: &mut App, ctx: &egui::Context) {
|
||||
let video = app.s.timeline().layer(d.layer).and_then(|l| l.video.as_deref()).map(|v| (v.path.clone(), !crate::platform::WEB && !std::path::Path::new(&v.path).is_file()));
|
||||
let (mut relink, mut remove_video) = (false, false);
|
||||
let (mut submit, mut cancel) = (false, false);
|
||||
crate::windows::new(ctx, tr!("Layer Properties")).id(egui::Id::new("layer_props")).collapsible(false).resizable(false).anchor(egui::Align2::CENTER_CENTER, [0.0, -80.0]).show(ctx, |ui| {
|
||||
crate::windows::new(ctx, tr!("Layer Properties")).id(egui::Id::unique("layer_props")).collapsible(false).resizable(false).anchor(egui::Align2::CENTER_CENTER, [0.0, -80.0]).show(ctx, |ui| {
|
||||
ui.set_min_width(420.0);
|
||||
form_row(ui, FORM_LABEL_DIALOG, tr!("Name"), |ui| {
|
||||
let r = ui.add(egui::TextEdit::singleline(&mut d.name).desired_width(f32::INFINITY)).named(tr!("Layer name"));
|
||||
|
||||
+5
-5
@@ -12,7 +12,7 @@ use anicraft_engine::StateId;
|
||||
use anicraft_engine::cmds_library::entry_json;
|
||||
use anicraft_engine::doc::library::MAX_FOLDER_DEPTH;
|
||||
use anicraft_engine::doc::{Document, FolderId, LibraryEntry, LibraryItem, SymbolKind};
|
||||
use egui::{Align2, Key, Modifiers, Pos2, Rect, Sense, Stroke, StrokeKind, WidgetType, pos2, vec2};
|
||||
use egui::{Align2, Key, Modifiers, Pos2, Rect, Sense, Stroke, StrokeKind, Role, pos2, vec2};
|
||||
use serde_json::json;
|
||||
use std::collections::{HashMap, HashSet};
|
||||
|
||||
@@ -337,7 +337,7 @@ pub fn stage_drop(app: &mut App, ui: &egui::Ui, resp: &egui::Response, to_stage:
|
||||
return;
|
||||
}
|
||||
ui.ctx().set_cursor_icon(egui::CursorIcon::Copy);
|
||||
let painter = ui.ctx().layer_painter(egui::LayerId::new(egui::Order::Foreground, egui::Id::new("library_drop")));
|
||||
let painter = ui.ctx().layer_painter(egui::LayerId::new(egui::Order::Foreground, egui::Id::unique("library_drop")));
|
||||
let only_sounds = items.iter().all(|i| matches!(i, LibraryItem::Sound(_)));
|
||||
if !only_sounds {
|
||||
let r = 7.0;
|
||||
@@ -360,7 +360,7 @@ fn drag_ghost(app: &App, ctx: &egui::Context) {
|
||||
let (Some(first), Some(p)) = (items.first(), ctx.input(|i| i.pointer.latest_pos())) else { return };
|
||||
let name = app.s.doc.item_name(*first).unwrap_or("").to_string();
|
||||
let label = if items.len() > 1 { trn!("{name} and {n} more", "{name} and {n} more", items.len() - 1, name = name) } else { name };
|
||||
let painter = ctx.layer_painter(egui::LayerId::new(egui::Order::Tooltip, egui::Id::new("library_ghost")));
|
||||
let painter = ctx.layer_painter(egui::LayerId::new(egui::Order::Tooltip, egui::Id::unique("library_ghost")));
|
||||
let galley = painter.layout_no_wrap(label, font(Type::Body), color(Type::Body));
|
||||
let at = p + vec2(14.0, -galley.size().y - 8.0);
|
||||
painter.rect_filled(Rect::from_min_size(at, galley.size()).expand(4.0), T.rc(), T.accent_dim);
|
||||
@@ -577,7 +577,7 @@ fn list_ui(app: &mut App, ui: &mut egui::Ui, list: &[Row], unused: &HashSet<Libr
|
||||
None => String::new(),
|
||||
};
|
||||
let name = if used_note.is_empty() { format!("{} · {}", row.name, row.detail) } else { format!("{} · {} · {}", row.name, row.detail, used_note) };
|
||||
a11y::control(ui, &resp, WidgetType::SelectableLabel, &name, Some(selected));
|
||||
a11y::control(ui, &resp, Role::Button, &name, Some(selected));
|
||||
let resp = resp.on_hover_text(&name);
|
||||
// Dragging rows: the selection if the row is in it, else just the row.
|
||||
if resp.drag_started() {
|
||||
@@ -872,7 +872,7 @@ fn preview(app: &mut App, ui: &mut egui::Ui) {
|
||||
waveform(app, ui, inner, id);
|
||||
let play = Rect::from_min_size(pos2(r.right() - TARGET - 4.0, r.top() + 4.0), vec2(TARGET, TARGET));
|
||||
let resp = ui.put(play, egui::Button::new("▶").min_size(vec2(TARGET, TARGET)));
|
||||
a11y::control(ui, &resp, WidgetType::Button, tr!("Play the sound"), None);
|
||||
a11y::control(ui, &resp, Role::Button, tr!("Play the sound"), None);
|
||||
if resp.on_hover_text(tr!("Plays the sound on its own")).clicked()
|
||||
&& let Some(dec) = app.s.doc.sound(id).and_then(|x| x.decoded())
|
||||
{
|
||||
|
||||
+2
-2
@@ -176,7 +176,7 @@ fn save_window(app: &mut App, ctx: &egui::Context) {
|
||||
let mut save = false;
|
||||
let mut cancel = false;
|
||||
let title = tr!("Save As Command");
|
||||
let shown = crate::windows::new(ctx, title).id(egui::Id::new("save_as_command")).open(&mut open).collapsible(false).resizable(false).pivot(egui::Align2::CENTER_CENTER).default_pos(ctx.content_rect().center()).show(ctx, |ui| {
|
||||
let shown = crate::windows::new(ctx, title).id(egui::Id::unique("save_as_command")).open(&mut open).collapsible(false).resizable(false).pivot(egui::Align2::CENTER_CENTER).default_pos(ctx.content_rect().center()).show(ctx, |ui| {
|
||||
ui.set_min_width(380.0);
|
||||
ui.horizontal(|ui| {
|
||||
ui.label(text(Type::Label, tr!("Name")));
|
||||
@@ -300,7 +300,7 @@ fn manage_window(app: &mut App, ctx: &egui::Context) {
|
||||
let mut open = true;
|
||||
let mut acts: Vec<Act> = Vec::new();
|
||||
let title = tr!("Manage Saved Commands");
|
||||
let shown = crate::windows::new(ctx, title).id(egui::Id::new("manage_saved_commands")).open(&mut open).collapsible(false).resizable(false).default_width(760.0).show(ctx, |ui| {
|
||||
let shown = crate::windows::new(ctx, title).id(egui::Id::unique("manage_saved_commands")).open(&mut open).collapsible(false).resizable(false).default_width(760.0).show(ctx, |ui| {
|
||||
ui.set_min_width(720.0);
|
||||
let list = app.macros.list.clone();
|
||||
if list.is_empty() {
|
||||
|
||||
+11
-11
@@ -26,7 +26,7 @@ use crate::a11y::{self, Named};
|
||||
use crate::app::App;
|
||||
use crate::theme::{SQUARE, T, TARGET, Type, color, font, text, with_type};
|
||||
use anicraft_engine::doc::{Channel, ColorStyle, Easing, Element, FilterColor, FilterParam, FilterProp, MotionTween, Pin, Property, Props, Rgba, Track, filter_properties, own_value};
|
||||
use egui::{Align2, Color32, Pos2, Rect, Sense, Stroke, WidgetType, pos2, vec2};
|
||||
use egui::{Align2, Color32, Pos2, Rect, Sense, Stroke, Role, pos2, vec2};
|
||||
use serde_json::json;
|
||||
|
||||
/// Property list width (the timeline's layer column).
|
||||
@@ -322,11 +322,11 @@ pub fn show(app: &mut App, ui: &mut egui::Ui) {
|
||||
if track.is_some() {
|
||||
painter.text(pos2(row.left() + 84.0, row.center().y), Align2::LEFT_CENTER, tr!("keyed"), font(Type::Caption), T.tween_motion);
|
||||
}
|
||||
let rr = ui.interact(row, ui.id().with(("me_row", p.key())), Sense::click());
|
||||
let rr = ui.interact(row, ui.scope_id().with(("me_row", p.key())), Sense::click());
|
||||
// Named with its filter for screen readers and tips ("Blur: Blur X").
|
||||
let label = prop_name(&target, p, true);
|
||||
let label = label.as_str();
|
||||
a11y::control(ui, &rr, WidgetType::SelectableLabel, &if track.is_some() { tr!("{property} · keyed", property = label) } else { label.to_string() }, Some(selected));
|
||||
a11y::control(ui, &rr, Role::Button, &if track.is_some() { tr!("{property} · keyed", property = label) } else { label.to_string() }, Some(selected));
|
||||
if rr.clicked() {
|
||||
app.me_prop = p;
|
||||
app.me_key = None;
|
||||
@@ -374,7 +374,7 @@ pub fn show(app: &mut App, ui: &mut egui::Ui) {
|
||||
// Key toggle: a filled diamond where this property has a key at the playhead.
|
||||
let keyed = track.is_some_and(|t| t.key_at(offset).is_some());
|
||||
let toggle = Rect::from_center_size(pos2(row.right() - 20.0, row.center().y), vec2(24.0, 24.0));
|
||||
let tr = ui.interact(toggle, ui.id().with(("me_key", p.key())), Sense::click());
|
||||
let tr = ui.interact(toggle, ui.scope_id().with(("me_key", p.key())), Sense::click());
|
||||
if tr.hovered() {
|
||||
painter.rect_filled(toggle, T.rc(), T.hover);
|
||||
}
|
||||
@@ -384,7 +384,7 @@ pub fn show(app: &mut App, ui: &mut egui::Ui) {
|
||||
(true, _) => tr!("Remove the {property} keyframe at frame {frame}", property = label, frame = app.s.frame + 1),
|
||||
(false, _) => tr!("Add a {property} keyframe at frame {frame}", property = label, frame = app.s.frame + 1),
|
||||
};
|
||||
a11y::control(ui, &tr, WidgetType::Checkbox, &tr!("{property} keyframe at frame {frame}", property = label, frame = app.s.frame + 1), Some(keyed));
|
||||
a11y::control(ui, &tr, Role::CheckBox, &tr!("{property} keyframe at frame {frame}", property = label, frame = app.s.frame + 1), Some(keyed));
|
||||
if tr.on_hover_text(tip).clicked() {
|
||||
app.me_prop = p;
|
||||
if keyed {
|
||||
@@ -557,9 +557,9 @@ pub fn show(app: &mut App, ui: &mut egui::Ui) {
|
||||
// ---- graph interaction -------------------------------------------------------------------
|
||||
// Pointer work; the keyboard route to the same values is the property list and its fields.
|
||||
// Focusable: with the curve focused, Left and Right move the picked keys (ADR 0083).
|
||||
let gr = ui.interact(graph_full, ui.id().with("me_graph"), Sense::click_and_drag());
|
||||
let gr = ui.interact(graph_full, ui.scope_id().with("me_graph"), Sense::click_and_drag());
|
||||
// Where frames and values are drawn, for tests that point at keys.
|
||||
ui.ctx().data_mut(|d| d.insert_temp(egui::Id::new("me_geometry"), (inner, lane, last, lo, hi)));
|
||||
ui.ctx().data_mut(|d| d.insert_temp(egui::Id::unique("me_geometry"), (inner, lane, last, lo, hi)));
|
||||
a11y::surface(ui, &gr, &tr!("{property} curve: Left and Right move the picked keys a frame", property = label));
|
||||
keyboard(app, ui, &gr, start);
|
||||
let hover = gr.hover_pos();
|
||||
@@ -778,8 +778,8 @@ fn colour_row(app: &mut App, ui: &mut egui::Ui, painter: &egui::Painter, row: Re
|
||||
}
|
||||
let key = format!("filter.{slot}.{}", c.key());
|
||||
let full = tr!("{filter}: {colour}", filter = crate::i18n::t(filter_name(target, slot)), colour = name);
|
||||
let rr = ui.interact(row, ui.id().with(("me_colour", slot, c)), Sense::click());
|
||||
a11y::control(ui, &rr, WidgetType::CollapsingHeader, &if any_track { tr!("{property} · keyed", property = full.as_str()) } else { full.clone() }, Some(open));
|
||||
let rr = ui.interact(row, ui.scope_id().with(("me_colour", slot, c)), Sense::click());
|
||||
a11y::control(ui, &rr, Role::DisclosureTriangle, &if any_track { tr!("{property} · keyed", property = full.as_str()) } else { full.clone() }, Some(open));
|
||||
if rr.clicked() {
|
||||
if open {
|
||||
app.me_open.retain(|o| *o != (slot, c));
|
||||
@@ -805,13 +805,13 @@ fn colour_row(app: &mut App, ui: &mut egui::Ui, painter: &egui::Painter, row: Re
|
||||
// The diamond: filled where all four channels have a key at the playhead.
|
||||
let keyed = four.iter().all(|p| m.track(*p).is_some_and(|t| t.key_at(offset).is_some()));
|
||||
let toggle = Rect::from_center_size(pos2(row.right() - 20.0, row.center().y), vec2(24.0, 24.0));
|
||||
let tr = ui.interact(toggle, ui.id().with(("me_colour_key", slot, c)), Sense::click());
|
||||
let tr = ui.interact(toggle, ui.scope_id().with(("me_colour_key", slot, c)), Sense::click());
|
||||
if tr.hovered() {
|
||||
painter.rect_filled(toggle, T.rc(), T.hover);
|
||||
}
|
||||
diamond(painter, toggle.center(), 5.0, if keyed { T.text } else { Color32::TRANSPARENT }, Stroke::new(1.5, if keyed { T.text } else { T.text_faint }));
|
||||
let tip = if keyed { tr!("Remove the {property} keyframe at frame {frame}", property = full.as_str(), frame = app.s.frame + 1) } else { tr!("Add a {property} keyframe at frame {frame}", property = full.as_str(), frame = app.s.frame + 1) };
|
||||
a11y::control(ui, &tr, WidgetType::Checkbox, &tr!("{property} keyframe at frame {frame}", property = full.as_str(), frame = app.s.frame + 1), Some(keyed));
|
||||
a11y::control(ui, &tr, Role::CheckBox, &tr!("{property} keyframe at frame {frame}", property = full.as_str(), frame = app.s.frame + 1), Some(keyed));
|
||||
if tr.on_hover_text(tip).clicked() {
|
||||
if keyed {
|
||||
app.run("motion.remove_key", json!({"property": key, "frame": app.s.frame}));
|
||||
|
||||
@@ -14,7 +14,7 @@ use anicraft_engine::StateId;
|
||||
use anicraft_engine::doc::{LayerKind, SymbolKind};
|
||||
use anicraft_engine::explorer::{self, NodeKind, Options, Row, Show, Tree};
|
||||
use anicraft_engine::find::Scope;
|
||||
use egui::{Key, Rect, Sense, Stroke, StrokeKind, WidgetType, pos2, vec2};
|
||||
use egui::{Key, Rect, Sense, Stroke, StrokeKind, Role, pos2, vec2};
|
||||
use std::collections::HashSet;
|
||||
use std::sync::Arc;
|
||||
|
||||
@@ -173,7 +173,7 @@ pub fn panel(app: &mut App, ui: &mut egui::Ui) {
|
||||
// The search, and the Show menu: kinds of rows, which scenes, the Library's symbols.
|
||||
ui.horizontal(|ui| {
|
||||
// The search takes what the Show button (as wide as its translation) leaves.
|
||||
let menu_w_id = ui.id().with("explorer_show_w");
|
||||
let menu_w_id = ui.scope_id().with("explorer_show_w");
|
||||
let menu_w = ui.data(|d| d.get_temp::<f32>(menu_w_id)).unwrap_or(72.0) + ui.spacing().item_spacing.x;
|
||||
let search = ui.add(egui::TextEdit::singleline(&mut app.explorer.filter).hint_text(tr!("Search")).desired_width((ui.available_width() - menu_w).max(crate::theme::MIN_FIELD)));
|
||||
search.set_name(tr!("Search the Movie Explorer"));
|
||||
@@ -259,7 +259,7 @@ fn list(app: &mut App, ui: &mut egui::Ui, t: &Tree) {
|
||||
(true, false) => tr!("{kind}: {row}, closed", kind = kind, row = label),
|
||||
_ => tr!("{kind}: {row}", kind = kind, row = label),
|
||||
};
|
||||
a11y::control(ui, &resp, WidgetType::SelectableLabel, &name, Some(on));
|
||||
a11y::control(ui, &resp, Role::Button, &name, Some(on));
|
||||
let resp = resp.on_hover_text(tr!("{row}\nDouble-click to go there", row = name));
|
||||
if resp.clicked() {
|
||||
let on_chevron = ui.input(|inp| inp.pointer.interact_pos()).is_some_and(|q| q.x < icon.left());
|
||||
|
||||
+5
-5
@@ -213,15 +213,15 @@ pub fn buttons(app: &mut App, ui: &mut egui::Ui) {
|
||||
toggle_edit_multiple(app);
|
||||
}
|
||||
let (rect, resp) = ui.allocate_exact_size(vec2(16.0, crate::theme::TARGET), Sense::click());
|
||||
let hot = resp.hovered() || egui::Popup::is_id_open(ui.ctx(), egui::Id::new(MENU_ID));
|
||||
let hot = resp.hovered() || egui::Popup::is_id_open(ui.ctx(), egui::Id::unique(MENU_ID));
|
||||
ui.painter().rect_filled(rect, T.rc(), if hot { T.header } else { Color32::TRANSPARENT });
|
||||
crate::icons::paint(ui.painter(), Rect::from_center_size(rect.center(), vec2(12.0, 12.0)), crate::icons::Icon::ChevronDown, if hot { T.icon_hot } else { T.icon });
|
||||
crate::a11y::control(ui, &resp, egui::WidgetType::Button, tr!("Onion skin options"), None);
|
||||
crate::a11y::control(ui, &resp, egui::Role::Button, tr!("Onion skin options"), None);
|
||||
let resp = resp.on_hover_text(tr!("Onion skin options: markers, outlines, colours"));
|
||||
if std::mem::take(&mut app.onion_ui.open_menu) {
|
||||
egui::Popup::open_id(ui.ctx(), egui::Id::new(MENU_ID));
|
||||
egui::Popup::open_id(ui.ctx(), egui::Id::unique(MENU_ID));
|
||||
}
|
||||
let shown = egui::Popup::menu(&resp).id(egui::Id::new(MENU_ID)).close_behavior(egui::PopupCloseBehavior::CloseOnClickOutside).show(|ui| {
|
||||
let shown = egui::Popup::menu(&resp).id(egui::Id::unique(MENU_ID)).close_behavior(egui::PopupCloseBehavior::CloseOnClickOutside).show(|ui| {
|
||||
ui.set_min_width(230.0);
|
||||
menu(app, ui);
|
||||
});
|
||||
@@ -273,7 +273,7 @@ pub fn ruler(app: &mut App, ui: &mut egui::Ui, ruler: Rect, cell_w: f32, x_of: i
|
||||
painter.circle_filled(pos2(x + serif * 0.6, ruler.center().y), 2.0, c);
|
||||
}
|
||||
let hit = Rect::from_center_size(pos2(x, ruler.center().y), vec2(10.0, ruler.height()));
|
||||
let id = ui.id().with(("onion_marker", start));
|
||||
let id = ui.scope_id().with(("onion_marker", start));
|
||||
let resp = ui.interact(hit, id, crate::a11y::pointer_only());
|
||||
let at = if start { first } else { last };
|
||||
let name = if start { tr!("Onion start marker") } else { tr!("Onion end marker") };
|
||||
|
||||
+29
-29
@@ -5,7 +5,7 @@ use crate::icons::{self, Icon};
|
||||
use crate::theme::{Section, T, TARGET, TOOL_BUTTON, TOOL_ICON, Type, color, section, text, to_color32, with_type};
|
||||
use anicraft_engine::doc::{ColorEffect, ColorStyle, ElementKind, LibraryItem, LineType, MAX_PATH_OFFSET, Paint, Rgba, SymbolKind, TextKind, evaluate_layer_elements};
|
||||
use crate::a11y::{self, Named};
|
||||
use egui::{Color32, Rect, Sense, Stroke, StrokeKind, WidgetType, pos2, vec2};
|
||||
use egui::{Color32, Rect, Sense, Stroke, StrokeKind, Role, pos2, vec2};
|
||||
use serde_json::{Value, json};
|
||||
|
||||
// ----- tools --------------------------------------------------------------------------------
|
||||
@@ -104,7 +104,7 @@ fn tool_items(app: &mut App, ui: &mut egui::Ui, area: Rect, flow: ToolFlow) {
|
||||
let (rect, resp) = ui.allocate_exact_size(vec2(TOOL_BUTTON, TOOL_BUTTON), Sense::click());
|
||||
#[cfg(test)]
|
||||
if tool == Tool::Hand {
|
||||
ui.ctx().data_mut(|data| data.insert_temp(egui::Id::new("test_hand_tool_rect"), rect));
|
||||
ui.ctx().data_mut(|data| data.insert_temp(egui::Id::unique("test_hand_tool_rect"), rect));
|
||||
}
|
||||
let active = app.tool == tool;
|
||||
// The active tool sits on a lighter gray block with a white icon; the rest are a
|
||||
@@ -121,7 +121,7 @@ fn tool_items(app: &mut App, ui: &mut egui::Ui, area: Rect, flow: ToolFlow) {
|
||||
icons::paint(ui.painter(), Rect::from_center_size(rect.center(), vec2(TOOL_ICON, TOOL_ICON)), tool_icon(tool), tint);
|
||||
// "Pen tool (P)": what the tooltip says first, and what a screen reader says.
|
||||
let name = a11y::with_key(&tr!("{tool} tool", tool = crate::i18n::t(tool.label())), app.keymap.primary(crate::keymap::tool_id(tool)));
|
||||
a11y::control(ui, &resp, WidgetType::Button, &name, Some(active));
|
||||
a11y::control(ui, &resp, Role::Button, &name, Some(active));
|
||||
if active {
|
||||
a11y::anchor(ui, a11y::Region::Tools, area, &resp);
|
||||
}
|
||||
@@ -176,7 +176,7 @@ fn tool_items(app: &mut App, ui: &mut egui::Ui, area: Rect, flow: ToolFlow) {
|
||||
let tint = if on { T.on_active } else if resp.hovered() { T.icon_hot } else { T.icon };
|
||||
icons::paint(ui.painter(), Rect::from_center_size(rect.center(), vec2(TOOL_ICON, TOOL_ICON)), Icon::Magnet, tint);
|
||||
let name = a11y::with_key(tr!("Snap to Objects"), app.keymap.primary("draw.snap_to_objects"));
|
||||
a11y::control(ui, &resp, WidgetType::Checkbox, &name, Some(on));
|
||||
a11y::control(ui, &resp, Role::CheckBox, &name, Some(on));
|
||||
let resp = resp.on_hover_text(if on { tr!("{name}: on
|
||||
Dragged points and selections snap to points, lines and fill edges within 10 pixels.", name = name) } else { tr!("{name}: off
|
||||
Dragged points and selections snap to points, lines and fill edges within 10 pixels.", name = name) });
|
||||
@@ -195,8 +195,8 @@ fn tool_swatches(app: &mut App, ui: &mut egui::Ui) {
|
||||
let back = Rect::from_min_size(r.left_top() + vec2(14.0, 14.0), vec2(24.0, 24.0));
|
||||
let front = Rect::from_min_size(r.left_top() + vec2(2.0, 2.0), vec2(24.0, 24.0));
|
||||
// The fill first, so the stroke's frame (on top) takes the clicks where they overlap.
|
||||
let fill_resp = ui.interact(back, ui.id().with("tool_fill"), Sense::click());
|
||||
let stroke_resp = ui.interact(front, ui.id().with("tool_stroke"), Sense::click());
|
||||
let fill_resp = ui.interact(back, ui.scope_id().with("tool_fill"), Sense::click());
|
||||
let stroke_resp = ui.interact(front, ui.scope_id().with("tool_stroke"), Sense::click());
|
||||
let st = &app.s.style;
|
||||
let hot = |r: &egui::Response| if r.hovered() { T.selection } else { T.border };
|
||||
ui.painter().rect_filled(back, T.rc(), if st.use_fill { to_color32(st.fill) } else { T.field });
|
||||
@@ -206,7 +206,7 @@ fn tool_swatches(app: &mut App, ui: &mut egui::Ui) {
|
||||
ui.painter().rect_stroke(front, T.rc(), Stroke::new(1.0, hot(&stroke_resp)), StrokeKind::Inside);
|
||||
for (fill, resp) in [(true, fill_resp), (false, stroke_resp)] {
|
||||
let name = if fill { tr!("Fill colour") } else { tr!("Stroke colour") };
|
||||
a11y::control(ui, &resp, WidgetType::ColorButton, name, None);
|
||||
a11y::control(ui, &resp, Role::ColorWell, name, None);
|
||||
let resp = resp.on_hover_text(if fill { tr!("Fill colour: click to pick the colour and how clear it is. Each stop of a gradient has its own.") } else { tr!("Stroke colour: click to pick the colour and how clear it is") });
|
||||
// As in Animate, the square clicked last is the one swatches set (ADR 0078).
|
||||
if resp.clicked() {
|
||||
@@ -306,7 +306,7 @@ pub fn edit_bar(app: &mut App, ui: &mut egui::Ui) {
|
||||
#[cfg(test)]
|
||||
ui.ctx().data_mut(|data| {
|
||||
data.insert_temp(
|
||||
egui::Id::new("test_scene_label_rect"),
|
||||
egui::Id::unique("test_scene_label_rect"),
|
||||
label_response.interact_rect,
|
||||
);
|
||||
});
|
||||
@@ -364,11 +364,11 @@ pub fn edit_bar(app: &mut App, ui: &mut egui::Ui) {
|
||||
#[cfg(test)]
|
||||
ui.ctx().data_mut(|data| {
|
||||
data.insert_temp(
|
||||
egui::Id::new("test_scene_arrow_rect"),
|
||||
egui::Id::unique("test_scene_arrow_rect"),
|
||||
scene_response.interact_rect,
|
||||
);
|
||||
data.insert_temp(
|
||||
egui::Id::new("test_scene_arrow_id"),
|
||||
egui::Id::unique("test_scene_arrow_id"),
|
||||
scene_response.id,
|
||||
);
|
||||
});
|
||||
@@ -424,12 +424,12 @@ pub fn edit_bar(app: &mut App, ui: &mut egui::Ui) {
|
||||
});
|
||||
crate::icons::paint(ui.painter(), Rect::from_center_size(arrow.response.rect.center(), vec2(12.0, 12.0)), Icon::ChevronDown, if arrow.response.hovered() { T.icon_hot } else { T.icon });
|
||||
arrow.response.set_name(tr!("Zoom presets"));
|
||||
ui.ctx().data_mut(|d| d.insert_temp(egui::Id::new("zoom_arrow"), arrow.response.rect));
|
||||
ui.ctx().data_mut(|d| d.insert_temp(egui::Id::unique("zoom_arrow"), arrow.response.rect));
|
||||
// The percentage itself is typed here: focus to type a value, Enter or focus loss applies it.
|
||||
let was_editing = app.zoom_text.is_some();
|
||||
let mut value = app.zoom_text.take().unwrap_or_else(|| format!("{:>4.0}%", z * 100.0));
|
||||
let field = with_type(ui, Type::Data, |ui| ui.add(egui::TextEdit::singleline(&mut value).desired_width(56.0).char_limit(7)).named(tr!("Zoom")));
|
||||
ui.ctx().data_mut(|d| d.insert_temp(egui::Id::new("zoom_field"), field.rect));
|
||||
ui.ctx().data_mut(|d| d.insert_temp(egui::Id::unique("zoom_field"), field.rect));
|
||||
if !was_editing && field.gained_focus() {
|
||||
// Type digits over digits, not over the percent sign.
|
||||
value = format!("{:.0}", z * 100.0);
|
||||
@@ -674,7 +674,7 @@ pub(crate) fn align_panel(app: &mut App, ui: &mut egui::Ui) {
|
||||
Some(k) => format!("{} ({})", crate::i18n::t_cmd(c.id, c.label), crate::platform::shortcut_label(k)),
|
||||
None => crate::i18n::t_cmd(c.id, c.label).to_string(),
|
||||
});
|
||||
a11y::control(ui, &resp, WidgetType::Button, &tip, None);
|
||||
a11y::control(ui, &resp, Role::Button, &tip, None);
|
||||
let tip = if has_sel { tip } else { tr!("{command}\nSelect something to align", command = tip) };
|
||||
if resp.on_hover_text(tip).clicked() {
|
||||
// Leave it unset when off, so a single shape still aligns to the stage.
|
||||
@@ -1164,7 +1164,7 @@ fn selection_props(app: &mut App, ui: &mut egui::Ui, e: &anicraft_engine::doc::E
|
||||
if lock.clicked() {
|
||||
app.scale_lock = !locked;
|
||||
}
|
||||
ui.ctx().data_mut(|d| d.insert_temp(egui::Id::new("scale_lock_geometry"), (a.rect, b.rect, lock.rect)));
|
||||
ui.ctx().data_mut(|d| d.insert_temp(egui::Id::unique("scale_lock_geometry"), (a.rect, b.rect, lock.rect)));
|
||||
if a.changed() || b.changed() {
|
||||
if locked {
|
||||
(sx, sy) = linked_scale((sx0, sy0), (sx, sy), a.changed());
|
||||
@@ -1730,7 +1730,7 @@ fn filter_grip(ui: &mut egui::Ui, fname: &str, i: usize, n: usize, act: &mut Opt
|
||||
}
|
||||
}
|
||||
let (up, down) = (crate::platform::shortcut_label("Alt+Up"), crate::platform::shortcut_label("Alt+Down"));
|
||||
a11y::control(ui, &resp, WidgetType::Button, &tr!("Move {filter}: drag, or {up} and {down}", filter = fname, up = up.as_str(), down = down.as_str()), None);
|
||||
a11y::control(ui, &resp, Role::Button, &tr!("Move {filter}: drag, or {up} and {down}", filter = fname, up = up.as_str(), down = down.as_str()), None);
|
||||
resp.on_hover_text(tr!("Drag to change the order (filters apply from the top down)"))
|
||||
}
|
||||
|
||||
@@ -1766,7 +1766,7 @@ fn filter_rows(app: &mut App, ui: &mut egui::Ui, current: &[anicraft_engine::doc
|
||||
.response
|
||||
.set_name(tr!("Add filter"));
|
||||
let pr = crate::timeline::icon_button(ui, tr!("Filter presets: apply, save, rename, delete, import, export"), None, Icon::Folder);
|
||||
egui::Popup::menu(&pr).id(egui::Id::new("anicraft.filters.presets")).show(|ui| {
|
||||
egui::Popup::menu(&pr).id(egui::Id::unique("anicraft.filters.presets")).show(|ui| {
|
||||
// The built-in presets the menu lists, then your own.
|
||||
let shown: Vec<&(&'static str, String, bool)> = builtin.iter().filter(|b| b.2).collect();
|
||||
if !shown.is_empty() {
|
||||
@@ -1828,7 +1828,7 @@ fn filter_rows(app: &mut App, ui: &mut egui::Ui, current: &[anicraft_engine::doc
|
||||
}
|
||||
});
|
||||
let more = crate::timeline::icon_button(ui, tr!("Filter options: copy, paste, enable, disable, remove"), None, Icon::Ellipsis);
|
||||
egui::Popup::menu(&more).id(egui::Id::new("anicraft.filters.menu")).show(|ui| {
|
||||
egui::Popup::menu(&more).id(egui::Id::unique("anicraft.filters.menu")).show(|ui| {
|
||||
if ui.add_enabled(n > 0, egui::Button::new(tr!("Copy All Filters"))).clicked() {
|
||||
act = Some(FilterAct::Copy(None));
|
||||
}
|
||||
@@ -1889,7 +1889,7 @@ fn filter_rows(app: &mut App, ui: &mut egui::Ui, current: &[anicraft_engine::doc
|
||||
let quality_names = [tr!("Low"), tr!("Medium"), tr!("High")];
|
||||
// Dragging a filter by its grip: which one, and where each header row starts (last frame's,
|
||||
// for the drop: rows don't move while one is dragged).
|
||||
let drag_id = egui::Id::new("anicraft.filters.drag");
|
||||
let drag_id = egui::Id::unique("anicraft.filters.drag");
|
||||
let mut dragging: Option<usize> = ui.data(|d| d.get_temp(drag_id));
|
||||
let last_tops: Vec<f32> = ui.data(|d| d.get_temp(drag_id.with("tops"))).unwrap_or_default();
|
||||
let drop_at = |y: f32| last_tops.iter().take(n).rposition(|t| y >= *t).unwrap_or(0);
|
||||
@@ -2166,7 +2166,7 @@ pub(crate) fn alpha_swatch(ui: &mut egui::Ui, c: &mut Rgba, name: &str) -> bool
|
||||
/// stays transparent.
|
||||
fn ramp_editor(ui: &mut egui::Ui, fname: &str, stops: &mut Vec<anicraft_engine::doc::GradientStop>, pin: Option<f32>, changed: &mut Option<&'static str>) {
|
||||
use anicraft_engine::doc::{GradientStop, MAX_RAMP_STOPS, REST_SNAP, ramp_at};
|
||||
let sel_id = ui.id().with("ramp_stop");
|
||||
let sel_id = ui.scope_id().with("ramp_stop");
|
||||
let mut sel: usize = ui.data(|d| d.get_temp(sel_id)).unwrap_or(0);
|
||||
let is_pinned = |s: &GradientStop| pin.is_some_and(|p| (s.offset - p).abs() < 1e-4);
|
||||
// Where each stop may move (the ramp is in order): between its neighbours, and clear of the
|
||||
@@ -2186,7 +2186,7 @@ fn ramp_editor(ui: &mut egui::Ui, fname: &str, stops: &mut Vec<anicraft_engine::
|
||||
ui.vertical(|ui| {
|
||||
let w = ui.available_width().clamp(80.0, 200.0);
|
||||
let (strip, resp) = ui.allocate_exact_size(vec2(w, 16.0), Sense::click());
|
||||
a11y::control(ui, &resp, WidgetType::Button, &tr!("{filter} gradient: add a colour stop", filter = fname), None);
|
||||
a11y::control(ui, &resp, Role::Button, &tr!("{filter} gradient: add a colour stop", filter = fname), None);
|
||||
let resp = resp.on_hover_text(tr!("Click to add a colour stop"));
|
||||
let p = ui.painter();
|
||||
// A checkerboard under the ramp shows its opacity.
|
||||
@@ -2219,10 +2219,10 @@ fn ramp_editor(ui: &mut egui::Ui, fname: &str, stops: &mut Vec<anicraft_engine::
|
||||
let x = strip.left() + st.offset * strip.width();
|
||||
let hit = Rect::from_center_size(pos2(x, track.center().y), vec2(10.0, 12.0));
|
||||
let pinned = is_pinned(st);
|
||||
let r = ui.interact(hit, ui.id().with(("ramp_marker", i)), if pinned { Sense::click() } else { Sense::click_and_drag() });
|
||||
let r = ui.interact(hit, ui.scope_id().with(("ramp_marker", i)), if pinned { Sense::click() } else { Sense::click_and_drag() });
|
||||
let at = format!("{:.0}", st.offset * 100.0);
|
||||
let label = if pinned { tr!("{filter} colour stop {stop} at {at}% (fixed)", filter = fname, stop = i + 1, at = at) } else { tr!("{filter} colour stop {stop} at {at}%", filter = fname, stop = i + 1, at = at) };
|
||||
a11y::control(ui, &r, WidgetType::Button, &label, Some(i == sel));
|
||||
a11y::control(ui, &r, Role::Button, &label, Some(i == sel));
|
||||
if r.clicked() || r.drag_started() {
|
||||
sel = i;
|
||||
}
|
||||
@@ -3322,7 +3322,7 @@ fn brush_props(app: &mut App, ui: &mut egui::Ui) {
|
||||
fn profile_preview(ui: &mut egui::Ui, profile: Option<&anicraft_engine::doc::WidthProfile>, size: egui::Vec2, color: Color32, name: Option<&str>) -> egui::Response {
|
||||
let (r, resp) = ui.allocate_exact_size(size, if name.is_some() { Sense::click() } else { Sense::hover() });
|
||||
if let Some(name) = name {
|
||||
crate::a11y::control(ui, &resp, egui::WidgetType::Button, name, None);
|
||||
crate::a11y::control(ui, &resp, egui::Role::Button, name, None);
|
||||
}
|
||||
let p = ui.painter();
|
||||
let n = 32;
|
||||
@@ -3359,7 +3359,7 @@ fn profile_picker(ui: &mut egui::Ui, which: ProfileRow, current: Option<&anicraf
|
||||
let mut picked = None;
|
||||
row_prose(ui, tr!("Width"), |ui| {
|
||||
profile_preview(ui, current, vec2(44.0, 12.0), T.text_dim, None);
|
||||
let menu = ui.id().with(which);
|
||||
let menu = ui.scope_id().with(which);
|
||||
egui::ComboBox::from_id_salt(menu).width(crate::theme::fit(ui, 150.0)).selected_text(label).show_ui(ui, |ui| {
|
||||
for pr in ProfilePreset::ALL {
|
||||
let on = preset == Some(pr);
|
||||
@@ -3544,7 +3544,7 @@ mod tests {
|
||||
ctx.run_ui(input, |ui| tools(app, ui, flow)).textures_delta.clear();
|
||||
};
|
||||
draw(&mut app, Vec::new());
|
||||
let rect = ctx.data(|data| data.get_temp::<Rect>(egui::Id::new("test_hand_tool_rect"))).expect("Hand tool drawn");
|
||||
let rect = ctx.data(|data| data.get_temp::<Rect>(egui::Id::unique("test_hand_tool_rect"))).expect("Hand tool drawn");
|
||||
let at = rect.center();
|
||||
let event = |pressed| vec![
|
||||
egui::Event::PointerMoved(at),
|
||||
@@ -3630,7 +3630,7 @@ mod tests {
|
||||
// Get the actual scene control's interaction rectangle.
|
||||
let label_rect = ctx.data(|data| {
|
||||
data.get_temp::<egui::Rect>(
|
||||
egui::Id::new("test_scene_label_rect")
|
||||
egui::Id::unique("test_scene_label_rect")
|
||||
)
|
||||
}).expect("Scene control rectangle should exist");
|
||||
|
||||
@@ -3700,13 +3700,13 @@ mod tests {
|
||||
// Get the actual dropdown arrow's rectangle and widget ID.
|
||||
let arrow_rect = ctx.data(|data| {
|
||||
data.get_temp::<egui::Rect>(
|
||||
egui::Id::new("test_scene_arrow_rect")
|
||||
egui::Id::unique("test_scene_arrow_rect")
|
||||
)
|
||||
}).expect("Scene arrow rectangle should exist");
|
||||
|
||||
let arrow_id = ctx.data(|data| {
|
||||
data.get_temp::<egui::Id>(
|
||||
egui::Id::new("test_scene_arrow_id")
|
||||
egui::Id::unique("test_scene_arrow_id")
|
||||
)
|
||||
}).expect("Scene arrow ID should exist");
|
||||
|
||||
@@ -3785,7 +3785,7 @@ mod tests {
|
||||
}
|
||||
};
|
||||
frames(&ctx, &mut app);
|
||||
let (_, _, lock_rect) = ctx.data(|d| d.get_temp::<(Rect, Rect, Rect)>(egui::Id::new("scale_lock_geometry"))).expect("the Scale row drew");
|
||||
let (_, _, lock_rect) = ctx.data(|d| d.get_temp::<(Rect, Rect, Rect)>(egui::Id::unique("scale_lock_geometry"))).expect("the Scale row drew");
|
||||
// Click the lock: view state only (no document change, no undo step).
|
||||
let at = lock_rect.center();
|
||||
let press = |pressed: bool| Event::PointerButton { pos: at, button: PointerButton::Primary, pressed, modifiers: Modifiers::NONE };
|
||||
|
||||
+6
-6
@@ -12,7 +12,7 @@ use crate::icons::{self, Icon};
|
||||
use crate::menus;
|
||||
use crate::theme::{T, to_color32};
|
||||
use anicraft_engine::doc::{Layer, LayerId, Timeline};
|
||||
use egui::{Pos2, Rect, Sense, Stroke, StrokeKind, WidgetType, pos2, vec2};
|
||||
use egui::{Pos2, Rect, Sense, Stroke, StrokeKind, Role, pos2, vec2};
|
||||
use serde_json::json;
|
||||
|
||||
/// Width of one step of the tree, and the most steps drawn (deeper chains share the last).
|
||||
@@ -56,12 +56,12 @@ pub struct Dot {
|
||||
/// The toggle beside the "Layers" heading: opens and closes the parenting view.
|
||||
pub fn head_toggle(app: &mut App, ui: &mut egui::Ui, painter: &egui::Painter, rect: Rect) {
|
||||
let on = app.prefs.timeline_parenting;
|
||||
let r = ui.interact(rect, ui.id().with("parenting_view"), Sense::click());
|
||||
let r = ui.interact(rect, ui.scope_id().with("parenting_view"), Sense::click());
|
||||
if r.hovered() || on {
|
||||
painter.rect_filled(rect, T.rc(), if on { T.accent_dim } else { T.hover });
|
||||
}
|
||||
icons::paint(painter, Rect::from_center_size(rect.center(), vec2(15.0, 15.0)), Icon::Parent, if on { T.accent_text } else { T.text_dim });
|
||||
a11y::control(ui, &r, WidgetType::Checkbox, tr!("Parenting view"), Some(on));
|
||||
a11y::control(ui, &r, Role::CheckBox, tr!("Parenting view"), Some(on));
|
||||
if r.on_hover_text(tr!("Parenting View: show which layer each layer follows. Drag from a layer's dot to another layer to parent it; click the dot to pick or remove the parent")).clicked() {
|
||||
toggle_view(app);
|
||||
}
|
||||
@@ -93,8 +93,8 @@ pub fn row(app: &mut App, ui: &mut egui::Ui, tl: &Timeline, layer: &Layer, col:
|
||||
}
|
||||
let at = col.dot(tl, layer.id, y);
|
||||
let hit = Rect::from_center_size(at, vec2(size, size));
|
||||
let r = ui.interact(hit, ui.id().with(("parent_dot", layer.id.0)), Sense::click_and_drag());
|
||||
a11y::control(ui, &r, WidgetType::Button, &dot_name(tl, layer), None);
|
||||
let r = ui.interact(hit, ui.scope_id().with(("parent_dot", layer.id.0)), Sense::click_and_drag());
|
||||
a11y::control(ui, &r, Role::Button, &dot_name(tl, layer), None);
|
||||
if r.drag_started_by(egui::PointerButton::Primary) && layer.can_follow() {
|
||||
app.tl_parent_drag = Some(layer.id);
|
||||
}
|
||||
@@ -105,7 +105,7 @@ pub fn row(app: &mut App, ui: &mut egui::Ui, tl: &Timeline, layer: &Layer, col:
|
||||
};
|
||||
let r = r.on_hover_text(tip);
|
||||
let id = layer.id;
|
||||
let shown = egui::Popup::menu(&r).id(egui::Id::new(("layer_parent", id.0))).show(|ui| menu(app, ui, id));
|
||||
let shown = egui::Popup::menu(&r).id(egui::Id::unique(("layer_parent", id.0))).show(|ui| menu(app, ui, id));
|
||||
if let Some(m) = shown {
|
||||
ui.ctx().accesskit_node_builder(m.response.id, |node| {
|
||||
node.set_role(egui::accesskit::Role::Menu);
|
||||
|
||||
@@ -189,7 +189,7 @@ pub fn show(app: &mut App, ctx: &egui::Context) {
|
||||
let (mut go, mut replace, mut close) = (false, false, false);
|
||||
let running = e.running.is_some();
|
||||
let at = ctx.content_rect().center() - egui::vec2(200.0, 180.0);
|
||||
let shown = crate::windows::new(ctx, title.clone()).id(egui::Id::new("plugin_export")).open(&mut open).default_pos(at).default_width(400.0).resizable(false).collapsible(false).show(ctx, |ui| {
|
||||
let shown = crate::windows::new(ctx, title.clone()).id(egui::Id::unique("plugin_export")).open(&mut open).default_pos(at).default_width(400.0).resizable(false).collapsible(false).show(ctx, |ui| {
|
||||
let m = p.manifest();
|
||||
let by = [m.author.as_str(), m.version.as_str()].iter().filter(|s| !s.is_empty()).copied().collect::<Vec<_>>().join(" · ");
|
||||
ui.label(text(Type::Caption, if by.is_empty() { tr!("Plug-in").to_string() } else { tr!("Plug-in · {by}", by = by) }));
|
||||
|
||||
+2
-2
@@ -208,7 +208,7 @@ fn dialog(app: &mut App, ctx: &egui::Context) {
|
||||
let m = p.manifest();
|
||||
let mut changed = false;
|
||||
let (mut ok, mut cancel) = (false, false);
|
||||
let id = egui::Id::new("plugin_dialog");
|
||||
let id = egui::Id::unique("plugin_dialog");
|
||||
// Beside the stage, with no dimming, so the preview stays in view.
|
||||
let area = egui::Modal::default_area(id).anchor(egui::Align2::RIGHT_TOP, [-10.0, 96.0]);
|
||||
egui::Modal::new(id).area(area).backdrop_color(egui::Color32::TRANSPARENT).show(ctx, |ui| {
|
||||
@@ -288,7 +288,7 @@ fn manager(app: &mut App, ctx: &egui::Context) {
|
||||
let mut open = app.show_plugins;
|
||||
let mut action: Option<(&'static str, String)> = None;
|
||||
let title = tr!("Plug-ins");
|
||||
let shown = crate::windows::new(ctx, title).id(egui::Id::new("plugins_window")).open(&mut open).collapsible(false).resizable(false).default_width(560.0).show(ctx, |ui| {
|
||||
let shown = crate::windows::new(ctx, title).id(egui::Id::unique("plugins_window")).open(&mut open).collapsible(false).resizable(false).default_width(560.0).show(ctx, |ui| {
|
||||
let list: Vec<Arc<Plugin>> = app.s.plugins.list().cloned().collect();
|
||||
if list.is_empty() {
|
||||
ui.label(text(Type::Label, tr!("No plug-ins installed yet. Plug-ins are WebAssembly (.wasm) files that add commands (generators, selection effects), export formats and eases.")));
|
||||
|
||||
@@ -287,7 +287,7 @@ fn settings_window(app: &mut App, ctx: &egui::Context) {
|
||||
}
|
||||
let mut open = true;
|
||||
let at = ctx.content_rect().center() - egui::vec2(330.0, 260.0);
|
||||
let shown = crate::windows::new(ctx, tr!("Publish Settings")).id(egui::Id::new("publish_settings")).open(&mut open).default_pos(at).default_width(660.0).resizable(true).collapsible(false).show(ctx, |ui| settings(app, ui));
|
||||
let shown = crate::windows::new(ctx, tr!("Publish Settings")).id(egui::Id::unique("publish_settings")).open(&mut open).default_pos(at).default_width(660.0).resizable(true).collapsible(false).show(ctx, |ui| settings(app, ui));
|
||||
crate::a11y::name_title_bar(&shown, tr!("Publish Settings"));
|
||||
if !open {
|
||||
app.publish.open = false;
|
||||
@@ -317,7 +317,7 @@ fn settings(app: &mut App, ui: &mut egui::Ui) {
|
||||
}
|
||||
let font = crate::theme::font(Type::Body);
|
||||
ui.painter().text(egui::pos2(r.left() + 8.0, r.center().y), egui::Align2::LEFT_CENTER, label(f), font, crate::theme::color(Type::Body));
|
||||
crate::a11y::control(ui, &resp, egui::WidgetType::SelectableLabel, label(f), Some(sel));
|
||||
crate::a11y::control(ui, &resp, egui::Role::Button, label(f), Some(sel));
|
||||
if resp.on_hover_text(about(f)).clicked() {
|
||||
app.publish.selected = f;
|
||||
app.publish.output_edit = None;
|
||||
@@ -695,7 +695,7 @@ fn progress_window(app: &mut App, ctx: &egui::Context) {
|
||||
let mut open = true;
|
||||
let title = if running { tr!("Publishing") } else { tr!("Publish report") };
|
||||
let at = ctx.content_rect().center() - egui::vec2(220.0, 160.0);
|
||||
let shown = crate::windows::new(ctx, title).id(egui::Id::new("publish_progress")).open(&mut open).default_pos(at).default_width(460.0).resizable(true).collapsible(false).show(ctx, |ui| {
|
||||
let shown = crate::windows::new(ctx, title).id(egui::Id::unique("publish_progress")).open(&mut open).default_pos(at).default_width(460.0).resizable(true).collapsible(false).show(ctx, |ui| {
|
||||
if let Some(job) = &app.publish.job {
|
||||
job_rows(ui, job);
|
||||
} else if let Some(r) = &app.publish.report {
|
||||
|
||||
@@ -68,7 +68,7 @@ struct Geometry {
|
||||
|
||||
impl Geometry {
|
||||
fn of(ctx: &egui::Context) -> Geometry {
|
||||
let (inner, lane, last, lo, hi) = ctx.data(|d| d.get_temp::<(Rect, Rect, f32, f32, f32)>(egui::Id::new("me_geometry"))).expect("the Motion Editor drew");
|
||||
let (inner, lane, last, lo, hi) = ctx.data(|d| d.get_temp::<(Rect, Rect, f32, f32, f32)>(egui::Id::unique("me_geometry"))).expect("the Motion Editor drew");
|
||||
Geometry { inner, lane, last, lo, hi }
|
||||
}
|
||||
fn x(&self, f: u32) -> f32 {
|
||||
@@ -198,7 +198,7 @@ fn a_motion_span_drags_whole_and_alt_drag_copies_it() {
|
||||
settle(&ctx, &mut app);
|
||||
let len = spans(&app).first().map(|s| s.1).expect("span");
|
||||
// The active row's cells, as the timeline drew them.
|
||||
let row = ctx.data(|d| d.get_temp::<(Rect, f32, f32, f32)>(egui::Id::new("tl_geometry")));
|
||||
let row = ctx.data(|d| d.get_temp::<(Rect, f32, f32, f32)>(egui::Id::unique("tl_geometry")));
|
||||
let Some((cells, x0, cell_w, scroll)) = row else { panic!("the timeline drew") };
|
||||
let x = |f: u32| x0 + (f as f32 - scroll) * cell_w + cell_w * 0.5;
|
||||
let y = cells.center().y;
|
||||
|
||||
+1
-1
@@ -90,7 +90,7 @@ fn whole(at: f32) -> f32 {
|
||||
pub fn input(app: &mut App, ui: &mut egui::Ui, bars: &Bars, geo: Geo, paused: bool) {
|
||||
for (rect, axis, name, id) in [(bars.top, GuideAxis::Horizontal, tr!("Horizontal ruler"), "ruler_top"), (bars.left, GuideAxis::Vertical, tr!("Vertical ruler"), "ruler_left")] {
|
||||
let Some(rect) = rect else { continue };
|
||||
let resp = ui.interact(rect, ui.id().with(id), Sense::drag()).named(name);
|
||||
let resp = ui.interact(rect, ui.scope_id().with(id), Sense::drag()).named(name);
|
||||
let resp = resp.on_hover_text(tr!("Drag onto the stage to add a guide (View › Guides › Edit Guides adds one by position)"));
|
||||
if resp.hovered() || resp.dragged() {
|
||||
ui.ctx().set_cursor_icon(if axis == GuideAxis::Horizontal { CursorIcon::ResizeRow } else { CursorIcon::ResizeColumn });
|
||||
|
||||
@@ -88,7 +88,7 @@ pub fn window(app: &mut App, ctx: &egui::Context) {
|
||||
Kind::Expand => (tr!("Expand Fill"), "expand_fill"),
|
||||
Kind::Soften => (tr!("Soften Fill Edges"), "soften_fill_edges"),
|
||||
};
|
||||
crate::windows::new(ctx, title).id(egui::Id::new(id)).collapsible(false).resizable(false).anchor(egui::Align2::CENTER_CENTER, [0.0, -80.0]).show(ctx, |ui| {
|
||||
crate::windows::new(ctx, title).id(egui::Id::unique(id)).collapsible(false).resizable(false).anchor(egui::Align2::CENTER_CENTER, [0.0, -80.0]).show(ctx, |ui| {
|
||||
ui.set_min_width(340.0);
|
||||
form_row(ui, FORM_LABEL_DIALOG, tr!("Distance"), |ui| {
|
||||
let tip = match d.kind {
|
||||
|
||||
+3
-3
@@ -457,7 +457,7 @@ pub fn show(app: &mut App, ui: &mut egui::Ui) {
|
||||
&& let Some(p) = pointer
|
||||
{
|
||||
let centre = sel_rect.map_or(canvas.center(), |r| r.center());
|
||||
rotate_cursor(&ui.ctx().layer_painter(egui::LayerId::new(egui::Order::Tooltip, egui::Id::new("stage_cursor"))), p, p - centre);
|
||||
rotate_cursor(&ui.ctx().layer_painter(egui::LayerId::new(egui::Order::Tooltip, egui::Id::unique("stage_cursor"))), p, p - centre);
|
||||
}
|
||||
}
|
||||
if let Some(picker) = picker {
|
||||
@@ -4640,7 +4640,7 @@ pub fn commit_text(app: &mut App) {
|
||||
/// its own colour, size and style (ADR 0085). Esc or a click elsewhere finishes (a click in
|
||||
/// Properties' text styles keeps it open); Enter starts a new line.
|
||||
fn text_editor(app: &mut App, ui: &mut egui::Ui, stage_origin: Pos2, zoom: f32) {
|
||||
let focused_id = egui::Id::new("stage_text_edit_field");
|
||||
let focused_id = egui::Id::unique("stage_text_edit_field");
|
||||
let had_focus = ui.ctx().memory(|m| m.has_focus(focused_id));
|
||||
crate::rich_edit::watch_clipboard(app, ui.ctx(), had_focus);
|
||||
let paper = crate::theme::stage_text_colour(anicraft_engine::doc::Rgba { a: 1.0, ..app.s.doc.stage.background });
|
||||
@@ -4656,7 +4656,7 @@ fn text_editor(app: &mut App, ui: &mut egui::Ui, stage_origin: Pos2, zoom: f32)
|
||||
let width = 260.0f32.max(size * 8.0).max(block_w.unwrap_or(0.0) * zoom + 8.0).min(4000.0);
|
||||
let mut done = false;
|
||||
let (runs, last) = (te.runs.clone(), te.last.clone());
|
||||
egui::Area::new(egui::Id::new("stage_text_edit")).fixed_pos(at).order(egui::Order::Foreground).show(ui.ctx(), |ui| {
|
||||
egui::Area::new(egui::Id::unique("stage_text_edit")).fixed_pos(at).order(egui::Order::Foreground).show(ui.ctx(), |ui| {
|
||||
egui::Frame::new().fill(paper).stroke(Stroke::new(1.0, T.selection)).inner_margin(4.0).show(ui, |ui| {
|
||||
let mut layouter = |ui: &egui::Ui, buf: &dyn egui::TextBuffer, wrap: f32| {
|
||||
let job = crate::rich_edit::layout_job(&runs, &last, buf.as_str(), zoom, wrap);
|
||||
|
||||
+1
-1
@@ -59,7 +59,7 @@ impl StageNav {
|
||||
}
|
||||
|
||||
pub fn node_id(layer: LayerId, element: ElementId) -> Id {
|
||||
Id::new(("stage_element", layer.0, element.0))
|
||||
Id::unique(("stage_element", layer.0, element.0))
|
||||
}
|
||||
|
||||
/// What a path looks like it was drawn with (English, a key): the Rectangle, Oval and PolyStar
|
||||
|
||||
+3
-3
@@ -9,7 +9,7 @@ use crate::a11y::{self, Named};
|
||||
use crate::app::App;
|
||||
use crate::icons::{self, Icon};
|
||||
use crate::theme::{T, TARGET, Type, color, font, text};
|
||||
use egui::{Align2, Rect, Sense, Stroke, StrokeKind, Vec2, WidgetType, pos2, vec2};
|
||||
use egui::{Align2, Rect, Sense, Stroke, StrokeKind, Vec2, Role, pos2, vec2};
|
||||
use serde_json::json;
|
||||
|
||||
/// A New preset: its name (English, translated where drawn), stage width and height.
|
||||
@@ -118,7 +118,7 @@ fn tile(ui: &mut egui::Ui, name: &str, w: u32, h: u32) -> egui::Response {
|
||||
let size = vec2(118.0, 112.0);
|
||||
let (r, resp) = ui.allocate_exact_size(size, Sense::click());
|
||||
let size_text = format!("{w} × {h}");
|
||||
a11y::control(ui, &resp, WidgetType::Button, &tr!("New {name}, {size}", name = name, size = size_text), None);
|
||||
a11y::control(ui, &resp, Role::Button, &tr!("New {name}, {size}", name = name, size = size_text), None);
|
||||
let p = ui.painter();
|
||||
let hot = resp.hovered() || resp.has_focus();
|
||||
p.rect_filled(r, T.rc(), if hot { T.hover } else { T.panel_alt });
|
||||
@@ -216,7 +216,7 @@ fn card(app: &mut App, ui: &mut egui::Ui, ctx: &egui::Context, i: usize, e: &ani
|
||||
ui.set_width(thumb.x);
|
||||
let (r, resp) = ui.allocate_exact_size(thumb, if missing { Sense::hover() } else { Sense::click() });
|
||||
let label = if missing { tr!("{name}, missing", name = name) } else if e.pinned { tr!("Open {name}, pinned", name = name) } else { tr!("Open {name}", name = name) };
|
||||
a11y::control(ui, &resp, WidgetType::Button, &label, None);
|
||||
a11y::control(ui, &resp, Role::Button, &label, None);
|
||||
let hot = !missing && (resp.hovered() || resp.has_focus());
|
||||
let p = ui.painter();
|
||||
p.rect_filled(r, T.rc(), T.panel_alt);
|
||||
|
||||
@@ -14,7 +14,7 @@ use crate::app::App;
|
||||
use crate::icons::{self, Icon};
|
||||
use crate::theme::{T, TARGET, Type, text, to_color32};
|
||||
use anicraft_engine::doc::{ElementKind, Paint, Rgba, SwatchPaint, ramp_at};
|
||||
use egui::{Id, Key, Painter, Rect, Response, Sense, Stroke, StrokeKind, WidgetType, pos2, vec2};
|
||||
use egui::{Id, Key, Painter, Rect, Response, Sense, Stroke, StrokeKind, Role, pos2, vec2};
|
||||
use serde_json::json;
|
||||
|
||||
/// One swatch, in points, and the gap between swatches.
|
||||
@@ -160,7 +160,7 @@ fn bar_button(ui: &mut egui::Ui, tip: &str, icon: Icon, enabled: bool) -> Respon
|
||||
T.icon
|
||||
};
|
||||
icons::paint(ui.painter(), Rect::from_center_size(rect.center(), vec2(16.0, 16.0)), icon, colour);
|
||||
a11y::control(ui, &resp, WidgetType::Button, tip, None);
|
||||
a11y::control(ui, &resp, Role::Button, tip, None);
|
||||
resp.on_hover_text(tip)
|
||||
}
|
||||
|
||||
@@ -195,7 +195,7 @@ pub fn panel(app: &mut App, ui: &mut egui::Ui) {
|
||||
}
|
||||
ui.add_space(6.0);
|
||||
let more = bar_button(ui, tr!("Swatch options: import, export, defaults"), Icon::Ellipsis, true);
|
||||
egui::Popup::menu(&more).id(Id::new("anicraft.swatches.menu")).show(|ui| menu(app, ui));
|
||||
egui::Popup::menu(&more).id(Id::unique("anicraft.swatches.menu")).show(|ui| menu(app, ui));
|
||||
});
|
||||
let caption = if n == 0 { tr!("No swatches. Add the current colour with +, or load the defaults from the menu.") } else { tr!("Click to apply; drag to move; right-click for more.") };
|
||||
ui.label(text(Type::Caption, caption));
|
||||
@@ -248,7 +248,7 @@ fn grid(app: &mut App, ui: &mut egui::Ui) {
|
||||
let size = vec2(cols as f32 * (CELL + GAP) - GAP, rows as f32 * (CELL + GAP) - GAP);
|
||||
let (area, _) = ui.allocate_exact_size(size, Sense::hover());
|
||||
let cell_rect = |i: usize| Rect::from_min_size(pos2(area.left() + (i % cols) as f32 * (CELL + GAP), area.top() + (i / cols) as f32 * (CELL + GAP)), vec2(CELL, CELL));
|
||||
let drag_id = Id::new("anicraft.swatches.drag");
|
||||
let drag_id = Id::unique("anicraft.swatches.drag");
|
||||
let mut dragging: Option<usize> = ui.data(|d| d.get_temp(drag_id));
|
||||
let pointer = ui.ctx().pointer_interact_pos();
|
||||
// Where a dragged swatch would land: the cell under the pointer (the last one past the end).
|
||||
@@ -260,10 +260,10 @@ fn grid(app: &mut App, ui: &mut egui::Ui) {
|
||||
let mut act: Option<Act> = None;
|
||||
for (i, sw) in swatches.iter().enumerate() {
|
||||
let r = cell_rect(i);
|
||||
let resp = ui.interact(r, Id::new(("anicraft.swatch", i)), Sense::click_and_drag());
|
||||
let resp = ui.interact(r, Id::unique(("anicraft.swatch", i)), Sense::click_and_drag());
|
||||
let name = describe(&sw.paint, &sw.name);
|
||||
let selected = app.swatch_sel == Some(i);
|
||||
a11y::control(ui, &resp, WidgetType::Button, &tr!("Swatch {n}: {name}", n = i + 1, name = name.as_str()), Some(selected));
|
||||
a11y::control(ui, &resp, Role::Button, &tr!("Swatch {n}: {name}", n = i + 1, name = name.as_str()), Some(selected));
|
||||
let p = ui.painter();
|
||||
preview(p, r, &sw.paint);
|
||||
let edge = if selected {
|
||||
@@ -377,7 +377,7 @@ fn grid(app: &mut App, ui: &mut egui::Ui) {
|
||||
|
||||
/// The swatch's name, typed in its right-click menu (Enter or leaving the field renames it).
|
||||
fn name_field(app: &mut App, ui: &mut egui::Ui, i: usize, current: &str) {
|
||||
let buf_id = Id::new(("anicraft.swatch.name", i));
|
||||
let buf_id = Id::unique(("anicraft.swatch.name", i));
|
||||
let mut s: String = ui.data(|d| d.get_temp(buf_id)).unwrap_or_else(|| current.to_string());
|
||||
ui.horizontal(|ui| {
|
||||
ui.label(tr!("Name"));
|
||||
@@ -396,12 +396,12 @@ fn name_field(app: &mut App, ui: &mut egui::Ui, i: usize, current: &str) {
|
||||
/// The document's swatches as the colour pickers show them (ADR 0078): the solid colours, and
|
||||
/// the gradients for the fill picker. Put in the context each frame by the app.
|
||||
pub fn publish_to_pickers(ctx: &egui::Context, app: &App) {
|
||||
ctx.data_mut(|d| d.insert_temp(Id::new("anicraft.colour.document"), app.s.doc.swatches.clone()));
|
||||
ctx.data_mut(|d| d.insert_temp(Id::unique("anicraft.colour.document"), app.s.doc.swatches.clone()));
|
||||
}
|
||||
|
||||
/// The document's swatches, for a picker.
|
||||
pub fn for_pickers(ctx: &egui::Context) -> std::sync::Arc<Vec<anicraft_engine::doc::Swatch>> {
|
||||
ctx.data(|d| d.get_temp(Id::new("anicraft.colour.document"))).unwrap_or_default()
|
||||
ctx.data(|d| d.get_temp(Id::unique("anicraft.colour.document"))).unwrap_or_default()
|
||||
}
|
||||
|
||||
/// The fill a gradient swatch makes, as `paint.set_fill` params.
|
||||
|
||||
+5
-5
@@ -19,7 +19,7 @@ use crate::platform;
|
||||
use crate::theme::{self, T, Type, font};
|
||||
use anicraft_engine::Session;
|
||||
use anicraft_engine::doc::{Document, ElementId, LayerId};
|
||||
use egui::{Id, Rect, Sense, Stroke, StrokeKind, WidgetType, pos2, vec2};
|
||||
use egui::{Id, Rect, Sense, Stroke, StrokeKind, Role, pos2, vec2};
|
||||
use serde_json::{Value, json};
|
||||
use std::collections::HashSet;
|
||||
use std::path::{Path, PathBuf};
|
||||
@@ -730,16 +730,16 @@ pub fn bar(app: &mut App, ui: &mut egui::Ui) {
|
||||
if shown.width() <= 0.0 {
|
||||
continue;
|
||||
}
|
||||
let resp = ui.interact(shown, Id::new(("document_tab", t.id)), Sense::click_and_drag());
|
||||
let resp = ui.interact(shown, Id::unique(("document_tab", t.id)), Sense::click_and_drag());
|
||||
let said = spoken(t);
|
||||
resp.widget_info(|| egui::WidgetInfo::selected(WidgetType::SelectableLabel, true, t.active, &said));
|
||||
resp.widget_info(|| egui::WidgetInfo::selected(Role::Button, true, t.active, &said));
|
||||
ui.ctx().accesskit_node_builder(resp.id, |node| {
|
||||
node.set_role(egui::accesskit::Role::Tab);
|
||||
node.set_selected(t.active);
|
||||
});
|
||||
let close_r = Rect::from_center_size(pos2(r.right() - PAD * 0.5 - CLOSE_W * 0.5, r.center().y), vec2(CLOSE_W - 4.0, CLOSE_W - 4.0));
|
||||
let close = ui.interact(close_r.intersect(full), Id::new(("document_tab_close", t.id)), Sense::click());
|
||||
a11y::control(ui, &close, WidgetType::Button, &tr!("Close {name}", name = t.name), None);
|
||||
let close = ui.interact(close_r.intersect(full), Id::unique(("document_tab_close", t.id)), Sense::click());
|
||||
a11y::control(ui, &close, Role::Button, &tr!("Close {name}", name = t.name), None);
|
||||
// The tab: the shown one joins the edit bar below it.
|
||||
let p = ui.painter();
|
||||
if t.active {
|
||||
|
||||
+3
-3
@@ -10,7 +10,7 @@ use crate::icons::{self, Icon};
|
||||
use crate::theme::{FORM_LABEL_DOCK, T, Type, form_row, text};
|
||||
use anicraft_engine::cmds_template::{self, UserTemplate};
|
||||
use anicraft_engine::doc::templates::{TEMPLATES, Template};
|
||||
use egui::{Align2, Rect, Sense, Stroke, StrokeKind, Vec2, WidgetType, pos2, vec2};
|
||||
use egui::{Align2, Rect, Sense, Stroke, StrokeKind, Vec2, Role, pos2, vec2};
|
||||
use serde_json::json;
|
||||
use std::collections::HashMap;
|
||||
use std::path::{Path, PathBuf};
|
||||
@@ -122,7 +122,7 @@ fn tile(ui: &mut egui::Ui, tex: Option<egui::TextureHandle>, name: &str, note: &
|
||||
ui.set_width(THUMB.x);
|
||||
ui.spacing_mut().item_spacing.y = 2.0;
|
||||
let (r, resp) = ui.allocate_exact_size(THUMB, Sense::click());
|
||||
a11y::control(ui, &resp, WidgetType::Button, &tr!("New from template {name}", name = name), None);
|
||||
a11y::control(ui, &resp, Role::Button, &tr!("New from template {name}", name = name), None);
|
||||
let hot = resp.hovered() || resp.has_focus();
|
||||
let p = ui.painter();
|
||||
p.rect_filled(r, T.rc(), T.panel_alt);
|
||||
@@ -240,7 +240,7 @@ pub fn save_window(app: &mut App, ctx: &egui::Context) {
|
||||
d.picture = Some(picture_png(doc).and_then(|png| texture(ctx, "save-preview", &png)));
|
||||
}
|
||||
let (mut submit, mut cancel) = (false, false);
|
||||
crate::windows::new(ctx, tr!("Save as Template")).id(egui::Id::new("save_template")).collapsible(false).resizable(false).anchor(Align2::CENTER_CENTER, [0.0, -60.0]).show(ctx, |ui| {
|
||||
crate::windows::new(ctx, tr!("Save as Template")).id(egui::Id::unique("save_template")).collapsible(false).resizable(false).anchor(Align2::CENTER_CENTER, [0.0, -60.0]).show(ctx, |ui| {
|
||||
ui.set_min_width(420.0);
|
||||
if let Some(Some(tex)) = &d.picture {
|
||||
let s = tex.size_vec2();
|
||||
|
||||
+3
-3
@@ -45,7 +45,7 @@ const MAX_EDGE: f32 = 2048.0;
|
||||
|
||||
/// The movie surface's id: while it has the focus, keys go to the movie.
|
||||
pub fn surface_id() -> egui::Id {
|
||||
egui::Id::new("test_movie_surface")
|
||||
egui::Id::unique("test_movie_surface")
|
||||
}
|
||||
|
||||
/// Whether the movie has the keyboard.
|
||||
@@ -389,7 +389,7 @@ fn inside(app: &mut App, ctx: &egui::Context, why: crate::platform::Inside) -> A
|
||||
let title = title(tm);
|
||||
let note = why.note().map(crate::i18n::t);
|
||||
let win = crate::windows::new(ctx, title.clone())
|
||||
.id(egui::Id::new("test_movie"))
|
||||
.id(egui::Id::unique("test_movie"))
|
||||
.open(&mut shown)
|
||||
.collapsible(false)
|
||||
.resizable(true)
|
||||
@@ -863,7 +863,7 @@ mod tests {
|
||||
for _ in 0..2 {
|
||||
frame(&ctx, &mut app, vec![]);
|
||||
}
|
||||
assert!(ctx.memory(|m| m.area_rect(egui::Id::new("test_movie")).is_some()), "the floating window");
|
||||
assert!(ctx.memory(|m| m.area_rect(egui::Id::unique("test_movie")).is_some()), "the floating window");
|
||||
frame(&ctx, &mut app, vec![ctrl(egui::Key::W)]);
|
||||
assert!(app.test_movie.is_none());
|
||||
}
|
||||
|
||||
+2
-2
@@ -1132,7 +1132,7 @@ pub const FORM_LABEL_DOCK: f32 = 78.0;
|
||||
/// controls' width beside the label is remembered per row, so the choice holds steady while the
|
||||
/// panel is resized; a change of choice redraws the frame at once.
|
||||
pub fn form_row<R>(ui: &mut egui::Ui, label_w: f32, label: &str, add: impl FnOnce(&mut egui::Ui) -> R) -> R {
|
||||
let id = ui.id().with(("form_row", label));
|
||||
let id = ui.scope_id().with(("form_row", label));
|
||||
let avail = ui.available_width();
|
||||
let gap = ui.spacing().item_spacing.x;
|
||||
let need: Option<f32> = ui.data(|d| d.get_temp(id));
|
||||
@@ -1200,7 +1200,7 @@ pub fn section_with_header<R>(ui: &mut egui::Ui, id: &str, style: Section, title
|
||||
ui.data_mut(|d| d.insert_temp(key, open));
|
||||
}
|
||||
let enabled = ui.is_enabled();
|
||||
resp.widget_info(|| egui::WidgetInfo::selected(egui::WidgetType::CollapsingHeader, enabled, open, title));
|
||||
resp.widget_info(|| egui::WidgetInfo::selected(egui::Role::DisclosureTriangle, enabled, open, title));
|
||||
let p = ui.painter();
|
||||
let hot = resp.hovered() || resp.has_focus();
|
||||
match style {
|
||||
|
||||
+35
-35
@@ -6,7 +6,7 @@ use crate::menus;
|
||||
use crate::theme::{SQUARE, T, TARGET, Type, color, font, text, to_color32, with_type};
|
||||
use anicraft_engine::doc::{Layer, LayerId, LayerKind, TweenKind};
|
||||
use crate::a11y::{self, Named};
|
||||
use egui::{Align2, Color32, Rect, Sense, Stroke, StrokeKind, WidgetType, pos2, vec2};
|
||||
use egui::{Align2, Color32, Rect, Sense, Stroke, StrokeKind, Role, pos2, vec2};
|
||||
use serde_json::json;
|
||||
use std::sync::Arc;
|
||||
|
||||
@@ -392,7 +392,7 @@ pub fn icon_button_wide(ui: &mut egui::Ui, tip: &str, on: Option<bool>, icon: Ic
|
||||
};
|
||||
ui.painter().rect_filled(rect, T.rc(), bg);
|
||||
icons::paint(ui.painter(), Rect::from_center_size(rect.center(), vec2(16.0, 16.0)), icon, if active { T.on_active } else if resp.hovered() { T.icon_hot } else { T.icon });
|
||||
a11y::control(ui, &resp, WidgetType::Button, tip, on);
|
||||
a11y::control(ui, &resp, Role::Button, tip, on);
|
||||
resp.on_hover_text(tip)
|
||||
}
|
||||
|
||||
@@ -643,8 +643,8 @@ pub fn show(app: &mut App, ui: &mut egui::Ui) {
|
||||
}
|
||||
}
|
||||
}
|
||||
let rr = ui.interact(r, ui.id().with(("all_layers", salt)), Sense::click());
|
||||
a11y::control(ui, &rr, WidgetType::Button, name, None);
|
||||
let rr = ui.interact(r, ui.scope_id().with(("all_layers", salt)), Sense::click());
|
||||
a11y::control(ui, &rr, Role::Button, name, None);
|
||||
if rr.on_hover_text(name).clicked() {
|
||||
app.run(id, json!({"all": true}));
|
||||
}
|
||||
@@ -673,7 +673,7 @@ pub fn show(app: &mut App, ui: &mut egui::Ui) {
|
||||
gp.line_segment([pos2(cx, ruler.bottom() - 3.0), pos2(cx, ruler.bottom())], Stroke::new(1.0, T.border));
|
||||
}
|
||||
}
|
||||
let ruler_resp = ui.interact(ruler, ui.id().with("ruler"), a11y::pointer_only());
|
||||
let ruler_resp = ui.interact(ruler, ui.scope_id().with("ruler"), a11y::pointer_only());
|
||||
let playhead = f64::from(app.s.frame + 1);
|
||||
ruler_resp.widget_info(|| egui::WidgetInfo::slider(true, playhead, tr!("Playhead (frame ruler)")));
|
||||
if (ruler_resp.clicked() || ruler_resp.dragged())
|
||||
@@ -843,7 +843,7 @@ pub fn show(app: &mut App, ui: &mut egui::Ui) {
|
||||
}
|
||||
// The name is the row's handle too: drag it to move the layer (#407). The camera stays
|
||||
// on top.
|
||||
let nr = ui.interact(name_rect, ui.id().with(("lname", layer.id.0)), if layer.kind == LayerKind::Camera { Sense::click() } else { Sense::click_and_drag() });
|
||||
let nr = ui.interact(name_rect, ui.scope_id().with(("lname", layer.id.0)), if layer.kind == LayerKind::Camera { Sense::click() } else { Sense::click_and_drag() });
|
||||
if nr.drag_started_by(egui::PointerButton::Primary) && layer.kind != LayerKind::Camera {
|
||||
app.tl_layer_drag = Some(layer.id);
|
||||
if app.s.layer != layer.id {
|
||||
@@ -871,7 +871,7 @@ pub fn show(app: &mut App, ui: &mut egui::Ui) {
|
||||
if faded < 100 && !is_camera {
|
||||
painter.text(pos2(name_rect.right() - 2.0, name_rect.center().y), egui::Align2::RIGHT_CENTER, format!("{faded}%"), crate::theme::font(Type::DataSmall), T.text_faint);
|
||||
}
|
||||
a11y::control(ui, &nr, WidgetType::SelectableLabel, &row_name, Some(is_active));
|
||||
a11y::control(ui, &nr, Role::Button, &row_name, Some(is_active));
|
||||
// Ctrl+F6 lands on the active layer, or on the top row shown when it is scrolled away
|
||||
// (rows are drawn top down, so the active row, when drawn, has the last word).
|
||||
if is_active || r == first_row {
|
||||
@@ -885,23 +885,23 @@ pub fn show(app: &mut App, ui: &mut egui::Ui) {
|
||||
}
|
||||
}
|
||||
for (r, id, salt, label, on) in [(eye, "layer.toggle_visible", "eye", tr!("Show {name}", name = name), layer.visible), (lock, "layer.toggle_lock", "lock", tr!("Lock {name}", name = name), layer.locked), (outl, "layer.toggle_outline", "outline", tr!("Outline {name}", name = name), layer.outline)].into_iter().take(if is_camera { 2 } else { 3 }) {
|
||||
let rr = ui.interact(r, ui.id().with((salt, layer.id.0)), Sense::click());
|
||||
a11y::control(ui, &rr, WidgetType::Checkbox, &label, Some(on));
|
||||
let rr = ui.interact(r, ui.scope_id().with((salt, layer.id.0)), Sense::click());
|
||||
a11y::control(ui, &rr, Role::CheckBox, &label, Some(on));
|
||||
let rr = if salt == "outline" { rr.on_hover_text(tr!("View as outlines in the layer's colour (on the stage only)")) } else { rr };
|
||||
if rr.clicked() {
|
||||
app.run(id, json!({"layer": layer.id.0}));
|
||||
}
|
||||
}
|
||||
if let Some(at) = attach_t {
|
||||
let rr = ui.interact(at, ui.id().with(("attach", layer.id.0)), Sense::click());
|
||||
a11y::control(ui, &rr, WidgetType::Checkbox, &tr!("Attach {name} to camera", name = name), Some(layer.attached));
|
||||
let rr = ui.interact(at, ui.scope_id().with(("attach", layer.id.0)), Sense::click());
|
||||
a11y::control(ui, &rr, Role::CheckBox, &tr!("Attach {name} to camera", name = name), Some(layer.attached));
|
||||
if rr.on_hover_text(tr!("Attach Layer to Camera: the layer stays where it is on screen while the camera moves (titles, HUDs)")).clicked() {
|
||||
app.run("layer.set_attached", json!({"layer": layer.id.0}));
|
||||
}
|
||||
}
|
||||
if let Some(ot) = onion_t {
|
||||
let rr = ui.interact(ot, ui.id().with(("onion", layer.id.0)), Sense::click());
|
||||
a11y::control(ui, &rr, WidgetType::Checkbox, &tr!("Onion skin {name}", name = name), Some(layer.onion));
|
||||
let rr = ui.interact(ot, ui.scope_id().with(("onion", layer.id.0)), Sense::click());
|
||||
a11y::control(ui, &rr, Role::CheckBox, &tr!("Onion skin {name}", name = name), Some(layer.onion));
|
||||
if rr.on_hover_text(tr!("Onion skin this layer (Alt-click: this layer only, again: every layer)")).clicked() {
|
||||
let solo = ui.input(|inp| inp.modifiers.alt);
|
||||
if let Some(v) = app.run("layer.set_onion", json!({"layer": layer.id.0, "solo": solo})) {
|
||||
@@ -916,13 +916,13 @@ pub fn show(app: &mut App, ui: &mut egui::Ui) {
|
||||
}
|
||||
// The colour chip on the row's edge: a click opens the layer's colour (ADR 0061).
|
||||
let chip = Rect::from_min_size(left.left_top(), vec2(8.0, rh));
|
||||
let chip_r = ui.interact(chip, ui.id().with(("lcolor", layer.id.0)), Sense::click());
|
||||
a11y::control(ui, &chip_r, WidgetType::Button, &tr!("Colour of {name}", name = name), None);
|
||||
let chip_r = ui.interact(chip, ui.scope_id().with(("lcolor", layer.id.0)), Sense::click());
|
||||
a11y::control(ui, &chip_r, Role::Button, &tr!("Colour of {name}", name = name), None);
|
||||
if chip_r.hovered() {
|
||||
painter.rect_filled(Rect::from_min_size(left.left_top(), vec2(7.0, rh)), 0.0, to_color32(layer.color));
|
||||
}
|
||||
let chip_r = chip_r.on_hover_text(tr!("Layer colour: its outlines and its bar on the timeline"));
|
||||
let menu_id = egui::Id::new(("layer_colour", layer.id.0));
|
||||
let menu_id = egui::Id::unique(("layer_colour", layer.id.0));
|
||||
if app.tl_color_open == Some(layer.id) {
|
||||
app.tl_color_open = None;
|
||||
egui::Popup::open_id(ui.ctx(), menu_id);
|
||||
@@ -935,8 +935,8 @@ pub fn show(app: &mut App, ui: &mut egui::Ui) {
|
||||
});
|
||||
}
|
||||
if let Some(sp) = speaker {
|
||||
let rr = ui.interact(sp, ui.id().with(("mute", layer.id.0)), Sense::click());
|
||||
a11y::control(ui, &rr, WidgetType::Checkbox, &tr!("Mute {name}", name = layer.name), Some(layer.muted));
|
||||
let rr = ui.interact(sp, ui.scope_id().with(("mute", layer.id.0)), Sense::click());
|
||||
a11y::control(ui, &rr, Role::CheckBox, &tr!("Mute {name}", name = layer.name), Some(layer.muted));
|
||||
let tip = if layer.muted { tr!("Unmute this layer's sounds") } else { tr!("Mute this layer's sounds (in playback and every export)") };
|
||||
if rr.on_hover_text(tip).clicked() {
|
||||
app.run("layer.toggle_mute", json!({"layer": layer.id.0}));
|
||||
@@ -959,8 +959,8 @@ pub fn show(app: &mut App, ui: &mut egui::Ui) {
|
||||
}
|
||||
// The folder chevron opens and closes the folder (on top of the name's click target).
|
||||
if is_folder {
|
||||
let cr = ui.interact(chevron, ui.id().with(("fold", layer.id.0)), Sense::click());
|
||||
a11y::control(ui, &cr, WidgetType::CollapsingHeader, &tr!("Open {name}", name = layer.name), Some(open));
|
||||
let cr = ui.interact(chevron, ui.scope_id().with(("fold", layer.id.0)), Sense::click());
|
||||
a11y::control(ui, &cr, Role::DisclosureTriangle, &tr!("Open {name}", name = layer.name), Some(open));
|
||||
if cr.on_hover_text(if open { tr!("Close folder") } else { tr!("Open folder") }).clicked() && !app.tl_collapsed.remove(&layer.id) {
|
||||
app.tl_collapsed.insert(layer.id);
|
||||
}
|
||||
@@ -1059,8 +1059,8 @@ pub fn show(app: &mut App, ui: &mut egui::Ui) {
|
||||
if is_folder {
|
||||
// A folder has no frames: its row is a plain band across the timeline.
|
||||
cp.rect_filled(cells, 0.0, if is_active { T.row_active } else { T.panel_alt });
|
||||
let fr = ui.interact(cells, ui.id().with(("fcells", layer.id.0)), Sense::click() - Sense::FOCUSABLE);
|
||||
a11y::control(ui, &fr, WidgetType::Button, &tr!("{name} folder row", name = layer.name), None);
|
||||
let fr = ui.interact(cells, ui.scope_id().with(("fcells", layer.id.0)), Sense::click() - Sense::FOCUSABLE);
|
||||
a11y::control(ui, &fr, Role::Button, &tr!("{name} folder row", name = layer.name), None);
|
||||
if fr.clicked() && app.s.layer != layer.id {
|
||||
app.run("layer.select", json!({"layer": layer.id.0}));
|
||||
}
|
||||
@@ -1204,12 +1204,12 @@ pub fn show(app: &mut App, ui: &mut egui::Ui) {
|
||||
painter.rect_stroke(bg, T.rc(), Stroke::new(1.0, T.border), StrokeKind::Inside);
|
||||
painter.galley(bg.min + vec2(3.0, 2.0), galley, T.text);
|
||||
}
|
||||
let cr = ui.interact(cells, ui.id().with(("cells", layer.id.0)), a11y::pointer_only());
|
||||
let cr = ui.interact(cells, ui.scope_id().with(("cells", layer.id.0)), a11y::pointer_only());
|
||||
if is_active {
|
||||
// Where the active row's frames are drawn, for tests that point at them.
|
||||
ui.ctx().data_mut(|d| d.insert_temp(egui::Id::new("tl_geometry"), (cells, grid.left() + pad, cell_w, scroll)));
|
||||
ui.ctx().data_mut(|d| d.insert_temp(egui::Id::unique("tl_geometry"), (cells, grid.left() + pad, cell_w, scroll)));
|
||||
}
|
||||
a11y::control(ui, &cr, WidgetType::Button, &tr!("Frames of {name}", name = layer.name), None);
|
||||
a11y::control(ui, &cr, Role::Button, &tr!("Frames of {name}", name = layer.name), None);
|
||||
if is_active {
|
||||
// Its keyframes and spans, one by one, for screen readers (ADR 0064).
|
||||
frame_nodes(app, ui, &cr, layer, x_of, y);
|
||||
@@ -1551,7 +1551,7 @@ pub fn show(app: &mut App, ui: &mut egui::Ui) {
|
||||
// room, as in Animate; a double-click puts it back. Kept in the preferences.
|
||||
{
|
||||
let split = Rect::from_min_max(pos2(grid.left() - 2.0, body.top()), pos2(grid.left() + 3.0, rows_bottom));
|
||||
let sid = ui.id().with("layer_column_split");
|
||||
let sid = ui.scope_id().with("layer_column_split");
|
||||
let sr = ui.interact(split, sid, Sense::click_and_drag());
|
||||
ui.ctx().accesskit_node_builder(sid, |node| {
|
||||
node.set_role(egui::accesskit::Role::Splitter);
|
||||
@@ -1642,7 +1642,7 @@ pub fn show(app: &mut App, ui: &mut egui::Ui) {
|
||||
T.icon
|
||||
};
|
||||
icons::paint(ui.painter(), Rect::from_center_size(r.center(), vec2(16.0, 16.0)), icon, colour);
|
||||
a11y::control(ui, &resp, WidgetType::Button, tip, None);
|
||||
a11y::control(ui, &resp, Role::Button, tip, None);
|
||||
resp.on_hover_text(tip).clicked()
|
||||
};
|
||||
let mut child = ui.new_child(egui::UiBuilder::new().max_rect(footer.shrink2(vec2(6.0, 4.0))).layout(egui::Layout::left_to_right(egui::Align::Center)));
|
||||
@@ -1683,8 +1683,8 @@ pub fn show(app: &mut App, ui: &mut egui::Ui) {
|
||||
let max_s = (content - visible_cols as f32).max(0.0);
|
||||
let t = if max_s > 0.0 { (app.tl_scroll / max_s).clamp(0.0, 1.0) } else { 0.0 };
|
||||
let thumb = Rect::from_min_size(pos2(track.left() + t * travel, track.top()), vec2(thumb_w, track.height()));
|
||||
let sr = ui.interact(bar, ui.id().with("tl_hscroll"), a11y::pointer_only());
|
||||
a11y::control(ui, &sr, WidgetType::ScrollBar, tr!("Scroll the timeline"), None);
|
||||
let sr = ui.interact(bar, ui.scope_id().with("tl_hscroll"), a11y::pointer_only());
|
||||
a11y::control(ui, &sr, Role::ScrollBar, tr!("Scroll the timeline"), None);
|
||||
if sr.dragged() && max_s > 0.0 {
|
||||
app.tl_scroll = (app.tl_scroll + sr.drag_delta().x / travel * max_s).clamp(0.0, max_s);
|
||||
} else if sr.clicked()
|
||||
@@ -1726,7 +1726,7 @@ fn color_menu(app: &mut App, ui: &mut egui::Ui, layer: LayerId, color: anicraft_
|
||||
} else if resp.hovered() {
|
||||
ui.painter().rect_stroke(r, T.rc(), Stroke::new(1.0, T.text_dim), StrokeKind::Outside);
|
||||
}
|
||||
a11y::control(ui, &resp, WidgetType::Button, &tr!("Layer colour {hex}", hex = c.to_hex()), Some(c.to_hex() == color.to_hex()));
|
||||
a11y::control(ui, &resp, Role::Button, &tr!("Layer colour {hex}", hex = c.to_hex()), Some(c.to_hex() == color.to_hex()));
|
||||
if resp.clicked() {
|
||||
app.run("layer.set_color", json!({"layer": layer.0, "color": c.to_hex()}));
|
||||
}
|
||||
@@ -1735,7 +1735,7 @@ fn color_menu(app: &mut App, ui: &mut egui::Ui, layer: LayerId, color: anicraft_
|
||||
ui.separator();
|
||||
// Any other colour: typed as hex, or picked in Layer Properties.
|
||||
ui.horizontal(|ui| {
|
||||
let id = ui.id().with(("layer_hex", layer.0));
|
||||
let id = ui.scope_id().with(("layer_hex", layer.0));
|
||||
let mut hex = ui.data_mut(|d| d.get_temp::<String>(id)).unwrap_or_else(|| color.to_hex());
|
||||
let r = with_type(ui, Type::Data, |ui| ui.add(egui::TextEdit::singleline(&mut hex).desired_width(72.0).char_limit(9))).named(tr!("Layer colour as hex"));
|
||||
if r.changed() {
|
||||
@@ -1758,12 +1758,12 @@ const FRAME_VIEW_MENU: &str = "tl_frame_view";
|
||||
/// The timeline's Frame View menu (ADR 0061), as in Animate: frame widths Tiny to Large (the
|
||||
/// zoom slider beside it sets any width between) and Short rows. View state.
|
||||
fn frame_view_button(app: &mut App, ui: &mut egui::Ui) {
|
||||
let id = egui::Id::new(FRAME_VIEW_MENU);
|
||||
let id = egui::Id::unique(FRAME_VIEW_MENU);
|
||||
let (rect, resp) = ui.allocate_exact_size(vec2(TARGET, TARGET), Sense::click());
|
||||
let hot = resp.hovered() || egui::Popup::is_id_open(ui.ctx(), id);
|
||||
ui.painter().rect_filled(rect, T.rc(), if hot { T.header } else { Color32::TRANSPARENT });
|
||||
icons::paint(ui.painter(), Rect::from_center_size(rect.center(), vec2(16.0, 16.0)), Icon::Layer, if hot { T.icon_hot } else { T.icon });
|
||||
a11y::control(ui, &resp, WidgetType::Button, tr!("Frame view"), None);
|
||||
a11y::control(ui, &resp, Role::Button, tr!("Frame view"), None);
|
||||
let resp = resp.on_hover_text(tr!("Frame view: frame width and row height"));
|
||||
if std::mem::take(&mut app.tl_frame_view_open) {
|
||||
egui::Popup::open_id(ui.ctx(), id);
|
||||
@@ -2421,7 +2421,7 @@ mod tests {
|
||||
app.run("timeline.insert_keyframe", json!({"layer": layer.0, "frame": 3}));
|
||||
app.s.set_frame(0);
|
||||
settle(&ctx, &mut app);
|
||||
let Some((cells, x0, cell_w, scroll)) = ctx.data(|d| d.get_temp::<(egui::Rect, f32, f32, f32)>(egui::Id::new("tl_geometry"))) else { panic!("the timeline drew") };
|
||||
let Some((cells, x0, cell_w, scroll)) = ctx.data(|d| d.get_temp::<(egui::Rect, f32, f32, f32)>(egui::Id::unique("tl_geometry"))) else { panic!("the timeline drew") };
|
||||
let at = |f: u32| pos2(x0 + (f as f32 - scroll) * cell_w + cell_w * 0.5, cells.center().y);
|
||||
let starts = |app: &App| app.s.active_layer().map(|l| l.keyframes.iter().map(|k| k.start).collect::<Vec<_>>()).unwrap_or_default();
|
||||
assert_eq!(starts(&app), vec![0, 3]);
|
||||
@@ -2466,7 +2466,7 @@ mod tests {
|
||||
settle(&ctx, &mut app);
|
||||
assert_eq!(app.s.frame_count(), 8);
|
||||
// Where the active row's frames are drawn, as the timeline drew them.
|
||||
let row = ctx.data(|d| d.get_temp::<(egui::Rect, f32, f32, f32)>(egui::Id::new("tl_geometry")));
|
||||
let row = ctx.data(|d| d.get_temp::<(egui::Rect, f32, f32, f32)>(egui::Id::unique("tl_geometry")));
|
||||
let Some((cells, x0, cell_w, scroll)) = row else { panic!("the timeline drew") };
|
||||
// The ruler sits directly above the cells; the frame's column is its centre.
|
||||
let y = cells.top() - RULER_H / 2.0;
|
||||
|
||||
+1
-1
@@ -64,7 +64,7 @@ pub fn window(app: &mut App, ctx: &egui::Context) {
|
||||
let Some(d) = &mut app.trace else { return };
|
||||
let (mut submit, mut cancel) = (false, false);
|
||||
crate::windows::new(ctx, tr!("Trace Bitmap"))
|
||||
.id(egui::Id::new("trace_bitmap"))
|
||||
.id(egui::Id::unique("trace_bitmap"))
|
||||
.collapsible(false)
|
||||
.resizable(false)
|
||||
.anchor(egui::Align2::CENTER_CENTER, [0.0, -80.0])
|
||||
|
||||
+1
-1
@@ -236,7 +236,7 @@ pub fn window(app: &mut App, ctx: &egui::Context) {
|
||||
};
|
||||
let (mut submit, mut close) = (false, false);
|
||||
let mut open = true;
|
||||
let shown = crate::windows::new(ctx, title).id(egui::Id::new("video_import")).open(&mut open).collapsible(false).resizable(false).anchor(egui::Align2::CENTER_CENTER, [0.0, -60.0]).show(ctx, |ui| {
|
||||
let shown = crate::windows::new(ctx, title).id(egui::Id::unique("video_import")).open(&mut open).collapsible(false).resizable(false).anchor(egui::Align2::CENTER_CENTER, [0.0, -60.0]).show(ctx, |ui| {
|
||||
ui.set_min_width(460.0);
|
||||
ui.set_max_width(520.0);
|
||||
ui.label(text(Type::Body, file_name(&d.path)).strong());
|
||||
|
||||
+2
-2
@@ -5,7 +5,7 @@
|
||||
|
||||
/// Where the area below the menu bar is kept for this frame.
|
||||
fn key() -> egui::Id {
|
||||
egui::Id::new("anicraft_work_area")
|
||||
egui::Id::unique("anicraft_work_area")
|
||||
}
|
||||
|
||||
/// Records the work area: the window's content below the menu bar (`bar_bottom`).
|
||||
@@ -39,7 +39,7 @@ mod tests {
|
||||
let mut out = ctx.run_ui(input, |ui| {
|
||||
let ctx = ui.ctx().clone();
|
||||
set_work_area(&ctx, 24.0);
|
||||
if let Some(r) = new(&ctx, "Custom Ease").id(egui::Id::new("t")).current_pos(at).show(&ctx, |ui| {
|
||||
if let Some(r) = new(&ctx, "Custom Ease").id(egui::Id::unique("t")).current_pos(at).show(&ctx, |ui| {
|
||||
ui.label("graph");
|
||||
}) {
|
||||
shown = r.response.rect;
|
||||
|
||||
@@ -28,7 +28,7 @@ pub fn show(app: &mut App, ctx: &egui::Context) {
|
||||
}
|
||||
let mut open = true;
|
||||
let title = tr!("Manage Workspaces");
|
||||
let shown = crate::windows::new(ctx, title).id(egui::Id::new("manage_workspaces")).open(&mut open).collapsible(false).resizable(false).show(ctx, |ui| {
|
||||
let shown = crate::windows::new(ctx, title).id(egui::Id::unique("manage_workspaces")).open(&mut open).collapsible(false).resizable(false).show(ctx, |ui| {
|
||||
ui.set_min_width(380.0);
|
||||
let current = app.prefs.workspaces.current.clone();
|
||||
for key in app.prefs.workspaces.keys() {
|
||||
|
||||
+2
-2
@@ -59,8 +59,8 @@ fn clear_field(ctx: &egui::Context, app: &mut App) {
|
||||
}
|
||||
|
||||
fn zoom_rects(ctx: &egui::Context) -> (Rect, Rect) {
|
||||
let field = ctx.data(|d| d.get_temp::<Rect>(egui::Id::new("zoom_field"))).expect("the zoom field drew");
|
||||
let arrow = ctx.data(|d| d.get_temp::<Rect>(egui::Id::new("zoom_arrow"))).expect("the zoom arrow drew");
|
||||
let field = ctx.data(|d| d.get_temp::<Rect>(egui::Id::unique("zoom_field"))).expect("the zoom field drew");
|
||||
let arrow = ctx.data(|d| d.get_temp::<Rect>(egui::Id::unique("zoom_arrow"))).expect("the zoom arrow drew");
|
||||
(field, arrow)
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user