Add tool_state functionality to wasm-wrapper (#42)

This commit is contained in:
TrueDoctor
2021-03-27 02:26:55 -07:00
committed by Keavon Chambers
parent fe51be0bb6
commit f9308a6d5a
4 changed files with 60 additions and 3 deletions
+12
View File
@@ -10,12 +10,22 @@ pub struct ToolState {
}
impl ToolState {
pub const fn default() -> ToolState {
ToolState {
primary_color: Color::BLACK,
secondary_color: Color::WHITE,
active_tool: ToolType::Select,
tool_settings: [ToolSettings::Select { append_mode: SelectAppendMode::New }; TOOL_COUNT],
// TODO: Initialize to sensible values
}
}
pub fn select_tool(&mut self, tool: ToolType) {
self.active_tool = tool
}
}
#[repr(usize)]
#[derive(Debug, Clone)]
pub enum ToolType {
Select = 0,
Crop = 1,
@@ -30,10 +40,12 @@ pub enum ToolType {
// all discriminats must be strictly smaller than TOOL_COUNT!
}
#[derive(Debug, Clone, Copy)]
pub enum ToolSettings {
Select { append_mode: SelectAppendMode },
}
#[derive(Debug, Clone, Copy)]
pub enum SelectAppendMode {
New,
Add,