system settings
git clone https://git.lucas.co/cce-system-interface.git
Fix geometry scale alignment bug: use logical coordinates for quads rendering and hit-testing
src/input_handler.rs | 10 ++++------
src/main.rs | 2 +-
src/renderer.rs | 6 +++---
3 files changed, 8 insertions(+), 10 deletions(-)
diff --git a/src/input_handler.rs b/src/input_handler.rs
index ba91bc2..778d2f4 100644
--- a/src/input_handler.rs
+++ b/src/input_handler.rs
@@ -60,9 +60,8 @@ impl SystemInterface {
}
}
- let scale = self.scale_factor as f32;
- let phys_x = x * scale;
- let phys_y = y * scale;
+ let phys_x = x;
+ let phys_y = y;
// Check if cursor hover state changed on any widget
for w in &self.widgets {
@@ -166,9 +165,8 @@ impl SystemInterface {
if button != cce_ui::widget::MouseButton::Left && button != cce_ui::widget::MouseButton::Right { return false; }
- let scale = self.scale_factor as f32;
- let phys_x = self.cursor_x * scale;
- let phys_y = self.cursor_y * scale;
+ let phys_x = self.cursor_x;
+ let phys_y = self.cursor_y;
let mut button_handled = false;
let mut clicked_action = None;
diff --git a/src/main.rs b/src/main.rs
index 2420744..e6e36be 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -398,7 +398,7 @@ impl cce_ui::engine::Application for SystemInterface {
}
// Draw global hover highlight if active
- let s = scale as f32;
+ let s = 1.0f32;
cce_ui::widget::hover_animation::post_render_check();
if let Some((qx, qy, qw, qh, qc)) = cce_ui::widget::hover_animation::get_quad() {
quads.push((
diff --git a/src/renderer.rs b/src/renderer.rs
index f477f47..7e034c1 100644
--- a/src/renderer.rs
+++ b/src/renderer.rs
@@ -48,9 +48,9 @@ impl SystemInterface {
cce_ui::widget::hover_animation::set_scroll_offset(self.scroll_y);
cce_ui::widget::hover_animation::set_cursor_pos(self.cursor_x, self.cursor_y);
- let s = self.scale_factor as f32;
- let cursor_phys_x = self.cursor_x * s;
- let cursor_phys_y = self.cursor_y * s;
+ let s = 1.0f32;
+ let cursor_phys_x = self.cursor_x;
+ let cursor_phys_y = self.cursor_y;
let check_hover = |wx: f32, wy: f32, ww: f32, wh: f32| -> bool {
cursor_phys_x >= wx && cursor_phys_x <= wx + ww && cursor_phys_y >= wy && cursor_phys_y <= wy + wh
};