diff --git a/runtime/twins/src/bridge.rs b/runtime/twins/src/bridge.rs index c505add7..37606d37 100644 --- a/runtime/twins/src/bridge.rs +++ b/runtime/twins/src/bridge.rs @@ -238,6 +238,11 @@ fn twins( error!("raea-page: a system wrote {property} on {twin}, which is the page's; the page's value stays (docs/blitz-bevy.feature B3 H9)"); conflicts.write(PageConflict { twin, property: property.into(), owner: Owner::Page }); }; + // RAEA_TWIN_SYNC_LIGHT=1 (a trial, off by default): an event's sync spawns and despawns twins and sets their + // hierarchy, but leaves a kept twin's box as it is. Layout hasn't run since the frame's own pass took every box, and + // that pass takes them again after this frame's layout; taking each element's rect on every pointer move was most of + // a 400-clip timeline drag's twin work (docs/timeline.feature TL13a) + let keep_boxes = !BOXES && std::env::var_os("RAEA_TWIN_SYNC_LIGHT").is_some_and(|v| v == "1"); let index = &mut *index; // pages gone: their twins with them index.pages.retain(|page, t| { @@ -278,7 +283,7 @@ fn twins( } el.set_if_neq(el_now); // an event's sync leaves the box to the frame's own pass, which takes it after layout - let at = if BOXES || !light_sync() { rect() } else { *b }; + let at = if keep_boxes { *b } else { rect() }; b.set_if_neq(at); kept = Some(at); } @@ -458,15 +463,6 @@ pub fn sync_twins(world: &mut World) { } } -/// RAEA_TWIN_SYNC_LIGHT=1 (a trial, off by default): an event's sync spawns and despawns twins and sets their -/// hierarchy, but leaves a kept twin's box as it is. Layout hasn't run since the frame's own pass took every box, and -/// that pass takes them again after this frame's layout; taking each element's rect on every pointer move was most of -/// a 400-clip timeline drag's twin work (docs/timeline.feature TL13a). -fn light_sync() -> bool { - static ON: std::sync::LazyLock = std::sync::LazyLock::new(|| std::env::var_os("RAEA_TWIN_SYNC_LIGHT").is_some_and(|v| v == "1")); - *ON -} - pub fn deliver(world: &mut World, page: Entity, fired: Vec) { if fired.is_empty() { return;