Add note wide mode for reposts
This adds a 'wide' note design for note previews. This is a mode where the note contents does not have padding at the start. This makes notes previews a bit nicer. Screenshot: https://cdn.jb55.com/s/84271f386d564c34.png Signed-off-by: William Casarin <jb55@jb55.com>
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
use crate::ui::ProfilePic;
|
||||
use bitflags::bitflags;
|
||||
|
||||
bitflags! {
|
||||
@@ -34,11 +35,30 @@ impl NoteOptions {
|
||||
(self & NoteOptions::medium_pfp) == NoteOptions::medium_pfp
|
||||
}
|
||||
|
||||
pub fn pfp_size(&self) -> f32 {
|
||||
if self.has_small_pfp() {
|
||||
ProfilePic::small_size()
|
||||
} else if self.has_medium_pfp() {
|
||||
ProfilePic::medium_size()
|
||||
} else {
|
||||
ProfilePic::default_size()
|
||||
}
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn has_wide(self) -> bool {
|
||||
(self & NoteOptions::wide) == NoteOptions::wide
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn set_wide(&mut self, enable: bool) {
|
||||
if enable {
|
||||
*self |= NoteOptions::wide;
|
||||
} else {
|
||||
*self &= !NoteOptions::wide;
|
||||
}
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn set_small_pfp(&mut self, enable: bool) {
|
||||
if enable {
|
||||
|
||||
Reference in New Issue
Block a user