View

The View widget represents a UI element that can be rendered on the screen with various properties such as background color, layout, visibility, and more. It handles different events related to user interactions like finger movements and key presses.

“视图”小部件表示一个UI元素,该元素可以用各种属性(如背景色、布局、可见性等)在屏幕上呈现。它处理与用户交互相关的不同事件,如手指移动和按键。

Props

decoratenametypedescription
livedraw_bgDrawColor视图的背景图形颜色。
The background drawing color of the view.
liveshow_bgbool确定是否显示背景。
Determines whether the background is shown.
layoutlayoutLayout定义视图的布局特性。
Defines the layout properties for the view.
walkwalkWalk指定视图的walk属性。
Specifies the walk properties for the view.
livedpi_factorOption<f64>视图的DPI因子。
The DPI factor for the view.
liveoptimizeViewOptimize视图的优化设置。
Optimization settings for the view.
livedebugViewDebugDebug settings for the view.
liveevent_orderEventOrderThe order in which events are processed.
livevisibleboolControls the visibility of the view.
livegrab_key_focusboolIndicates whether the view grabs key focus.
liveblock_signal_eventboolDetermines if signal events are blocked.
livecursorOption<MouseCursor>Specifies the mouse cursor for the view.
livescroll_barsOption<LivePtr>Pointer to the scroll bars, if any.
livedesign_modeboolIndicates if the view is in design mode.
rustfind_cacheHashMap<u64, WidgetSet>Cache for finding widgets.
rustscroll_bars_objOption<Box<ScrollBars>>Scroll bars object, if any.
rustview_sizeOption<DVec2>The size of the view.
rustareaAreaThe area occupied by the view.
rustdraw_listOption<DrawList2d>List of drawing operations for the view.
rusttexture_cacheOption<ViewTextureCache>Cache for view textures.
rustdefer_walksVec<(LiveId, DeferWalk)>Deferred walks for the view.
rustdraw_stateDrawStateWrap<DrawState>State of the drawing operations.
rustchildrenComponentMap<LiveId, WidgetRef>Child components of the view.
rustdraw_orderVec<LiveId>Order in which components are drawn.
animatoranimatorAnimatorAnimator for the view.

Event

namedescription
FingerDown当手指向下触摸视图时触发
Triggered when a finger touches down on the view.
FingerUp当手指从视图中抬起时触发
Triggered when a finger is lifted from the view.
FingerMove当手指在视图上移动时触发
Triggered when a finger moves on the view.
FingerHoverIn当手指悬停在视图上时触发
Triggered when a finger hovers over the view.
FingerHoverOut当手指停止在视图上悬停时触发
Triggered when a finger stops hovering over the view.
KeyDown当视图具有焦点时按下某个键时触发
Triggered when a key is pressed down while the view has focus.
KeyUp当视图具有焦点时释放键时触发
Triggered when a key is released while the view has focus.