~starkingdoms/starkingdoms

ref: 82104ff3a89cf9aecd1dfc149b17adfa134b596c starkingdoms/client/src/rendering/util.rs -rw-r--r-- 381 bytes
82104ff3TerraMaster85 forgot a file 2 years ago
                                                                                
1
2
3
4
5
6
7
8
use web_sys::HtmlImageElement;
use wasm_bindgen::JsCast;

pub fn texid_to_html_image_unchecked(tex: &str) -> HtmlImageElement {
    let window = web_sys::window().expect("window needs to exist");
    let document = window.document().expect("window.document needs to exist");
    document.get_element_by_id(&format!("tex-{}", tex)).unwrap().dyn_into::<HtmlImageElement>().unwrap()
}