-
Notifications
You must be signed in to change notification settings - Fork 240
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: Create a prototype time graph element
Move some state content over refactor: rename folder refactor: More renaming and pruning of old unused code. Create a prototype time graph element scrollable table Temporarily add dead code allows Minor refactorings
- Loading branch information
1 parent
0413045
commit a0feabc
Showing
27 changed files
with
1,402 additions
and
88 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
#![allow(dead_code)] | ||
|
||
use tui::{backend::Backend, layout::Rect, Frame}; | ||
|
||
use crate::{app::AppState, canvas::canvas_colours::CanvasColours}; | ||
|
||
/// A single point. | ||
#[derive(Copy, Clone)] | ||
pub struct Point { | ||
pub x: u16, | ||
pub y: u16, | ||
} | ||
|
||
/// The top-left and bottom-right corners of a [`Element`]. | ||
#[derive(Copy, Clone)] | ||
pub enum ElementBounds { | ||
Unset, | ||
Points { | ||
top_left_corner: Point, | ||
bottom_right_corner: Point, | ||
}, | ||
} | ||
|
||
/// A basic [`Element`] trait, all drawn components must implement this. | ||
pub trait Element { | ||
/// The type of data that is expected for the [`Element`]. | ||
|
||
/// The main drawing function. | ||
fn draw<B: Backend>( | ||
&mut self, f: &mut Frame<'_, B>, app_state: &AppState, draw_loc: Rect, | ||
style: &CanvasColours, | ||
) -> anyhow::Result<()>; | ||
|
||
/// Recalculates the click bounds. | ||
fn recalculate_click_bounds(&mut self); | ||
|
||
/// A function to determine the main widget click bounds. | ||
fn click_bounds(&self) -> ElementBounds; | ||
|
||
/// Returns whether am [`Element`] is selected. | ||
fn is_selected(&self) -> bool; | ||
|
||
/// Marks an [`Element`] as selected. | ||
fn select(&mut self); | ||
|
||
/// Marks an [`Element`] as unselected. | ||
fn unselect(&mut self); | ||
} |
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
Oops, something went wrong.