Skip to main content

Canvas2DBuilder

Struct Canvas2DBuilder 

Source
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

Source

pub fn width(self, width: impl Into<Option<f32>>) -> Self

Source

pub fn height(self, height: impl Into<Option<f32>>) -> Self

Source

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.

Source

pub fn class(self, class: impl IntoCanvasClass) -> Self

Source

pub fn style(self, style: impl Into<String>) -> Self

Source

pub fn id(self, id: impl Into<String>) -> Self

Source

pub fn title(self, title: impl IntoOptionalString) -> Self

Source

pub fn key(self, key: impl Display) -> Self

Source

pub fn children(self, children: impl IntoChildren<Vec<NodeBlueprint>>) -> Self

Source

pub fn on_draw<M>(self, cb: impl IntoCanvasDrawProp<M>) -> Self

Source

pub fn on_draw_fn(self, cb: impl Fn(&mut Canvas2DContext) + 'static) -> Self

Source

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).

Source

pub fn on_paint_fn( self, cb: impl Fn(&mut Canvas2DContext, f32, f32) + 'static, ) -> Self

Source

pub fn onclick<Args>( self, handler: impl EventHandlerMarker<Args> + 'static, ) -> Self

Source

pub fn onclick_fn(self, handler: impl Fn() + 'static) -> Self

Source

pub fn ondblclick<Args>( self, handler: impl EventHandlerMarker<Args> + 'static, ) -> Self

Source

pub fn ondblclick_fn(self, handler: impl Fn(Event) + 'static) -> Self

Source

pub fn oncontextmenu<Args>( self, handler: impl EventHandlerMarker<Args> + 'static, ) -> Self

Source

pub fn oncontextmenu_fn(self, handler: impl Fn(Event) + 'static) -> Self

Source

pub fn onmousedown<Args>( self, handler: impl EventHandlerMarker<Args> + 'static, ) -> Self

Source

pub fn onmousedown_fn(self, handler: impl Fn(Event) + 'static) -> Self

Source

pub fn onmousemove<Args>( self, handler: impl EventHandlerMarker<Args> + 'static, ) -> Self

Source

pub fn onmousemove_fn(self, handler: impl Fn(Event) + 'static) -> Self

Source

pub fn onmouseup<Args>( self, handler: impl EventHandlerMarker<Args> + 'static, ) -> Self

Source

pub fn onmouseup_fn(self, handler: impl Fn(Event) + 'static) -> Self

Source

pub fn onmouseenter<Args>( self, handler: impl EventHandlerMarker<Args> + 'static, ) -> Self

Source

pub fn onmouseenter_fn(self, handler: impl Fn(Event) + 'static) -> Self

Source

pub fn onmouseleave<Args>( self, handler: impl EventHandlerMarker<Args> + 'static, ) -> Self

Source

pub fn onmouseleave_fn(self, handler: impl Fn(Event) + 'static) -> Self

Source

pub fn onwheel<Args>( self, handler: impl EventHandlerMarker<Args> + 'static, ) -> Self

Source

pub fn onwheel_fn(self, handler: impl Fn(Event) + 'static) -> Self

Source

pub fn onpointerdown<Args>( self, handler: impl EventHandlerMarker<Args> + 'static, ) -> Self

Source

pub fn onpointerdown_fn(self, handler: impl Fn(Event) + 'static) -> Self

Source

pub fn onpointermove<Args>( self, handler: impl EventHandlerMarker<Args> + 'static, ) -> Self

Source

pub fn onpointermove_fn(self, handler: impl Fn(Event) + 'static) -> Self

Source

pub fn onpointerup<Args>( self, handler: impl EventHandlerMarker<Args> + 'static, ) -> Self

Source

pub fn onpointerup_fn(self, handler: impl Fn(Event) + 'static) -> Self

Source

pub fn onresize<Args>( self, handler: impl EventHandlerMarker<Args> + 'static, ) -> Self

Source

pub fn onresize_fn(self, handler: impl Fn(Event) + 'static) -> Self

Source

pub fn build(self) -> View

Trait Implementations§

Source§

impl Default for Canvas2DBuilder

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> Downcast<T> for T

Source§

fn downcast(&self) -> &T

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoInitialState<T> for T

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> Upcast<T> for T

Source§

fn upcast(&self) -> Option<&T>