aboutsummaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/dimension_indicator.rs20
-rw-r--r--src/gui/tool_sidebar.rs5
2 files changed, 17 insertions, 8 deletions
diff --git a/src/gui/dimension_indicator.rs b/src/gui/dimension_indicator.rs
index e8848fe..57f5bcc 100644
--- a/src/gui/dimension_indicator.rs
+++ b/src/gui/dimension_indicator.rs
@@ -41,22 +41,28 @@ impl Default for State {
}
}
+impl Default for DimensionIndicator {
+ fn default() -> Self {
+ Self {
+ state: State::default(),
+ bounds: Rect::new(0., 0., 0., 0.),
+ }
+ }
+}
+
impl DimensionIndicator {
/// Create a new dimension indicator. While it is possible to have multiple instances, this is
/// not generally recommended, since they will need to be managed carefully or otherwise steal
/// keystrokes from each other.
pub fn new() -> Self {
- Self {
- state: State::default(),
- bounds: Rect::new(0., 0., 0., 0.),
- }
+ Self::default()
}
/// Update whatever is selected on the map according to the dimension indicator rules and rulers.
pub fn update(&mut self, map: &mut Map, rl: &mut RaylibHandle) {
- match &self.state {
- &State::Watching => self.update_watching(map, rl),
- &State::Ruling { .. } => self.update_ruling(map, rl),
+ match self.state {
+ State::Watching => self.update_watching(map, rl),
+ State::Ruling { .. } => self.update_ruling(map, rl),
};
}
diff --git a/src/gui/tool_sidebar.rs b/src/gui/tool_sidebar.rs
index e6b8867..78041e7 100644
--- a/src/gui/tool_sidebar.rs
+++ b/src/gui/tool_sidebar.rs
@@ -3,7 +3,7 @@
// TODO: Currently, the keyboard shortcuts for tools are handled by the editor, but a lot speaks for
// them being handled by the ToolSidebar instead.
-use crate::math::{Rect, Surface, Vec2};
+use crate::math::{ExactSurface, Rect, Vec2};
use crate::tool::ToolType;
use crate::Editor;
use raylib::core::texture::Texture2D;
@@ -30,6 +30,9 @@ impl ToolSidebar {
}
fn panel_rect(screen_height: u16) -> Rect<f32> {
+ /* The width is currently hardcoded as 104, which is
+ * 64 (button-size) + 20 left gap + 20 right gap
+ */
Rect::new(0., 0., 104., screen_height as f32)
}