pub struct AnimatedScaleState { /* private fields */ }Implementations§
Source§impl AnimatedScaleState
impl AnimatedScaleState
Sourcepub fn presented_scale(&self) -> (f32, f32)
pub fn presented_scale(&self) -> (f32, f32)
供 TransformRenderObject::apply_state downcast 后读当前 scale。
Trait Implementations§
Source§impl State for AnimatedScaleState
impl State for AnimatedScaleState
Source§fn as_any_mut(&mut self) -> &mut dyn Any
fn as_any_mut(&mut self) -> &mut dyn Any
必须显式实现(框架约定)
Source§fn widget(&self) -> &WidgetNode
fn widget(&self) -> &WidgetNode
当前关联的 widget 节点(由框架在 mount/update 时写入)。
Source§fn set_widget(&mut self, widget: WidgetNode)
fn set_widget(&mut self, widget: WidgetNode)
框架在 widget 更新时调用,State 据此 adopt 新配置(保留自身字段)。
Source§fn is_animating(&self) -> bool
fn is_animating(&self) -> bool
ScrollView/ListView 特有:滚动动画中
Source§fn tick_settles_with_repaint(&self) -> bool
fn tick_settles_with_repaint(&self) -> bool
收敛帧(
tick 前 animating=true、tick 后=false)是否需要补一次重画把终值写回 RO。 Read moreSource§fn tick_changes_semantics(&self) -> bool
fn tick_changes_semantics(&self) -> bool
Source§fn apply_to_ro(&mut self, ro: &mut dyn RenderObject) -> StateApply
fn apply_to_ro(&mut self, ro: &mut dyn RenderObject) -> StateApply
P0-1:尝试把当前 state 就地写回已有 RO。 Read more
Source§fn init_state(&mut self)
fn init_state(&mut self)
首次挂载、State 创建后调用一次。
Source§fn did_update_widget(&mut self)
fn did_update_widget(&mut self)
widget 被替换(同类型复用)后调用;默认空实现。
Source§fn build(&self, ctx: &mut BuildContext<'_>) -> Vec<WidgetNode>
fn build(&self, ctx: &mut BuildContext<'_>) -> Vec<WidgetNode>
build 阶段:从 ctx 取主题等,返回子节点列表(默认 widget().children())
Source§fn create_render_object(&self) -> Box<dyn RenderObject>
fn create_render_object(&self) -> Box<dyn RenderObject>
创建 RenderObject —— 默认转发到 widget().create_render_object()
(大多数 State 不需要自己实现,除非需要定制 RenderObject)
Source§fn semantics(&self) -> Option<WidgetSemantics>
fn semantics(&self) -> Option<WidgetSemantics>
State 侧语义覆盖:用于暴露静态 widget 无法提供的动态值
(例如 TextField 的当前文本)。None = 使用
widget.semantics()。Source§fn handle_event(&mut self, event: &WidgetEvent, local_pos: Point)
fn handle_event(&mut self, event: &WidgetEvent, local_pos: Point)
处理指针/键盘/IME 事件(
local_pos 已折算到本 element 坐标系)。Source§fn handle_event_ctx(
&mut self,
event: &WidgetEvent,
local_pos: Point,
_ctx: &mut EventContext,
)
fn handle_event_ctx( &mut self, event: &WidgetEvent, local_pos: Point, _ctx: &mut EventContext, )
带消费语义的事件处理;默认转发
Self::handle_event 并继续冒泡。Source§fn scroll_into_view(&mut self, _target: Rect) -> bool
fn scroll_into_view(&mut self, _target: Rect) -> bool
无障碍 ScrollIntoView:把相对本元素左上角的
target 矩形滚动到可视区。 Read moreSource§fn handle_overlay_key(&mut self, _key: KeyCode, _mods: KeyModifiers) -> bool
fn handle_overlay_key(&mut self, _key: KeyCode, _mods: KeyModifiers) -> bool
覆盖层打开时的键盘导航钩子(方向键 / Home / End / Enter / Space)。 Read more
Source§fn tick_changes_geometry(&self) -> bool
fn tick_changes_geometry(&self) -> bool
Source§fn next_animation_delay(&self, _now_ms: u64) -> Option<u64>
fn next_animation_delay(&self, _now_ms: u64) -> Option<u64>
下一次需要 tick 的延迟(毫秒);None = 无定时任务。 Read more
Source§fn take_needs_build(&mut self) -> bool
fn take_needs_build(&mut self) -> bool
State 请求框架重建本 element 的 children(build + diff,与 update 同路径)。 Read more
Source§fn gesture_state(&self) -> Option<GestureState>
fn gesture_state(&self) -> Option<GestureState>
竞技场仲裁:有持续型手势胜出 → 返回 Accepted 独占指针
Source§fn reject_gestures(&mut self)
fn reject_gestures(&mut self)
被竞争失败:放弃进行中的手势
Source§fn handles_build_error(&self) -> bool
fn handles_build_error(&self) -> bool
是否处理 build panic(ErrorBoundary 用)
Source§fn on_build_error(&mut self, msg: &str)
fn on_build_error(&mut self, msg: &str)
build panic 时回调
Source§fn ime_cursor_area(&self) -> Option<(f32, f32, f32)>
fn ime_cursor_area(&self) -> Option<(f32, f32, f32)>
TextField/TextBox 用:IME 光标区域(x, y, line_height) — 多行感知
Source§fn as_overlay_aware(&mut self) -> Option<&mut dyn OverlayAware>
fn as_overlay_aware(&mut self) -> Option<&mut dyn OverlayAware>
Overlay-aware capability 探测 —— 返回 self 若实现了 OverlayAware trait,否则 None Read more
Auto Trait Implementations§
impl !RefUnwindSafe for AnimatedScaleState
impl !Send for AnimatedScaleState
impl !Sync for AnimatedScaleState
impl !UnwindSafe for AnimatedScaleState
impl Forget for AnimatedScaleState
impl Freeze for AnimatedScaleState
impl Move for AnimatedScaleState
impl Unpin for AnimatedScaleState
impl UnsafeUnpin for AnimatedScaleState
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more