mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Fixed loot scroller collisions and moved/cleaned up previous changes
This commit is contained in:
@ -276,16 +276,6 @@ impl<'a> Widget for Crafting<'a> {
|
|||||||
.color(Some(UI_MAIN))
|
.color(Some(UI_MAIN))
|
||||||
.w_h(422.0, 460.0)
|
.w_h(422.0, 460.0)
|
||||||
.set(state.ids.window, ui);
|
.set(state.ids.window, ui);
|
||||||
// Search Background
|
|
||||||
// I couldn't find a way to manually set they layer of a widget
|
|
||||||
// If it is possible, please move this code (for rectangle) down to the code for
|
|
||||||
// search input
|
|
||||||
if self.show.crafting_search_key.is_some() {
|
|
||||||
Rectangle::fill([114.0, 20.0])
|
|
||||||
.top_left_with_margins_on(state.ids.window, 52.0, 26.0)
|
|
||||||
.hsla(0.0, 0.0, 0.0, 0.7)
|
|
||||||
.set(state.ids.input_bg_search, ui);
|
|
||||||
}
|
|
||||||
// Window
|
// Window
|
||||||
Image::new(self.imgs.crafting_frame)
|
Image::new(self.imgs.crafting_frame)
|
||||||
.middle_of(state.ids.window)
|
.middle_of(state.ids.window)
|
||||||
@ -887,6 +877,12 @@ impl<'a> Widget for Crafting<'a> {
|
|||||||
{
|
{
|
||||||
events.push(Event::SearchRecipe(None));
|
events.push(Event::SearchRecipe(None));
|
||||||
}
|
}
|
||||||
|
Rectangle::fill([114.0, 20.0])
|
||||||
|
.top_left_with_margins_on(state.ids.btn_close_search, -2.0, 16.0)
|
||||||
|
.hsla(0.0, 0.0, 0.0, 0.7)
|
||||||
|
.depth(1.0)
|
||||||
|
.parent(state.ids.window)
|
||||||
|
.set(state.ids.input_bg_search, ui);
|
||||||
if let Some(string) = TextEdit::new(key.as_str())
|
if let Some(string) = TextEdit::new(key.as_str())
|
||||||
.top_left_with_margins_on(state.ids.btn_close_search, -2.0, 18.0)
|
.top_left_with_margins_on(state.ids.btn_close_search, -2.0, 18.0)
|
||||||
.w_h(90.0, 20.0)
|
.w_h(90.0, 20.0)
|
||||||
|
@ -2,7 +2,7 @@ use super::{
|
|||||||
animate_by_pulse, get_quality_col,
|
animate_by_pulse, get_quality_col,
|
||||||
img_ids::{Imgs, ImgsRot},
|
img_ids::{Imgs, ImgsRot},
|
||||||
item_imgs::ItemImgs,
|
item_imgs::ItemImgs,
|
||||||
Show, TEXT_COLOR,
|
Show, Windows, TEXT_COLOR,
|
||||||
};
|
};
|
||||||
use crate::{
|
use crate::{
|
||||||
i18n::Localization,
|
i18n::Localization,
|
||||||
@ -189,7 +189,13 @@ impl<'a> Widget for LootScroller<'a> {
|
|||||||
ui.scroll_widget(state.ids.message_box, [0.0, std::f64::MAX]);
|
ui.scroll_widget(state.ids.message_box, [0.0, std::f64::MAX]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if self.show.social || self.show.trade {
|
// check if it collides with other windows
|
||||||
|
if self.show.diary
|
||||||
|
|| self.show.map
|
||||||
|
|| self.show.open_windows != Windows::None
|
||||||
|
|| self.show.social
|
||||||
|
|| self.show.trade
|
||||||
|
{
|
||||||
if state.last_hover_pulse.is_some() || state.last_auto_show_pulse.is_some() {
|
if state.last_hover_pulse.is_some() || state.last_auto_show_pulse.is_some() {
|
||||||
state.update(|s| {
|
state.update(|s| {
|
||||||
s.last_hover_pulse = None;
|
s.last_hover_pulse = None;
|
||||||
@ -197,8 +203,10 @@ impl<'a> Widget for LootScroller<'a> {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
//check if hovered
|
||||||
if ui
|
if ui
|
||||||
.rect_of(state.ids.message_box)
|
.rect_of(state.ids.message_box)
|
||||||
|
.map(|r| r.pad_left(-6.0))
|
||||||
.map_or(false, |r| r.is_over(ui.global_input().current.mouse.xy))
|
.map_or(false, |r| r.is_over(ui.global_input().current.mouse.xy))
|
||||||
{
|
{
|
||||||
state.update(|s| s.last_hover_pulse = Some(self.pulse));
|
state.update(|s| s.last_hover_pulse = Some(self.pulse));
|
||||||
@ -266,6 +274,7 @@ impl<'a> Widget for LootScroller<'a> {
|
|||||||
.bottom_left_with_margins_on(ui.window, 308.0, 20.0)
|
.bottom_left_with_margins_on(ui.window, 308.0, 20.0)
|
||||||
.set(state.ids.message_box, ui);
|
.set(state.ids.message_box, ui);
|
||||||
|
|
||||||
|
//only show scrollbar if it is being hovered and needed
|
||||||
if show_all_age < 1.0
|
if show_all_age < 1.0
|
||||||
&& ui
|
&& ui
|
||||||
.widget_graph()
|
.widget_graph()
|
||||||
|
@ -1465,7 +1465,6 @@ impl Hud {
|
|||||||
fonts,
|
fonts,
|
||||||
&i18n,
|
&i18n,
|
||||||
&global_state.settings.controls,
|
&global_state.settings.controls,
|
||||||
// If we're currently set to interact with the item...
|
|
||||||
properties,
|
properties,
|
||||||
pulse,
|
pulse,
|
||||||
&global_state.window.key_layout,
|
&global_state.window.key_layout,
|
||||||
|
@ -135,14 +135,6 @@ impl<'a> Widget for Social<'a> {
|
|||||||
.color(Some(UI_MAIN))
|
.color(Some(UI_MAIN))
|
||||||
.w_h(280.0, 460.0)
|
.w_h(280.0, 460.0)
|
||||||
.set(state.ids.bg, ui);
|
.set(state.ids.bg, ui);
|
||||||
// Search Background
|
|
||||||
// I couldn't find a way to manually set they layer of a widget
|
|
||||||
// If it is possible, please move this code (for rectangle) down to the code for
|
|
||||||
// search input
|
|
||||||
Rectangle::fill([248.0, 20.0])
|
|
||||||
.top_left_with_margins_on(state.ids.bg, 52.0, 27.0)
|
|
||||||
.hsla(0.0, 0.0, 0.0, 0.7)
|
|
||||||
.set(state.ids.player_search_input_bg, ui);
|
|
||||||
// Window frame
|
// Window frame
|
||||||
Image::new(self.imgs.social_frame_on)
|
Image::new(self.imgs.social_frame_on)
|
||||||
.middle_of(state.ids.bg)
|
.middle_of(state.ids.bg)
|
||||||
@ -426,6 +418,12 @@ impl<'a> Widget for Social<'a> {
|
|||||||
{
|
{
|
||||||
events.push(Event::Focus(state.ids.player_search_input));
|
events.push(Event::Focus(state.ids.player_search_input));
|
||||||
}
|
}
|
||||||
|
Rectangle::fill([248.0, 20.0])
|
||||||
|
.top_left_with_margins_on(state.ids.player_search_icon, -2.0, 18.0)
|
||||||
|
.hsla(0.0, 0.0, 0.0, 0.7)
|
||||||
|
.depth(1.0)
|
||||||
|
.parent(state.ids.bg)
|
||||||
|
.set(state.ids.player_search_input_bg, ui);
|
||||||
if let Some(string) =
|
if let Some(string) =
|
||||||
TextEdit::new(self.show.social_search_key.as_deref().unwrap_or_default())
|
TextEdit::new(self.show.social_search_key.as_deref().unwrap_or_default())
|
||||||
.top_left_with_margins_on(state.ids.player_search_icon, -1.0, 22.0)
|
.top_left_with_margins_on(state.ids.player_search_icon, -1.0, 22.0)
|
||||||
|
Reference in New Issue
Block a user