pub struct HTMLCanvas { /* private fields */ }Expand description
Per-frame DOM builder: creates/updates cotis-{id} elements and manages clip stacks.
One instance should be created per frame via HTMLCanvas::new and consumed with
HTMLCanvas::finish. Commands that share a render id reuse the same host element.
Implementations§
Source§impl HTMLCanvas
impl HTMLCanvas
Sourcepub fn new() -> Self
pub fn new() -> Self
Starts a new rendering frame (calls JS beginFrame).
§WASM
Requires an initialized HTML root (init_html_root in renderer.js).
Sourcepub fn ensure_command_element(
&mut self,
command_id: u32,
html_type: &str,
extra_style: Option<&str>,
)
pub fn ensure_command_element( &mut self, command_id: u32, html_type: &str, extra_style: Option<&str>, )
Opens or reuses the host element for a render command. Multiple drawables that share the
same command_id accumulate current_element_css_push on one DOM node (cotis-{id}).
Sourcepub fn current_element_css_push(&mut self, value: &str) -> &mut Self
pub fn current_element_css_push(&mut self, value: &str) -> &mut Self
Add CSS properties to the current element. Properties are parsed from CSS syntax. If a property already exists, it will be overwritten. Example: “background-color: red; padding: 10px”
Sourcepub fn set_text_content(&mut self, text: String)
pub fn set_text_content(&mut self, text: String)
Set the text content of the current element (internal use)
Sourcepub fn set_inner_html(&mut self, html: String)
pub fn set_inner_html(&mut self, html: String)
Set innerHTML for the current element (e.g. custom HTML hosts)
Sourcepub fn new_element(&mut self, prefix: &str, html_type: &str) -> &mut Self
pub fn new_element(&mut self, prefix: &str, html_type: &str) -> &mut Self
Create a new child element. This finalizes the current element and starts building a new one.
§Arguments
prefix- A prefix for the element ID (for debugging/identification)html_type- The HTML tag name (e.g., “div”, “button”, “span”)
Trait Implementations§
Auto Trait Implementations§
impl Freeze for HTMLCanvas
impl RefUnwindSafe for HTMLCanvas
impl Send for HTMLCanvas
impl Sync for HTMLCanvas
impl Unpin for HTMLCanvas
impl UnsafeUnpin for HTMLCanvas
impl UnwindSafe for HTMLCanvas
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
Source§impl<H, TailTarget, Source, Idx> Embed<RenderTList<H, TailTarget>, There<Idx>> for Sourcewhere
TailTarget: IsRenderList,
Source: Embed<TailTarget, Idx>,
impl<H, TailTarget, Source, Idx> Embed<RenderTList<H, TailTarget>, There<Idx>> for Sourcewhere
TailTarget: IsRenderList,
Source: Embed<TailTarget, Idx>,
Source§fn embed(self) -> RenderTList<H, TailTarget>
fn embed(self) -> RenderTList<H, TailTarget>
self into Target.