Happy face is white now

This commit is contained in:
Jean-Gabriel Gill-Couture 2023-06-28 23:04:45 -04:00
parent 51666f34fd
commit 56ae0e63b9

View File

@ -1,8 +1,8 @@
use std::f64; use std::f64;
use leptos::html::Canvas; use leptos::html::Canvas;
use leptos::*; use leptos::*;
use wasm_bindgen::JsCast; use wasm_bindgen::JsCast;
use wasm_bindgen::JsValue;
#[component] #[component]
pub fn Background(cx: Scope) -> impl IntoView { pub fn Background(cx: Scope) -> impl IntoView {
@ -19,6 +19,8 @@ pub fn Background(cx: Scope) -> impl IntoView {
.expect("canvas to have context") .expect("canvas to have context")
.unchecked_into::<web_sys::CanvasRenderingContext2d>(); .unchecked_into::<web_sys::CanvasRenderingContext2d>();
log!("context = {:#?}", context); log!("context = {:#?}", context);
context.set_stroke_style(&JsValue::from("white"));
context.set_fill_style(&JsValue::from("white"));
context.begin_path(); context.begin_path();
// Draw the outer circle. // Draw the outer circle.
@ -45,7 +47,7 @@ pub fn Background(cx: Scope) -> impl IntoView {
context.stroke(); context.stroke();
}); });
view! { cx, view! { cx,
<div class="canvas border-solid border-white border-2 fixed h-screen w-screen"> <div class="canvas fixed h-screen w-screen">
<canvas node_ref=canvas></canvas> <canvas node_ref=canvas></canvas>
</div> </div>
} }