mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Added Draggable area widget
This commit is contained in:
@ -24,6 +24,7 @@ use vek::Vec2;
|
|||||||
|
|
||||||
widget_ids! {
|
widget_ids! {
|
||||||
struct Ids {
|
struct Ids {
|
||||||
|
draggable_area,
|
||||||
message_box,
|
message_box,
|
||||||
message_box_bg,
|
message_box_bg,
|
||||||
chat_input,
|
chat_input,
|
||||||
@ -269,8 +270,6 @@ impl<'a> Widget for Chat<'a> {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
handle_chat_mouse_events(state.ids.message_box, ui, &mut events);
|
|
||||||
|
|
||||||
// Maintain scrolling //
|
// Maintain scrolling //
|
||||||
if !self.new_messages.is_empty() {
|
if !self.new_messages.is_empty() {
|
||||||
for message in self.new_messages.iter() {
|
for message in self.new_messages.iter() {
|
||||||
@ -569,6 +568,7 @@ impl<'a> Widget for Chat<'a> {
|
|||||||
.w(self.chat_size.x - 17.0)
|
.w(self.chat_size.x - 17.0)
|
||||||
.color(color)
|
.color(color)
|
||||||
.line_spacing(2.0);
|
.line_spacing(2.0);
|
||||||
|
|
||||||
// Add space between messages.
|
// Add space between messages.
|
||||||
let y = match text.get_y_dimension(ui) {
|
let y = match text.get_y_dimension(ui) {
|
||||||
Dimension::Absolute(y) => y + 2.0,
|
Dimension::Absolute(y) => y + 2.0,
|
||||||
@ -775,6 +775,21 @@ impl<'a> Widget for Chat<'a> {
|
|||||||
events.push(Event::SendMessage(msg));
|
events.push(Event::SendMessage(msg));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Rectangle::fill([self.chat_size.x, self.chat_size.y])
|
||||||
|
.rgba(0.0, 0.0, 0.0, 0.0)
|
||||||
|
.and(|r| {
|
||||||
|
if input_focused {
|
||||||
|
r.up_from(
|
||||||
|
state.ids.chat_input_border_up,
|
||||||
|
0.0 + CHAT_MARGIN_THICKNESS / 2.0,
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
r.bottom_left_with_margins_on(ui.window, self.chat_pos.y, self.chat_pos.x)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.set(state.ids.draggable_area, ui);
|
||||||
|
handle_chat_mouse_events(state.ids.draggable_area, ui, &mut events);
|
||||||
events
|
events
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user