pub struct Canvas2DBuilder {
pub width: Option<f32>,
pub height: Option<f32>,
pub responsive: bool,
pub class_tokens: Vec<String>,
pub style: Option<String>,
pub id: Option<String>,
pub title: Option<String>,
pub __strata_key: Option<String>,
pub on_draw: Option<Rc<dyn Fn(&mut Canvas2DContext)>>,
pub on_paint: Option<Rc<dyn Fn(&mut Canvas2DContext, f32, f32)>>,
pub events: Vec<Attribute>,
pub children: Option<Vec<NodeBlueprint>>,
}Expand description
Builder powering <Canvas2D ... /> in rsx!.
Fields§
§width: Option<f32>§height: Option<f32>§responsive: bool§class_tokens: Vec<String>§style: Option<String>§id: Option<String>§title: Option<String>§__strata_key: Option<String>§on_draw: Option<Rc<dyn Fn(&mut Canvas2DContext)>>§on_paint: Option<Rc<dyn Fn(&mut Canvas2DContext, f32, f32)>>§events: Vec<Attribute>§children: Option<Vec<NodeBlueprint>>Implementations§
Source§impl Canvas2DBuilder
impl Canvas2DBuilder
pub fn width(self, width: impl Into<Option<f32>>) -> Self
pub fn height(self, height: impl Into<Option<f32>>) -> Self
Sourcepub fn responsive(self, responsive: bool) -> Self
pub fn responsive(self, responsive: bool) -> Self
When true, omits inline pixel width/height styles and attributes so CSS/flex classes
(w-full h-full, flex-1, split panes) control the resolved viewport size.
pub fn class(self, class: impl IntoCanvasClass) -> Self
pub fn style(self, style: impl Into<String>) -> Self
pub fn id(self, id: impl Into<String>) -> Self
pub fn title(self, title: impl IntoOptionalString) -> Self
pub fn key(self, key: impl Display) -> Self
pub fn children(self, children: impl IntoChildren<Vec<NodeBlueprint>>) -> Self
pub fn on_draw<M>(self, cb: impl IntoCanvasDrawProp<M>) -> Self
pub fn on_draw_fn(self, cb: impl Fn(&mut Canvas2DContext) + 'static) -> Self
Sourcepub fn on_paint<M>(self, cb: impl IntoCanvasPaintProp<M>) -> Self
pub fn on_paint<M>(self, cb: impl IntoCanvasPaintProp<M>) -> Self
Registers a post-layout paint hook invoked during display-list compilation with the
resolved LayoutNode dimensions (width, height).
pub fn on_paint_fn( self, cb: impl Fn(&mut Canvas2DContext, f32, f32) + 'static, ) -> Self
pub fn onclick<Args>( self, handler: impl EventHandlerMarker<Args> + 'static, ) -> Self
pub fn onclick_fn(self, handler: impl Fn() + 'static) -> Self
pub fn ondblclick<Args>( self, handler: impl EventHandlerMarker<Args> + 'static, ) -> Self
pub fn ondblclick_fn(self, handler: impl Fn(Event) + 'static) -> Self
pub fn onmousedown<Args>( self, handler: impl EventHandlerMarker<Args> + 'static, ) -> Self
pub fn onmousedown_fn(self, handler: impl Fn(Event) + 'static) -> Self
pub fn onmousemove<Args>( self, handler: impl EventHandlerMarker<Args> + 'static, ) -> Self
pub fn onmousemove_fn(self, handler: impl Fn(Event) + 'static) -> Self
pub fn onmouseup<Args>( self, handler: impl EventHandlerMarker<Args> + 'static, ) -> Self
pub fn onmouseup_fn(self, handler: impl Fn(Event) + 'static) -> Self
pub fn onmouseenter<Args>( self, handler: impl EventHandlerMarker<Args> + 'static, ) -> Self
pub fn onmouseenter_fn(self, handler: impl Fn(Event) + 'static) -> Self
pub fn onmouseleave<Args>( self, handler: impl EventHandlerMarker<Args> + 'static, ) -> Self
pub fn onmouseleave_fn(self, handler: impl Fn(Event) + 'static) -> Self
pub fn onwheel<Args>( self, handler: impl EventHandlerMarker<Args> + 'static, ) -> Self
pub fn onwheel_fn(self, handler: impl Fn(Event) + 'static) -> Self
pub fn onpointerdown<Args>( self, handler: impl EventHandlerMarker<Args> + 'static, ) -> Self
pub fn onpointerdown_fn(self, handler: impl Fn(Event) + 'static) -> Self
pub fn onpointermove<Args>( self, handler: impl EventHandlerMarker<Args> + 'static, ) -> Self
pub fn onpointermove_fn(self, handler: impl Fn(Event) + 'static) -> Self
pub fn onpointerup<Args>( self, handler: impl EventHandlerMarker<Args> + 'static, ) -> Self
pub fn onpointerup_fn(self, handler: impl Fn(Event) + 'static) -> Self
pub fn onresize<Args>( self, handler: impl EventHandlerMarker<Args> + 'static, ) -> Self
pub fn onresize_fn(self, handler: impl Fn(Event) + 'static) -> Self
pub fn build(self) -> View
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for Canvas2DBuilder
impl !Send for Canvas2DBuilder
impl !Sync for Canvas2DBuilder
impl !UnwindSafe for Canvas2DBuilder
impl Forget for Canvas2DBuilder
impl Freeze for Canvas2DBuilder
impl Move for Canvas2DBuilder
impl Unpin for Canvas2DBuilder
impl UnsafeUnpin for Canvas2DBuilder
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