Give the post icon some opacity so we can see what is in the post behind it, and move to top if feed reversed

This commit is contained in:
Mike Dilger 2024-03-18 09:35:48 +13:00
parent c43135d2bf
commit 20a6d49d2d

View File

@ -1173,9 +1173,20 @@ impl GossipUi {
// ---- "plus icon" ----
if !self.show_post_area_fn() && self.page.show_post_icon() {
let feed_newest_at_bottom =
GLOBALS.storage.read_setting_feed_newest_at_bottom();
let pos = if feed_newest_at_bottom {
let top_right = ui.ctx().screen_rect().right_top();
top_right
+ Vec2::new(-crate::AVATAR_SIZE_F32 * 2.0, crate::AVATAR_SIZE_F32 * 2.0)
} else {
let bottom_right = ui.ctx().screen_rect().right_bottom();
let pos = bottom_right
+ Vec2::new(-crate::AVATAR_SIZE_F32 * 2.0, -crate::AVATAR_SIZE_F32 * 2.0);
bottom_right
+ Vec2::new(
-crate::AVATAR_SIZE_F32 * 2.0,
-crate::AVATAR_SIZE_F32 * 2.0,
)
};
egui::Area::new(ui.next_auto_id())
.movable(false)
@ -1195,6 +1206,15 @@ impl GossipUi {
} else {
RichText::new("\u{1f513}").size(20.0)
};
let fill_color = {
let fill_color_tuple = self.theme.accent_color().to_tuple();
Color32::from_rgba_premultiplied(
fill_color_tuple.0,
fill_color_tuple.1,
fill_color_tuple.2,
128, // half transparent
)
};
let response = ui.add_sized(
[crate::AVATAR_SIZE_F32, crate::AVATAR_SIZE_F32],
egui::Button::new(
@ -1202,7 +1222,7 @@ impl GossipUi {
)
.stroke(egui::Stroke::NONE)
.rounding(egui::Rounding::same(crate::AVATAR_SIZE_F32))
.fill(self.theme.accent_color()),
.fill(fill_color),
);
if response.clicked() {
self.show_post_area = true;