diff options
| author | Vladislav Stepanov <8uk.8ak@gmail.com> | 2023-04-14 23:18:58 +0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-04-14 20:18:58 +0100 |
| commit | c05d2850420a2c163b8f62c33a6cef7c0ae1ad8d (patch) | |
| tree | 2c44a44eda7e76fa74e78ac1fd02f55c1ed4d804 /src/ratatui/widgets/canvas/map.rs | |
| parent | Switch to uuidv7 (#864) (diff) | |
| download | atuin-c05d2850420a2c163b8f62c33a6cef7c0ae1ad8d.zip | |
Workspace reorder (#868)
* Try different workspace structure
Move main crate (atuin) to be on the same level with other crates in
this workspace
* extract common dependencies to the workspace definition
* fix base64 v0.21 deprecation warning
* questionable: update deps & fix chrono deprecations
possible panic sites are unchanged, they're just more visible now
* Revert "questionable: update deps & fix chrono deprecations"
This reverts commit 993e60f8dea81a1625a04285a617959ad09a0866.
Diffstat (limited to 'src/ratatui/widgets/canvas/map.rs')
| -rw-r--r-- | src/ratatui/widgets/canvas/map.rs | 48 |
1 files changed, 0 insertions, 48 deletions
diff --git a/src/ratatui/widgets/canvas/map.rs b/src/ratatui/widgets/canvas/map.rs deleted file mode 100644 index d835dd31..00000000 --- a/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); - } - } - } -} |
