mirror of
https://github.com/storytold/craft-libs.git
synced 2026-11-17 00:34:25 +00:00
Component::BINDS_VIEW: a binding that is the component's view takes the wheel without focus; TimelineView and the navigator preview set it
This commit is contained in:
@@ -445,6 +445,7 @@ impl Component for TimelineView<'_> {
|
||||
const KEYS: KeyUse = KeyUse::SPLITTER;
|
||||
const OVERLAYS: bool = false;
|
||||
const SINGLE_VALUE: bool = true;
|
||||
const BINDS_VIEW: bool = true;
|
||||
type Style = TimelineViewStyle;
|
||||
type Output = TimelineViewOutput;
|
||||
|
||||
|
||||
@@ -286,6 +286,7 @@ impl Component for Navigator<'_> {
|
||||
const ROLE: Role = Role::GROUP;
|
||||
const OVERLAYS: bool = false;
|
||||
const KEYS: KeyUse = KeyUse::of(Input::Pointer).with_keep(KeepKeys::BlockArrows).with_activate(ActivateKeys::Neither);
|
||||
const BINDS_VIEW: bool = true;
|
||||
type Style = NavigatorStyle;
|
||||
type Output = NavigatorOutput;
|
||||
|
||||
|
||||
@@ -321,6 +321,10 @@ pub trait Component: Meta + Sized {
|
||||
/// Two sources: a canvas control (`#[component(canvas_control)]`) is single-value by kind, since it edits one
|
||||
/// layer's geometry; any other component declares it here.
|
||||
const SINGLE_VALUE: bool = false;
|
||||
/// Whether the binding is the component's view of what it shows (a time area's scroll and zoom, a navigator's
|
||||
/// canvas view), not a value the user edits. The wheel moves a view without focus, as it scrolls a scroll
|
||||
/// region; a bound value control takes it only while focused or armed.
|
||||
const BINDS_VIEW: bool = false;
|
||||
|
||||
/// The style type.
|
||||
type Style: ComponentStyle;
|
||||
|
||||
@@ -398,6 +398,7 @@ pub(crate) struct TypeFacts {
|
||||
pub stops: bool,
|
||||
pub canvas_control: bool,
|
||||
pub labelled_after: bool,
|
||||
pub binds_view: bool,
|
||||
/// The style key's type, which `Auto` ids are counted per.
|
||||
pub style_key: TypeId,
|
||||
}
|
||||
@@ -414,6 +415,7 @@ impl TypeFacts {
|
||||
stops: C::STOPS,
|
||||
canvas_control: C::CANVAS_CONTROL,
|
||||
labelled_after: C::LABELLED_AFTER,
|
||||
binds_view: C::BINDS_VIEW,
|
||||
style_key: TypeId::of::<C::StyleKey>(),
|
||||
}
|
||||
}
|
||||
@@ -842,7 +844,7 @@ fn run_in_host(p: &mut Pass<'_, '_, '_>, ui: &mut Ui, host_at: Option<ShowAt>, h
|
||||
// A body's wheel share is its scroll taker (body step, step 7); the gate value does not take the wheel. A body root that
|
||||
// senses the wheel itself (a canvas) registers like any other component.
|
||||
if !inert && (e.shape() != ShapeKind::Body || own.intersects(Sense::WHEEL | Sense::WHEEL_X)) {
|
||||
steps::register_wheel(&ctx, id, rect, own, e.bound().0, env.wheel);
|
||||
steps::register_wheel(&ctx, id, rect, own, e.bound().0 && !facts.binds_view, env.wheel);
|
||||
}
|
||||
// 8 sense
|
||||
p.trace.mark(Step::Sense);
|
||||
|
||||
Reference in New Issue
Block a user