diff --git a/voxygen/src/hud/chat.rs b/voxygen/src/hud/chat.rs index ab861b1bbf..e9dfb9aa4f 100644 --- a/voxygen/src/hud/chat.rs +++ b/voxygen/src/hud/chat.rs @@ -88,7 +88,6 @@ pub struct Chat<'a> { history_max: usize, chat_size: Vec2, chat_pos: Vec2, - unread_tabs: Vec, scale: Scale, localized_strings: &'a Localization, @@ -105,7 +104,6 @@ impl<'a> Chat<'a> { localized_strings: &'a Localization, chat_size: Vec2, chat_pos: Vec2, - unread_tabs: Vec, scale: Scale, ) -> Self { Self { @@ -123,7 +121,6 @@ impl<'a> Chat<'a> { chat_size, chat_pos, localized_strings, - unread_tabs, scale, } } @@ -201,7 +198,6 @@ pub enum Event { ShowChatTabSettings(usize), ResizeChat(Vec2), MoveChat(Vec2), - UpdateUnread(Vec), DisableForceChat, } @@ -245,7 +241,7 @@ impl<'a> Widget for Chat<'a> { let mut events = Vec::new(); let chat_settings = &self.global_state.settings.chat; - + let force_chat = !(&self.global_state.settings.interface.toggle_chat); let chat_tabs = &chat_settings.chat_tabs; let current_chat_tab = chat_settings.chat_tab_index.and_then(|i| chat_tabs.get(i)); @@ -313,18 +309,6 @@ impl<'a> Widget for Chat<'a> { }) .collect::>(); - let chat_tabs_with_new_content = chat_tabs.iter().map(|tab| { - self.new_messages - .iter() - .any(|new_message| tab.filter.satisfies(new_message, &group_members)) - }); - let mut new_unread: Vec = self - .unread_tabs - .iter() - .zip(chat_tabs_with_new_content) - .map(|(a, b)| a | b) - .collect(); - // Maintain scrolling // if !self.new_messages.is_empty() { for message in self.new_messages.iter() { @@ -342,6 +326,10 @@ impl<'a> Widget for Chat<'a> { } } + if force_chat { + ui.scroll_widget(state.ids.message_box, [0.0, f64::MAX]); + } + // Trigger scroll event queued from previous frame if state.scroll_next { ui.scroll_widget(state.ids.message_box, [0.0, f64::MAX]); @@ -673,15 +661,11 @@ impl<'a> Widget for Chat<'a> { { state.update(|s| s.tabs_last_hover_pulse = Some(self.pulse)); } - let time_since_hover = if chat_settings.chat_tab_fade { - state - .tabs_last_hover_pulse - .map(|t| self.pulse - t) - .filter(|t| t <= &1.5) - } else { - Some(0.0) - }; - if let Some(time_since_hover) = time_since_hover { + if let Some(time_since_hover) = state + .tabs_last_hover_pulse + .map(|t| self.pulse - t) + .filter(|t| t <= &1.5) + { let alpha = 1.0 - (time_since_hover / 1.5).powi(4); let shading = color::rgba(1.0, 0.82, 0.27, (chat_settings.chat_opacity + 0.1) * alpha); @@ -726,8 +710,7 @@ impl<'a> Widget for Chat<'a> { }); } for (i, chat_tab) in chat_tabs.iter().enumerate() { - let is_unread = new_unread[i]; - if Button::image(if chat_settings.chat_tab_index == Some(i) || is_unread { + if Button::image(if chat_settings.chat_tab_index == Some(i) { self.imgs.selection } else { self.imgs.nothing @@ -748,7 +731,7 @@ impl<'a> Widget for Chat<'a> { 0.0, ) .and(|r| { - if is_unread && chat_settings.chat_tab_index != Some(i) { + if chat_settings.chat_tab_index != Some(i) { r.image_color(shading.complement()) } else { r.image_color(shading) @@ -757,7 +740,6 @@ impl<'a> Widget for Chat<'a> { .set(state.ids.chat_tabs[i], ui) .was_clicked() { - new_unread[i] = false; events.push(Event::ChangeChatTab(Some(i))); } @@ -867,7 +849,6 @@ impl<'a> Widget for Chat<'a> { } }) .set(state.ids.draggable_area, ui); - events.push(Event::UpdateUnread(new_unread)); events } } diff --git a/voxygen/src/hud/mod.rs b/voxygen/src/hud/mod.rs index 385e459431..e290fead7f 100755 --- a/voxygen/src/hud/mod.rs +++ b/voxygen/src/hud/mod.rs @@ -1297,7 +1297,6 @@ pub struct Hud { map_drag: Vec2, chat_size: Vec2, chat_pos: Vec2, - unread_tabs: Vec, force_chat: bool, } @@ -1437,7 +1436,6 @@ impl Hud { map_drag: Vec2::zero(), chat_size: Vec2::new(DEFAULT_CHAT_BOX_WIDTH, DEFAULT_CHAT_BOX_HEIGHT), chat_pos: Vec2::new(10.0, 10.0), - unread_tabs: vec![false; global_state.settings.chat.chat_tabs.len()], force_chat: false, } } @@ -3512,7 +3510,6 @@ impl Hud { i18n, self.chat_size, self.chat_pos, - self.unread_tabs.clone(), scale, ) .and_then(self.force_chat_input.take(), |c, input| c.input(input)) @@ -3549,9 +3546,6 @@ impl Hud { chat::Event::MoveChat(pos) => { self.chat_pos = pos; }, - chat::Event::UpdateUnread(unread) => { - self.unread_tabs = unread; - }, chat::Event::DisableForceChat => { self.force_chat = false; }, @@ -3611,16 +3605,6 @@ impl Hud { }, _ => {}, }, - SettingsChange::Chat(chat_change) => match chat_change { - ChatChange::ChatTabInsert(idx, _) => { - self.unread_tabs.insert(*idx, false) - }, - ChatChange::ChatTabRemove(idx) => { - self.unread_tabs.remove(*idx); - }, - ChatChange::ResetChatSettings => self.unread_tabs.truncate(1), - _ => {}, - }, _ => {}, } events.push(Event::SettingsChange(settings_change)); diff --git a/voxygen/src/hud/settings_window/chat.rs b/voxygen/src/hud/settings_window/chat.rs index 2c0ce765a9..d57143d6e9 100644 --- a/voxygen/src/hud/settings_window/chat.rs +++ b/voxygen/src/hud/settings_window/chat.rs @@ -26,8 +26,6 @@ widget_ids! { transp_value, char_name_text, char_name_button, - chat_tab_fade_text, - chat_tab_fade_button, reset_chat_button, //Tabs @@ -215,35 +213,12 @@ impl<'a> Widget for Chat<'a> { ))); } - // "Show character names in chat" toggle button - Text::new("Fade out Chat Tabs") - .down_from(state.ids.char_name_text, 10.0) - .font_size(self.fonts.cyri.scale(14)) - .font_id(self.fonts.cyri.conrod_id) - .color(TEXT_COLOR) - .set(state.ids.chat_tab_fade_text, ui); - - if chat_settings.chat_tab_fade - != ToggleButton::new( - chat_settings.chat_tab_fade, - self.imgs.checkbox, - self.imgs.checkbox_checked, - ) - .w_h(18.0, 18.0) - .right_from(state.ids.chat_tab_fade_text, 10.0) - .hover_images(self.imgs.checkbox_mo, self.imgs.checkbox_checked_mo) - .press_images(self.imgs.checkbox_press, self.imgs.checkbox_checked) - .set(state.ids.chat_tab_fade_button, ui) - { - events.push(Event::ChatChange(ChatTabFade(!chat_settings.chat_tab_fade))); - } - // Reset the chat settings to the default settings if Button::image(self.imgs.button) .w_h(RESET_BUTTONS_WIDTH, RESET_BUTTONS_HEIGHT) .hover_image(self.imgs.button_hover) .press_image(self.imgs.button_press) - .down_from(state.ids.chat_tab_fade_text, 20.0) + .down_from(state.ids.char_name_text, 20.0) .label(&self.localized_strings.get_msg("hud-settings-reset_chat")) .label_font_size(self.fonts.cyri.scale(14)) .label_color(TEXT_COLOR) diff --git a/voxygen/src/session/settings_change.rs b/voxygen/src/session/settings_change.rs index b32035698a..0e7096230a 100644 --- a/voxygen/src/session/settings_change.rs +++ b/voxygen/src/session/settings_change.rs @@ -43,7 +43,6 @@ pub enum Chat { ChatTabInsert(usize, ChatTab), ChatTabMove(usize, usize), //(i, j) move item from position i, and insert into position j ChatTabRemove(usize), - ChatTabFade(bool), ResetChatSettings, } #[derive(Clone)] @@ -352,9 +351,6 @@ impl SettingsChange { settings.chat.chat_tabs.remove(i); } }, - Chat::ChatTabFade(fade) => { - settings.chat.chat_tab_fade = fade; - }, Chat::ResetChatSettings => { settings.chat = ChatSettings::default(); }, diff --git a/voxygen/src/settings/chat.rs b/voxygen/src/settings/chat.rs index b8724ded08..4b0b29ceac 100644 --- a/voxygen/src/settings/chat.rs +++ b/voxygen/src/settings/chat.rs @@ -73,7 +73,6 @@ pub struct ChatSettings { pub chat_character_name: bool, pub chat_tabs: Vec, pub chat_tab_index: Option, - pub chat_tab_fade: bool, pub chat_cmd_prefix: char, } @@ -84,7 +83,6 @@ impl Default for ChatSettings { chat_character_name: true, chat_tabs: vec![ChatTab::default()], chat_tab_index: Some(0), - chat_tab_fade: false, chat_cmd_prefix: '/', } }