introduce View and Previews traits
In this commit we refactor the preview mechanism, and switch to responsive views by default. To create a preview, your view now has to implement the Preview trait. This is very similar to SwiftUI's preview mechanism. Signed-off-by: William Casarin <jb55@jb55.com>
This commit is contained in:
@@ -6,6 +6,7 @@ use crate::imgcache::ImageCache;
|
||||
use crate::notecache::NoteCache;
|
||||
use crate::timeline;
|
||||
use crate::ui;
|
||||
use crate::ui::is_mobile;
|
||||
use crate::Result;
|
||||
use egui::containers::scroll_area::ScrollBarVisibility;
|
||||
|
||||
@@ -87,12 +88,6 @@ pub struct Damus {
|
||||
frame_history: crate::frame_history::FrameHistory,
|
||||
}
|
||||
|
||||
pub fn is_mobile(ctx: &egui::Context) -> bool {
|
||||
//true
|
||||
let screen_size = ctx.screen_rect().size();
|
||||
screen_size.x < 550.0
|
||||
}
|
||||
|
||||
fn relay_setup(pool: &mut RelayPool, ctx: &egui::Context) {
|
||||
let ctx = ctx.clone();
|
||||
let wakeup = move || {
|
||||
|
||||
Reference in New Issue
Block a user