pub(crate) fn new_pane(
        &mut self,
        x: i32,
        y: i32,
        w: u32,
        h: u32,
        html: &str,
        classes: &str,
        css: &str,
    ) -> Result<DivHandle, DivError> {
        let window = web_sys::window().ok_or(DivError::MissingWindow)?;
        let doc = window.document().ok_or(DivError::MissingDocument)?;

        let x = self.pos.0 + x;
        let y = self.pos.1 + y;

        let node: HtmlElement = doc
            .create_element("div")?
            .dyn_into()
            .map_err(|_| DivError::JsCastError)?;
        node.set_class_name(&("div-rs ".to_owned() + classes));
        node.set_inner_html(html);
        node.set_attribute("style", css)?;

        self.root.append_with_node_1(&node.clone().into())?;
        let vnode = Pane {
            node,
            displayed: true,
            x,
            y,
            w,
            h,
        };
        vnode.redraw(self.pos, self.zoom)?;

        let ph = self.nodes.insert(vnode);
        Ok(ph)
    }
/// Creates a new pane from specified html and shows it
Creates a new pane from specified html and shows it
Creates a new pane from specified html and shows it
pub(crate) fn new_pane(
        &mut self,
        x: i32,
        y: i32,
        w: u32,
        h: u32,
        html: &str,
        classes: &str,
        css: &str,
    ) -> Result<DivHandle, DivError> {
        let window = web_sys::window().ok_or(DivError::MissingWindow)?;
        let doc = window.document().ok_or(DivError::MissingDocument)?;
        let x = self.pos.0 + x;
        let y = self.pos.1 + y;
        let node: HtmlElement = doc
            .create_element("div")?
            .dyn_into()
            .map_err(|_| DivError::JsCastError)?;
        node.set_class_name(&("div-rs ".to_owned() + classes));
        node.set_inner_html(html);
        node.set_attribute("style", css)?;
        self.root.append_with_node_1(&node.clone().into())?;
        let vnode = Pane {
            node,
            displayed: true,
            x,
            y,
            w,
            h,
        };
        vnode.redraw(self.pos, self.zoom)?;
        let ph = self.nodes.insert(vnode);
        Ok(ph)
    }
pub ( crate ) fn new_pane ( & mut self , x : i32 , y : i32 , w : u32 , h : u32 , html : & str , classes : & str , css : & str , ) -> Result < DivHandle , DivError > { let window = web_sys :: window ( ) . ok_or ( DivError :: MissingWindow ) ? ; let doc = window . document ( ) . ok_or ( DivError :: MissingDocument ) ? ; let x = self . pos . 0 + x ; let y = self . pos . 1 + y ; let node : HtmlElement = doc . create_element ( " " ) ? . dyn_into ( ) . map_err ( | _ | DivError :: JsCastError ) ? ; node . set_class_name ( & ( " " . to_owned ( ) + classes ) ) ; node . set_inner_html ( html ) ; node . set_attribute ( " " , css ) ? ; self . root . append_with_node_1 ( & node . clone ( ) . into ( ) ) ? ; let vnode = Pane { node , displayed : true , x , y , w , h , } ; vnode . redraw ( self . pos , self . zoom ) ? ; let ph = self . nodes . insert ( vnode ) ; Ok ( ph ) }
Creates a new pane from specified html and shows it
Creates a new pane from specified html and shows it
&mut self
x
i32
y
i32
w
u32
h
u32
html
&str
classes
&str
css
&str
&mut self
x
i32
y
i32
w
u32
h
u32
html
&str
classes
&str
css
&str