Fullscreen MediaViewer refactor
- Moved media related logic into notedeck instead of the ui crate, since they pertain to Images/ImageCache based systems - Made RenderableMedia owned to make it less of a nightmware to work with and the perf should be negligible - Added a ImageMetadata cache to Images. This is referenced whenever we encounter an image so we don't have to redo the work all of the time - Relpaced our ad-hoc, hand(vibe?)-coded panning and zoom logic with the Scene widget, which is explicitly designed for this use case - Extracted and detangle fullscreen media rendering from inside of note rendering. We instead let the application decide what action they want to perform when note media is clicked on. - We add an on_view_media action to MediaAction for the application to handle. The Columns app uses this toggle a FullscreenMedia app option bits whenever we get a MediaAction::ViewMedis(urls). Signed-off-by: William Casarin <jb55@jb55.com>
This commit is contained in:
@@ -113,7 +113,7 @@ pub fn banner(ui: &mut egui::Ui, banner_url: Option<&str>, height: f32) -> egui:
|
||||
banner_url
|
||||
.and_then(|url| banner_texture(ui, url))
|
||||
.map(|texture| {
|
||||
crate::images::aspect_fill(
|
||||
notedeck::media::images::aspect_fill(
|
||||
ui,
|
||||
egui::Sense::hover(),
|
||||
texture.id,
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
use crate::gif::{handle_repaint, retrieve_latest_texture};
|
||||
use crate::images::{fetch_no_pfp_promise, get_render_state, ImageType};
|
||||
use egui::{vec2, InnerResponse, Sense, Stroke, TextureHandle};
|
||||
|
||||
use notedeck::note::MediaAction;
|
||||
use notedeck::get_render_state;
|
||||
use notedeck::media::gif::ensure_latest_texture;
|
||||
use notedeck::media::images::{fetch_no_pfp_promise, ImageType};
|
||||
use notedeck::MediaAction;
|
||||
use notedeck::{show_one_error_message, supported_mime_hosted_at_url, Images};
|
||||
|
||||
pub struct ProfilePic<'cache, 'url> {
|
||||
@@ -140,12 +141,9 @@ fn render_pfp(
|
||||
)
|
||||
}
|
||||
notedeck::TextureState::Loaded(textured_image) => {
|
||||
let texture_handle = handle_repaint(
|
||||
ui,
|
||||
retrieve_latest_texture(url, cur_state.gifs, textured_image),
|
||||
);
|
||||
let texture_handle = ensure_latest_texture(ui, url, cur_state.gifs, textured_image);
|
||||
|
||||
egui::InnerResponse::new(None, pfp_image(ui, texture_handle, ui_size, border, sense))
|
||||
egui::InnerResponse::new(None, pfp_image(ui, &texture_handle, ui_size, border, sense))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user