Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
126 changes: 122 additions & 4 deletions src/home/home_screen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@ live_design! {
use crate::home::main_desktop_ui::MainDesktopUI;
use crate::settings::settings_screen::SettingsScreen;

// Defines the total height of the StackNavigationView's header.
// This has to be set in multiple places because of how StackNavigation
// uses an Overlay view internally.
STACK_VIEW_HEADER_HEIGHT = 75

StackNavigationWrapper = {{StackNavigationWrapper}} {
view_stack = <StackNavigation> {}
}
Expand All @@ -34,7 +39,7 @@ live_design! {
border_size: 0.0
shadow_color: #0005
shadow_radius: 15.0
shadow_offset: vec2(1.0, 0.0), //5.0,5.0)
shadow_offset: vec2(1.0, 0.0),
}

<CachedWidget> {
Expand Down Expand Up @@ -153,9 +158,7 @@ live_design! {

<StackNavigationWrapper> {
view_stack = <StackNavigation> {

root_view = {
padding: {top: 40.}
flow: Down
width: Fill, height: Fill

Expand All @@ -169,13 +172,16 @@ live_design! {

home_page = <View> {
width: Fill, height: Fill
// Note: while the other page views have top padding, we do NOT add that here
// because it is added in the `RoomsSideBar`'s `RoundedShadowView` itself.
flow: Down

<RoomsSideBar> {}
}

settings_page = <View> {
width: Fill, height: Fill
padding: {top: 20}

<CachedWidget> {
settings_screen = <SettingsScreen> {}
Expand All @@ -184,6 +190,7 @@ live_design! {

add_room_page = <View> {
width: Fill, height: Fill
padding: {top: 20}

<CachedWidget> {
add_room_screen = <AddRoomScreen> {}
Expand All @@ -210,11 +217,121 @@ live_design! {
main_content_view = <StackNavigationView> {
width: Fill, height: Fill
header = {
// The following shader stuff was copied from `RoundedShadowView`.
// We can't directly use RoundedShadowView here for `header` because it is already
// a special view, the `StackViewHeader`.
clip_x:false,
clip_y:false,

show_bg: true,
draw_bg: {
uniform color_dither: 1.0
uniform gradient_border_horizontal: 0.0;
uniform gradient_fill_horizontal: 0.0;

color: (COLOR_PRIMARY_DARKER)
uniform color_2: vec4(-1.0, -1.0, -1.0, -1.0)

uniform border_radius: 4.0
uniform border_size: 0.0
uniform border_color: #0000
uniform border_color_2: vec4(-1.0, -1.0, -1.0, -1.0)

uniform shadow_color: #0005
uniform shadow_radius: 9.0,
uniform shadow_offset: vec2(1.0, 0.0)

varying rect_size2: vec2,
varying rect_size3: vec2,
varying rect_pos2: vec2,
varying rect_shift: vec2,
varying sdf_rect_pos: vec2,
varying sdf_rect_size: vec2,

fn vertex(self) -> vec4 {
let min_offset = min(self.shadow_offset,vec2(0));
self.rect_size2 = self.rect_size + 2.0*vec2(self.shadow_radius);
self.rect_size3 = self.rect_size2 + abs(self.shadow_offset);
self.rect_pos2 = self.rect_pos - vec2(self.shadow_radius) + min_offset;
self.sdf_rect_size = self.rect_size2 - vec2(self.shadow_radius * 2.0 + self.border_size * 2.0)
self.sdf_rect_pos = -min_offset + vec2(self.border_size + self.shadow_radius);
self.rect_shift = -min_offset;

return self.clip_and_transform_vertex(self.rect_pos2, self.rect_size3)
}

fn pixel(self) -> vec4 {
let sdf = Sdf2d::viewport(self.pos * self.rect_size3)
let dither = Math::random_2d(self.pos.xy) * 0.04 * self.color_dither;

let color_2 = self.color;
if (self.color_2.x > -0.5) {
color_2 = self.color_2;
}

let border_color_2 = self.border_color;
if (self.border_color_2.x > -0.5) {
border_color_2 = self.border_color_2;
}

let gradient_border_dir = self.pos.y + dither;
if (self.gradient_border_horizontal > 0.5) {
gradient_border_dir = self.pos.x + dither;
}

let gradient_fill_dir = self.pos.y + dither;
if (self.gradient_fill_horizontal > 0.5) {
gradient_fill_dir = self.pos.x + dither;
}

sdf.box(
self.sdf_rect_pos.x,
self.sdf_rect_pos.y,
self.sdf_rect_size.x,
self.sdf_rect_size.y,
max(1.0, self.border_radius)
)
if sdf.shape > -1.0{ // try to skip the expensive gauss shadow
let m = self.shadow_radius;
let o = self.shadow_offset + self.rect_shift;
let v = GaussShadow::rounded_box_shadow(vec2(m) + o, self.rect_size2+o, self.pos * (self.rect_size3+vec2(m)), self.shadow_radius*0.5, self.border_radius*2.0);
sdf.clear(self.shadow_color*v)
}

sdf.fill_keep(mix(self.color, color_2, gradient_fill_dir))

if self.border_size > 0.0 {
sdf.stroke(
mix(self.border_color, border_color_2, gradient_border_dir),
self.border_size)
}
return sdf.result
}
}

padding: {top: 30, bottom: 0}
height: (STACK_VIEW_HEADER_HEIGHT),
content = {
height: (STACK_VIEW_HEADER_HEIGHT)
button_container = {
padding: {left: 14}
padding: 0,
margin: 0
left_button = {
draw_bg: {
fn pixel(self) -> vec4 {
return #FFFFFF00;
}
}
width: Fit, height: Fit,
padding: {left: 20, right: 23, top: 10, bottom: 10}
margin: {left: 8, right: 0, top: 0, bottom: 0}
icon_walk: {width: 13, height: Fit}
spacing: 0
text: ""
}
}
title_container = {
padding: {top: 8}
title = {
draw_text: {
color: (ROOM_NAME_TEXT_COLOR)
Expand All @@ -224,6 +341,7 @@ live_design! {
}
}
body = {
margin: {top: (STACK_VIEW_HEADER_HEIGHT)}
main_content = <MainMobileUI> {}
}
}
Expand Down
1 change: 0 additions & 1 deletion src/home/room_read_receipt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,6 @@ impl Widget for AvatarRow {

let should_hover_in = match event.hits(cx, self.area) {
Hit::FingerLongPress(_)
| Hit::FingerHoverOver(..) // TODO: remove once CalloutTooltip bug is fixed
| Hit::FingerHoverIn(..) => true,
Hit::FingerUp(fue) if fue.is_over && fue.is_primary_hit() => true,
Hit::FingerHoverOut(_) => {
Expand Down
1 change: 1 addition & 0 deletions src/home/rooms_list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ live_design! {
auto_tail: false,
width: Fill, height: Fill
flow: Down,
padding: {top: 5}
spacing: 0.0

collapsible_header = <CollapsibleHeader> {}
Expand Down
57 changes: 39 additions & 18 deletions src/home/rooms_sidebar.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ live_design! {
pub RoomsSideBar = {{RoomsSideBar}}<AdaptiveView> {
Desktop = <View> {
padding: {top: 20, left: 10, right: 10}
flow: Down, spacing: 10
flow: Down, spacing: 5
width: Fill, height: Fill

show_bg: true,
Expand Down Expand Up @@ -54,31 +54,52 @@ live_design! {
},

Mobile = <View> {
padding: {top: 17, left: 17, right: 17}
flow: Down, spacing: 7
width: Fill, height: Fill
flow: Down,

<RoundedShadowView> {
width: Fill, height: Fit
padding: {top: 15, left: 15, right: 15, bottom: 10}
flow: Down,

show_bg: true
draw_bg: {
color: (COLOR_PRIMARY_DARKER),
border_radius: 4.0,
border_size: 0.0
shadow_color: #0005
shadow_radius: 15.0
shadow_offset: vec2(1.0, 0.0),
}

<CachedWidget> {
rooms_list_header = <RoomsListHeader> {}
}

<View> {
width: Fill,
height: 39,
flow: Right
padding: {top: 2, bottom: 2}
spacing: 5
align: {y: 0.5}
<View> { height: 20 }

<CachedWidget> {
room_filter_input_bar = <RoomFilterInputBar> {}
rooms_list_header = <RoomsListHeader> {}
}

search_messages_button = <SearchMessagesButton> { }
<View> {
width: Fill,
height: 39,
flow: Right
padding: {top: 2, bottom: 2}
spacing: 5
align: {y: 0.5}

<CachedWidget> {
room_filter_input_bar = <RoomFilterInputBar> {}
}

search_messages_button = <SearchMessagesButton> { }
}
}

<CachedWidget> {
rooms_list = <RoomsList> {}
<View> {
padding: {left: 15, right: 15}

<CachedWidget> {
rooms_list = <RoomsList> {}
}
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/home/space_lobby.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ live_design! {
flow: Right,
align: {y: 0.5}
padding: 5,
margin: {top: 5, bottom: 10}
margin: {top: 10, bottom: 0}
cursor: Hand

show_bg: true
Expand Down
1 change: 0 additions & 1 deletion src/tsp/tsp_sign_indicator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ impl Widget for TspSignIndicator {
let area = self.view.area();
let should_hover_in = match event.hits(cx, area) {
Hit::FingerLongPress(_)
| Hit::FingerHoverOver(..) // TODO: remove once CalloutTooltip bug is fixed
| Hit::FingerHoverIn(..) => true,
// TODO: show user profile and TSP info on click
// Hit::FingerUp(fue) if fue.is_over && fue.is_primary_hit() => {
Expand Down