aboutsummaryrefslogtreecommitdiff
path: root/src/client
diff options
context:
space:
mode:
authorArne Dußin2021-02-04 22:32:52 +0100
committerArne Dußin2021-02-04 22:32:52 +0100
commitfb596a4e3b6dd414241f9525e7efe200949428d6 (patch)
tree4e359dca5d86a6908470906ce3319ee2e2a1fad4 /src/client
parentc406ec08e3320e1b295ae9addc7416528243bdac (diff)
downloadgraf_karto-fb596a4e3b6dd414241f9525e7efe200949428d6.tar.gz
graf_karto-fb596a4e3b6dd414241f9525e7efe200949428d6.zip
Dimension ruling state cancelled on mouse interaction
This fixes the dimension indicator staying in a ruling state, while something else may have been selected.
Diffstat (limited to 'src/client')
-rw-r--r--src/client/gui/dimension_indicator.rs12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/client/gui/dimension_indicator.rs b/src/client/gui/dimension_indicator.rs
index ebad78b..7d5fd65 100644
--- a/src/client/gui/dimension_indicator.rs
+++ b/src/client/gui/dimension_indicator.rs
@@ -2,7 +2,7 @@
//! manually change the size of them in a precise manner should need be.
use crate::client::colours::DEFAULT_COLOURS;
-use crate::client::input::{Button, Input, Scancode};
+use crate::client::input::{Button, Input, MouseButton, Scancode};
use crate::client::map::Map;
use crate::client::transform::Transform;
use crate::client::Editor;
@@ -112,6 +112,14 @@ impl DimensionIndicator {
}
fn update_ruling(&mut self, editor: &Editor, input: &mut Input) {
+ // Abort the ruling state when doing anything with the mouse.
+ if input.poll_global(&Button::Mouse(MouseButton::Left).into())
+ || input.poll_global(&Button::Mouse(MouseButton::Right).into())
+ {
+ self.state = State::Watching;
+ return;
+ }
+
// Get the currently edited dimension for processing.
let (edited_dim, editing_x, text_pipe) = match &mut self.state {
State::Watching => panic!("Called ruler update when in watching state"),
@@ -154,7 +162,9 @@ impl DimensionIndicator {
match key {
// Add a decimal point to the dimension if possible.
'.' => {
+ println!("Adding dec point?");
if !edited_dim.contains('.') {
+ println!("Adding dec point!");
edited_dim.push('.');
}
// Nothing changed here, since there is an implicit .0 at the end.