fix: flickering
it does still reload the image, but at least it doesn't flicker while doing so this also exposes a problem with the error reporting, since with so many error-reporting operations going on, the errors that do happen are most often immediately cleared.
This commit is contained in:
parent
26268f9771
commit
d9751fe2e6
1 changed files with 7 additions and 3 deletions
|
|
@ -87,9 +87,13 @@ impl State {
|
|||
self.error = result.as_ref().err().map(|e| e.to_string());
|
||||
|
||||
if let Ok((path, handle)) = result {
|
||||
self.images
|
||||
.entry(path)
|
||||
.and_modify(|e| *e = MaybeImage::Loaded(handle));
|
||||
let entry = self.images.entry(path).or_default();
|
||||
|
||||
if matches!(entry, MaybeImage::Loaded(_)) {
|
||||
self.error = Some("tried to load already-loaded image!".into())
|
||||
} else {
|
||||
*entry = MaybeImage::Loaded(handle)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue