From b12d0494f54d781a0b9f467a4fc3e4e255dd9839 Mon Sep 17 00:00:00 2001 From: Arne Dußin Date: Thu, 29 Oct 2020 03:13:10 +0100 Subject: Make map draggable The map can be dragged around, but since the grid is not yet infinitely big, it feels quite weird to zoom and drag --- src/transform.rs | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/transform.rs') diff --git a/src/transform.rs b/src/transform.rs index ef94029..a91d7da 100644 --- a/src/transform.rs +++ b/src/transform.rs @@ -121,6 +121,11 @@ impl Transform { } } + /// Move the canvas by the vector in pixels. + pub fn move_by_px(&mut self, by: [f64; 2]) { + self.translation_px = math::add(self.translation_px, by); + } + pub fn pixels_per_m(&self) -> f64 { self.pixels_per_m } -- cgit v1.2.3-70-g09d2