Update egui

This commit is contained in:
Mike Dilger 2023-09-10 10:28:29 +12:00
parent 00821f2639
commit c8a0503f33
7 changed files with 48 additions and 31 deletions

37
Cargo.lock generated
View File

@ -399,12 +399,6 @@ version = "1.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1181e1e0d1fce796a03db1ae795d67167da795f9cf4a39c37589e85ef57f26d3"
[[package]]
name = "atomic_refcell"
version = "0.1.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "79d6dc922a2792b006573f60b2648076355daeae5ce9cb59507e5908c9625d31"
[[package]]
name = "atspi"
version = "0.10.1"
@ -1191,7 +1185,7 @@ dependencies = [
[[package]]
name = "ecolor"
version = "0.22.0"
source = "git+https://github.com/mikedilger/egui?rev=538088439c7c507fe49c730eab84ddd85e147391#538088439c7c507fe49c730eab84ddd85e147391"
source = "git+https://github.com/mikedilger/egui?rev=3a1ed27b4782bfb93afb057acc1a6a85932632b6#3a1ed27b4782bfb93afb057acc1a6a85932632b6"
dependencies = [
"bytemuck",
"serde",
@ -1200,7 +1194,7 @@ dependencies = [
[[package]]
name = "eframe"
version = "0.22.0"
source = "git+https://github.com/mikedilger/egui?rev=538088439c7c507fe49c730eab84ddd85e147391#538088439c7c507fe49c730eab84ddd85e147391"
source = "git+https://github.com/mikedilger/egui?rev=3a1ed27b4782bfb93afb057acc1a6a85932632b6#3a1ed27b4782bfb93afb057acc1a6a85932632b6"
dependencies = [
"bytemuck",
"cocoa",
@ -1215,6 +1209,7 @@ dependencies = [
"js-sys",
"log",
"objc",
"parking_lot",
"percent-encoding",
"raw-window-handle",
"ron",
@ -1231,7 +1226,7 @@ dependencies = [
[[package]]
name = "egui"
version = "0.22.0"
source = "git+https://github.com/mikedilger/egui?rev=538088439c7c507fe49c730eab84ddd85e147391#538088439c7c507fe49c730eab84ddd85e147391"
source = "git+https://github.com/mikedilger/egui?rev=3a1ed27b4782bfb93afb057acc1a6a85932632b6#3a1ed27b4782bfb93afb057acc1a6a85932632b6"
dependencies = [
"accesskit",
"ahash 0.8.3",
@ -1262,16 +1257,16 @@ dependencies = [
[[package]]
name = "egui-winit"
version = "0.22.0"
source = "git+https://github.com/mikedilger/egui?rev=538088439c7c507fe49c730eab84ddd85e147391#538088439c7c507fe49c730eab84ddd85e147391"
source = "git+https://github.com/mikedilger/egui?rev=3a1ed27b4782bfb93afb057acc1a6a85932632b6#3a1ed27b4782bfb93afb057acc1a6a85932632b6"
dependencies = [
"accesskit_winit",
"arboard",
"egui",
"instant",
"log",
"raw-window-handle",
"serde",
"smithay-clipboard",
"web-time",
"webbrowser",
"winit",
]
@ -1279,7 +1274,7 @@ dependencies = [
[[package]]
name = "egui_extras"
version = "0.22.0"
source = "git+https://github.com/mikedilger/egui?rev=538088439c7c507fe49c730eab84ddd85e147391#538088439c7c507fe49c730eab84ddd85e147391"
source = "git+https://github.com/mikedilger/egui?rev=3a1ed27b4782bfb93afb057acc1a6a85932632b6#3a1ed27b4782bfb93afb057acc1a6a85932632b6"
dependencies = [
"egui",
"image",
@ -1292,7 +1287,7 @@ dependencies = [
[[package]]
name = "egui_glow"
version = "0.22.0"
source = "git+https://github.com/mikedilger/egui?rev=538088439c7c507fe49c730eab84ddd85e147391#538088439c7c507fe49c730eab84ddd85e147391"
source = "git+https://github.com/mikedilger/egui?rev=3a1ed27b4782bfb93afb057acc1a6a85932632b6#3a1ed27b4782bfb93afb057acc1a6a85932632b6"
dependencies = [
"bytemuck",
"egui",
@ -1312,7 +1307,7 @@ checksum = "a26ae43d7bcc3b814de94796a5e736d4029efb0ee900c12e2d54c993ad1a1e07"
[[package]]
name = "emath"
version = "0.22.0"
source = "git+https://github.com/mikedilger/egui?rev=538088439c7c507fe49c730eab84ddd85e147391#538088439c7c507fe49c730eab84ddd85e147391"
source = "git+https://github.com/mikedilger/egui?rev=3a1ed27b4782bfb93afb057acc1a6a85932632b6#3a1ed27b4782bfb93afb057acc1a6a85932632b6"
dependencies = [
"bytemuck",
"serde",
@ -1362,11 +1357,10 @@ dependencies = [
[[package]]
name = "epaint"
version = "0.22.0"
source = "git+https://github.com/mikedilger/egui?rev=538088439c7c507fe49c730eab84ddd85e147391#538088439c7c507fe49c730eab84ddd85e147391"
source = "git+https://github.com/mikedilger/egui?rev=3a1ed27b4782bfb93afb057acc1a6a85932632b6#3a1ed27b4782bfb93afb057acc1a6a85932632b6"
dependencies = [
"ab_glyph",
"ahash 0.8.3",
"atomic_refcell",
"bytemuck",
"ecolor",
"emath",
@ -4822,6 +4816,17 @@ dependencies = [
"wasm-bindgen",
]
[[package]]
name = "web-time"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "19353897b48e2c4d849a2d73cb0aeb16dc2be4e00c565abfc11eb65a806e47de"
dependencies = [
"js-sys",
"once_cell",
"wasm-bindgen",
]
[[package]]
name = "webbrowser"
version = "0.8.10"

View File

@ -19,7 +19,7 @@ rustls-tls = [ "reqwest/rustls-tls", "tungstenite/rustls-tls-webpki-roots", "tok
[patch.crates-io]
# override egui crate for egui_video dependency
egui = { git = "https://github.com/mikedilger/egui", rev = "538088439c7c507fe49c730eab84ddd85e147391" }
egui = { git = "https://github.com/mikedilger/egui", rev = "3a1ed27b4782bfb93afb057acc1a6a85932632b6" }
# Use the master branch of SDL2 to include a fix related to clang (and XCode after 14.2)
sdl2 = { git = "https://github.com/Rust-SDL2/rust-sdl2", rev = "27cd1fd67c811e06b9d997a77bb6089a1b65070d" }
@ -29,9 +29,9 @@ async-trait = "0.1"
base64 = "0.21"
dashmap = "5.4"
dirs = "5.0"
eframe = { git = "https://github.com/mikedilger/egui", rev = "538088439c7c507fe49c730eab84ddd85e147391", features = [ "persistence" ] }
egui-winit = { git = "https://github.com/mikedilger/egui", rev = "538088439c7c507fe49c730eab84ddd85e147391", features = [ "default" ] }
egui_extras = { git = "https://github.com/mikedilger/egui", rev = "538088439c7c507fe49c730eab84ddd85e147391", features = [ "image", "svg" ] }
eframe = { git = "https://github.com/mikedilger/egui", rev = "3a1ed27b4782bfb93afb057acc1a6a85932632b6", features = [ "persistence" ] }
egui-winit = { git = "https://github.com/mikedilger/egui", rev = "3a1ed27b4782bfb93afb057acc1a6a85932632b6", features = [ "default" ] }
egui_extras = { git = "https://github.com/mikedilger/egui", rev = "3a1ed27b4782bfb93afb057acc1a6a85932632b6", features = [ "image", "svg" ] }
egui-video = { git = "https://github.com/mikedilger/egui-video", rev = "5a7297138dce16425c7dc7a8eab4d39d79088aba", features = [ "from_bytes" ], optional = true }
encoding_rs = "0.8"
fallible-iterator = "0.2"

View File

@ -474,7 +474,9 @@ impl GossipUi {
let pixels = image_buffer.as_flat_samples();
cctx.egui_ctx.load_texture(
"icon",
ImageData::Color(ColorImage::from_rgba_unmultiplied(size, pixels.as_slice())),
ImageData::Color(
ColorImage::from_rgba_unmultiplied(size, pixels.as_slice()).into(),
),
TextureOptions::default(), // magnification, minification
)
};
@ -487,7 +489,9 @@ impl GossipUi {
let pixels = image_buffer.as_flat_samples();
cctx.egui_ctx.load_texture(
"placeholder_avatar",
ImageData::Color(ColorImage::from_rgba_unmultiplied(size, pixels.as_slice())),
ImageData::Color(
ColorImage::from_rgba_unmultiplied(size, pixels.as_slice()).into(),
),
TextureOptions::default(), // magnification, minification
)
};

View File

@ -179,11 +179,12 @@ impl ThemeDef for ClassicTheme {
striped: true,
window_rounding: Rounding::same(6.0),
resize_corner_size: 12.0,
text_cursor_width: 2.0,
text_cursor: Stroke::new(2.0, Color32::from_rgb(192, 222, 255)),
text_cursor_preview: false,
clip_rect_margin: 3.0, // should be at least half the size of the widest frame stroke + max WidgetVisuals::expansion
button_frame: true,
collapsing_header_frame: false,
interact_cursor: None,
};
} else {
style.visuals = Visuals {
@ -262,11 +263,12 @@ impl ThemeDef for ClassicTheme {
striped: true,
window_rounding: Rounding::same(6.0),
resize_corner_size: 12.0,
text_cursor_width: 2.0,
text_cursor: Stroke::new(2.0, Color32::from_rgb(0, 83, 125)),
text_cursor_preview: false,
clip_rect_margin: 3.0, // should be at least half the size of the widest frame stroke + max WidgetVisuals::expansion
button_frame: true,
collapsing_header_frame: false,
interact_cursor: None,
};
}
style
@ -455,7 +457,7 @@ impl ThemeDef for ClassicTheme {
// feed styling
fn feed_scroll_rounding(_feed: &FeedProperties) -> Rounding {
Rounding::none()
Rounding::ZERO
}
fn feed_scroll_fill(dark_mode: bool, _feed: &FeedProperties) -> Color32 {
if dark_mode {

View File

@ -179,11 +179,12 @@ impl ThemeDef for DefaultTheme {
striped: true,
window_rounding: Rounding::same(6.0),
resize_corner_size: 12.0,
text_cursor_width: 2.0,
text_cursor: Stroke::new(2.0, Color32::from_rgb(192, 222, 255)),
text_cursor_preview: false,
clip_rect_margin: 3.0, // should be at least half the size of the widest frame stroke + max WidgetVisuals::expansion
button_frame: true,
collapsing_header_frame: false,
interact_cursor: None,
};
} else {
style.visuals = Visuals {
@ -262,11 +263,12 @@ impl ThemeDef for DefaultTheme {
striped: true,
window_rounding: Rounding::same(6.0),
resize_corner_size: 12.0,
text_cursor_width: 2.0,
text_cursor: Stroke::new(2.0, Color32::from_rgb(0, 83, 125)),
text_cursor_preview: false,
clip_rect_margin: 3.0, // should be at least half the size of the widest frame stroke + max WidgetVisuals::expansion
button_frame: true,
collapsing_header_frame: false,
interact_cursor: None,
};
}
style
@ -472,7 +474,7 @@ impl ThemeDef for DefaultTheme {
// feed styling
fn feed_scroll_rounding(_feed: &FeedProperties) -> Rounding {
Rounding::none()
Rounding::ZERO
}
fn feed_scroll_fill(_dark_mode: bool, _feed: &FeedProperties) -> Color32 {
Color32::from_rgba_premultiplied(0, 0, 0, 0) // Transparent separator

View File

@ -184,11 +184,12 @@ impl ThemeDef for RoundyTheme {
striped: true,
window_rounding: Rounding::same(6.0),
resize_corner_size: 12.0,
text_cursor_width: 2.0,
text_cursor: Stroke::new(2.0, Color32::from_rgb(192, 222, 255)),
text_cursor_preview: false,
clip_rect_margin: 3.0, // should be at least half the size of the widest frame stroke + max WidgetVisuals::expansion
button_frame: true,
collapsing_header_frame: false,
interact_cursor: None,
};
} else {
// ---- light mode -----------------------------------------------------------------------------------------
@ -268,11 +269,12 @@ impl ThemeDef for RoundyTheme {
striped: true,
window_rounding: Rounding::same(6.0),
resize_corner_size: 12.0,
text_cursor_width: 2.0,
text_cursor: Stroke::new(2.0, Color32::from_rgb(0, 83, 125)),
text_cursor_preview: false,
clip_rect_margin: 3.0, // should be at least half the size of the widest frame stroke + max WidgetVisuals::expansion
button_frame: true,
collapsing_header_frame: false,
interact_cursor: None,
};
}
style
@ -492,7 +494,7 @@ impl ThemeDef for RoundyTheme {
}
fn feed_frame_rounding(post: &NoteRenderData) -> Rounding {
if post.is_thread {
let mut rounding = Rounding::none();
let mut rounding = Rounding::ZERO;
if post.is_first && post.thread_position == 0 {
rounding.nw = 7.0;
rounding.ne = 7.0;

View File

@ -45,6 +45,8 @@ pub(crate) fn paint_frame(ui: &mut Ui, rect: &Rect, fill: Option<Color32>) {
rounding: Rounding::same(5.0),
fill,
stroke: Stroke::NONE,
fill_texture_id: Default::default(),
uv: Rect::ZERO,
});
}