From e2a86fec591ff6d12724488f2e34ee7e85992f71 Mon Sep 17 00:00:00 2001 From: rambo-panda Date: Mon, 11 Nov 2024 19:00:09 +0800 Subject: [PATCH] feat: after clearing, the bitmap should be cleared, and the width and height should be reset to the initial values. (#937) --- src/image.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/image.rs b/src/image.rs index 56a3c33e..e0698f6a 100644 --- a/src/image.rs +++ b/src/image.rs @@ -227,6 +227,10 @@ impl Image { let length = data.len(); if length <= 2 { self.src = Some(data); + self.width = -1.0; + self.height = -1.0; + self.bitmap = None; + let onload = this.get_named_property_unchecked::("onload")?; if onload.get_type()? == ValueType::Function { let onload_func: Function<(), ()> = Function::from_unknown(onload)?;