mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
feat: ungrab cursor w/ typing
This commit is contained in:
parent
9dcf7a9d26
commit
26dd5671d1
@ -3347,14 +3347,20 @@ impl Hud {
|
|||||||
|
|
||||||
WinEvent::InputUpdate(GameInput::Chat, true) => {
|
WinEvent::InputUpdate(GameInput::Chat, true) => {
|
||||||
self.ui.focus_widget(if self.typing() {
|
self.ui.focus_widget(if self.typing() {
|
||||||
|
// regrab cursor when done typing
|
||||||
|
self.force_ungrab = false;
|
||||||
None
|
None
|
||||||
} else {
|
} else {
|
||||||
|
// ungrab cursor when activating typing
|
||||||
|
self.force_ungrab = true;
|
||||||
Some(self.ids.chat)
|
Some(self.ids.chat)
|
||||||
});
|
});
|
||||||
true
|
true
|
||||||
},
|
},
|
||||||
WinEvent::InputUpdate(GameInput::Escape, true) => {
|
WinEvent::InputUpdate(GameInput::Escape, true) => {
|
||||||
if self.typing() {
|
if self.typing() {
|
||||||
|
// If we were typing, the cursor was ungrabbed, so regrab it.
|
||||||
|
self.force_ungrab = false;
|
||||||
self.ui.focus_widget(None);
|
self.ui.focus_widget(None);
|
||||||
} else if self.show.trade {
|
} else if self.show.trade {
|
||||||
self.events.push(Event::TradeAction(TradeAction::Decline));
|
self.events.push(Event::TradeAction(TradeAction::Decline));
|
||||||
|
Loading…
Reference in New Issue
Block a user