diff --git a/crates/ui-contract/src/contract/body/hooks.rs b/crates/ui-contract/src/contract/body/hooks.rs index 99ad64759..abaac86cc 100644 --- a/crates/ui-contract/src/contract/body/hooks.rs +++ b/crates/ui-contract/src/contract/body/hooks.rs @@ -84,6 +84,10 @@ impl ShapeHooks for BodyHooks<'_> { comp.props(Internal::new()).theme.clone() } + fn fit_rank(&self, comp: &C) -> Option { + comp.props(Internal::new()).fit_rank + } + fn memory_owner(&self, comp: &C) -> Option { comp.props(Internal::new()).owner } @@ -649,6 +653,12 @@ impl ShapeHooks for BodyHooks<'_> { crate::contract::overlay::note_layer_closed(&cx.core.ctx, cx.core.id, why); } self.write_open(comp, cx); + // A drag held at the body's edge scrolls it, unless a scroller inside it took the step. + if let Some(scroll) = scroll_of(comp.props(Internal::new())) + && let Some(to) = self.edge_step_body(scroll, &cx.core.ctx, self.offset) + { + self.offset = to; + } if self.offset != self.offset_at_read || self.anchor != self.anchor_at_read { match comp.scroll() { Some(mut bind) => { diff --git a/crates/ui-contract/src/contract/run.rs b/crates/ui-contract/src/contract/run.rs index cd8fe1a4e..944b10a59 100644 --- a/crates/ui-contract/src/contract/run.rs +++ b/crates/ui-contract/src/contract/run.rs @@ -515,7 +515,6 @@ pub(crate) trait Erased { fn theme_scope(&self) -> Option; /// The rank by which the component leaves a shrinking row whole. fn fit_rank(&self) -> Option { - // PLAN: `typed.rs` (`Erased for Typed`) and `body/hooks.rs` (`ShapeHooks::fit_rank` reading `ContainerProps::fit_rank`) are not in chrome-w5's Files table; their owner must forward the rank, or no body reports one. None } fn memory_owner(&self) -> Option; diff --git a/crates/ui-contract/src/contract/run/typed.rs b/crates/ui-contract/src/contract/run/typed.rs index 838a651f1..d0021cc05 100644 --- a/crates/ui-contract/src/contract/run/typed.rs +++ b/crates/ui-contract/src/contract/run/typed.rs @@ -214,6 +214,10 @@ impl Erased for Typed<'_, '_, C> { self.hooks.theme_scope(self.comp.get_ref()) } + fn fit_rank(&self) -> Option { + self.hooks.fit_rank(self.comp.get_ref()) + } + fn memory_owner(&self) -> Option { self.hooks.memory_owner(self.comp.get_ref()) } diff --git a/crates/ui-contract/src/contract/tooltip.rs b/crates/ui-contract/src/contract/tooltip.rs index c7f4f37a1..ae24d7208 100644 --- a/crates/ui-contract/src/contract/tooltip.rs +++ b/crates/ui-contract/src/contract/tooltip.rs @@ -222,6 +222,8 @@ struct TipCall<'a> { fn show_tip(call: TipCall<'_>) { let TipCall { ctx, owner, id, env, layer: rect_layer, rect, text, rich, spec, wants_input, pressed, subject } = call; + // The host turned tooltips off: none shows, and one that was showing goes as it does when the pointer leaves. + let wants_input = wants_input && env.tooltips; let state_id = sub(id, "tip_state"); let has_content = text.is_some() || rich.is_some(); // A component with no tooltip content and no timer or fading layer left from before has nothing to advance. diff --git a/crates/ui-contract/src/runtime/cursor.rs b/crates/ui-contract/src/runtime/cursor.rs index 45d98423b..0eaab00c6 100644 --- a/crates/ui-contract/src/runtime/cursor.rs +++ b/crates/ui-contract/src/runtime/cursor.rs @@ -97,8 +97,15 @@ pub(crate) fn image_target(ctx: &Context) -> Option { if !shell.cursor_images(native) { return None; } + // A host that keeps its cursors at their size ignores the interface zoom. + let follows_zoom = crate::runtime::env::Env::of_root(ctx).cursor_follows_zoom; + let scale = match (shell.os == Os::Mac, follows_zoom) { + (_, false) => 1.0, + (true, true) => zoom, + (false, true) => pixels_per_point, + }; Some(ImageTarget { - scale: if shell.os == Os::Mac { zoom } else { pixels_per_point }, + scale, max_side: if shell.os == Os::Linux { MAX_SIDE_LINUX } else { MAX_SIDE }, }) }