Optimize timeline visibility
Due to "Recursion detected" bugs in slint, we need to calculate the layout of the timeline in Rust. This is ugly, but works.
This commit is contained in:
12
src/api.rs
12
src/api.rs
@@ -162,6 +162,10 @@ impl Message<GetAssetThumbnail> for Api {
|
||||
msg: GetAssetThumbnail,
|
||||
_ctx: &mut Context<Self, Self::Reply>,
|
||||
) -> Self::Reply {
|
||||
if let Some(thumbnail) = self.thumbnails.get(&msg.id).cloned() {
|
||||
return Ok(thumbnail);
|
||||
}
|
||||
|
||||
let response = self
|
||||
.client
|
||||
.assets()
|
||||
@@ -182,9 +186,13 @@ impl Message<GetAssetThumbnail> for Api {
|
||||
thumbnail.height(),
|
||||
);
|
||||
|
||||
Ok(Arc::new(AssetThumbnail {
|
||||
let thumbnail = Arc::new(AssetThumbnail {
|
||||
id: msg.id,
|
||||
thumbnail: pixel_buffer,
|
||||
}))
|
||||
});
|
||||
|
||||
self.thumbnails.insert(msg.id, Arc::clone(&thumbnail));
|
||||
|
||||
Ok(thumbnail)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user