move camera with RMB for mousepad compatibility, hold shift for faster panning

This commit is contained in:
Crispy 2024-12-09 20:58:35 +01:00
parent e9e763332f
commit e3f8087a6b
2 changed files with 9 additions and 4 deletions

View file

@ -6,7 +6,7 @@ logic mostly like https://git.crispypin.cc/CrispyPin/marble
## todo ## todo
- undo/redo - undo/redo
- more levels - more levels
- make power propagation not recursive - make direct power (gate -> machine) work, (needs storing power direction in machine tiles)
- story/lore - story/lore
- cut selections, copy to system clipboard - cut selections, copy to system clipboard
- timestamps in solutions and blueprints - timestamps in solutions and blueprints

View file

@ -394,10 +394,15 @@ impl Editor {
self.zoom_out(rl); self.zoom_out(rl);
} }
} }
if rl.is_mouse_button_down(MouseButton::MOUSE_BUTTON_MIDDLE) { if rl.is_mouse_button_down(MouseButton::MOUSE_BUTTON_RIGHT) {
self.view_offset += rl.get_mouse_delta(); let speed = if rl.is_key_down(KeyboardKey::KEY_LEFT_SHIFT) {
4.
} else {
1.
};
self.view_offset += rl.get_mouse_delta() * speed;
} }
if rl.is_mouse_button_pressed(MouseButton::MOUSE_BUTTON_RIGHT) { if rl.is_key_pressed(KeyboardKey::KEY_HOME) {
self.center_view(rl); self.center_view(rl);
} }