fn draw_text_button(&self, ctx: &CanvasRenderingContext2d) -> Result<(), JsValue> {
        ctx.begin_path();
        ctx.set_fill_style(&JsValue::from_str("#222222"));
        ctx.rect(self.rect.x(), self.rect.y(), self.rect.w(), self.rect.h());
        ctx.fill();
        ctx.set_fill_style(&JsValue::from_str("#00ff00"));
        ctx.set_font(&format!("{}px monospace", self.rect.w() * 0.2));
        ctx.fill_text(
            &self.content,
            self.rect.x() + self.rect.w() * 0.07,
            self.rect.y() + self.rect.h() * 0.6,
        )?;
        ctx.close_path();
        Ok(())
    }
/// Draw a button with text content
Draw a button with text content
Draw a button with text content
fn draw_text_button(&self, ctx: &CanvasRenderingContext2d) -> Result<(), JsValue> {
        ctx.begin_path();
        ctx.set_fill_style(&JsValue::from_str("#222222"));
        ctx.rect(self.rect.x(), self.rect.y(), self.rect.w(), self.rect.h());
        ctx.fill();
        ctx.set_fill_style(&JsValue::from_str("#00ff00"));
        ctx.set_font(&format!("{}px monospace", self.rect.w() * 0.2));
        ctx.fill_text(
            &self.content,
            self.rect.x() + self.rect.w() * 0.07,
            self.rect.y() + self.rect.h() * 0.6,
        )?;
        ctx.close_path();
        Ok(())
    }
fn draw_text_button ( & self , ctx : & CanvasRenderingContext2d ) -> Result < ( ) , JsValue > { ctx . begin_path ( ) ; ctx . set_fill_style ( & JsValue :: from_str ( " " ) ) ; ctx . rect ( self . rect . x ( ) , self . rect . y ( ) , self . rect . w ( ) , self . rect . h ( ) ) ; ctx . fill ( ) ; ctx . set_fill_style ( & JsValue :: from_str ( " " ) ) ; ctx . set_font ( & format ! ( " " self rect w ( ) 0.2 ) ) ; ctx . fill_text ( & self . content , self . rect . x ( ) + self . rect . w ( ) * 0.07 , self . rect . y ( ) + self . rect . h ( ) * 0.6 , ) ? ; ctx . close_path ( ) ; Ok ( ( ) ) }
Draw a button with text content
Draw a button with text content
&self
ctx
&CanvasRenderingContext2d
&self
ctx
&CanvasRenderingContext2d