diff options
author | Conrad Ludgate <conrad.ludgate@truelayer.com> | 2023-04-16 08:06:37 +0100 |
---|---|---|
committer | Conrad Ludgate <conrad.ludgate@truelayer.com> | 2023-04-16 08:06:37 +0100 |
commit | 2f52b243d94b003617a7c0d3643916786796384d (patch) | |
tree | 38528a3aac2ef0f1b347bf4c797b450ec6324569 /atuin/src/ratatui/widgets/canvas/map.rs | |
parent | d18e1b59ef28eba67202bf8489a85141e5f092e9 (diff) |
chore: assortment of cleanupsassortment-of-cleanups
Diffstat (limited to 'atuin/src/ratatui/widgets/canvas/map.rs')
-rw-r--r-- | atuin/src/ratatui/widgets/canvas/map.rs | 48 |
1 files changed, 0 insertions, 48 deletions
diff --git a/atuin/src/ratatui/widgets/canvas/map.rs b/atuin/src/ratatui/widgets/canvas/map.rs deleted file mode 100644 index d835dd31..00000000 --- a/atuin/src/ratatui/widgets/canvas/map.rs +++ /dev/null @@ -1,48 +0,0 @@ -use crate::ratatui::{ - style::Color, - widgets::canvas::{ - world::{WORLD_HIGH_RESOLUTION, WORLD_LOW_RESOLUTION}, - Painter, Shape, - }, -}; - -#[derive(Debug, Clone, Copy)] -pub enum MapResolution { - Low, - High, -} - -impl MapResolution { - fn data(self) -> &'static [(f64, f64)] { - match self { - MapResolution::Low => &WORLD_LOW_RESOLUTION, - MapResolution::High => &WORLD_HIGH_RESOLUTION, - } - } -} - -/// Shape to draw a world map with the given resolution and color -#[derive(Debug, Clone)] -pub struct Map { - pub resolution: MapResolution, - pub color: Color, -} - -impl Default for Map { - fn default() -> Map { - Map { - resolution: MapResolution::Low, - color: Color::Reset, - } - } -} - -impl Shape for Map { - fn draw(&self, painter: &mut Painter) { - for (x, y) in self.resolution.data() { - if let Some((x, y)) = painter.get_point(*x, *y) { - painter.paint(x, y, self.color); - } - } - } -} |