diff --git a/rog-aura/data/layouts/ga401_US.toml b/rog-aura/data/layouts/ga401_US.toml index 74bd3897..4da44d63 100644 --- a/rog-aura/data/layouts/ga401_US.toml +++ b/rog-aura/data/layouts/ga401_US.toml @@ -125,19 +125,19 @@ row = [ [[rows]] row = [ - 'ArrowSpacer', - 'ArrowSpacer', - 'ArrowSpacer', - 'ArrowSpacer', - 'ArrowSpacer', - 'ArrowSpacer', - 'ArrowSpacer', - 'ArrowSpacer', - 'ArrowSpacer', - 'ArrowSpacer', - 'ArrowSpacer', - 'ArrowSpacer', - 'ArrowSpacer', + 'FuncSpacer', + 'FuncSpacer', + 'NormalSpacer', + 'NormalSpacer', + 'NormalSpacer', + 'NormalSpacer', + 'NormalSpacer', + 'NormalSpacer', + 'NormalSpacer', + 'NormalSpacer', + 'NormalSpacer', + 'NormalSpacer', + 'NormalSpacer', 'Left', 'Down', 'Right', diff --git a/rog-aura/data/layouts/gx502_US.toml b/rog-aura/data/layouts/gx502_US.toml index 26dad3ea..af53a1d2 100644 --- a/rog-aura/data/layouts/gx502_US.toml +++ b/rog-aura/data/layouts/gx502_US.toml @@ -143,19 +143,19 @@ row = [ [[rows]] row = [ - 'ArrowSpacer', - 'ArrowSpacer', - 'ArrowSpacer', - 'ArrowSpacer', - 'ArrowSpacer', - 'ArrowSpacer', - 'ArrowSpacer', - 'ArrowSpacer', - 'ArrowSpacer', - 'ArrowSpacer', - 'ArrowSpacer', - 'ArrowSpacer', - 'ArrowSpacer', + 'FuncSpacer', + 'FuncSpacer', + 'NormalSpacer', + 'NormalSpacer', + 'NormalSpacer', + 'NormalSpacer', + 'NormalSpacer', + 'NormalSpacer', + 'NormalSpacer', + 'NormalSpacer', + 'NormalSpacer', + 'NormalSpacer', + 'NormalSpacer', 'Left', 'Down', 'Right', diff --git a/rog-aura/src/keys.rs b/rog-aura/src/keys.rs index 64a74e00..887a4636 100644 --- a/rog-aura/src/keys.rs +++ b/rog-aura/src/keys.rs @@ -205,11 +205,11 @@ impl KeyShape { Self::Space => 5.0, Self::Space5 => 1.0, Self::LCtrlMed => 1.1, - Self::LShift => 2.1, + Self::LShift => 2.0, Self::LShift3 => 0.67, - Self::RShift => 2.7, + Self::RShift => 2.8, Self::RshiftSmall => 1.7, - Self::RShift3 => 0.9, + Self::RShift3 => 0.93, Self::Return => 2.2, Self::Return3 => 0.7333, Self::Tab => 1.4, @@ -217,14 +217,16 @@ impl KeyShape { Self::Backspace => 2.0, Self::Backspace3 => 0.666, Self::ArrowRegularBlank | Self::ArrowRegularSpacer => 0.7, - Self::Arrow | Self::ArrowBlank | Self::ArrowSpacer => 0.93, + Self::Arrow => 0.8, + Self::ArrowBlank | Self::ArrowSpacer => 1.0, Self::ArrowSplit | Self::ArrowSplitBlank | Self::ArrowSplitSpacer => 1.0, Self::RowEndSpacer => 0.1, } } pub const fn uy(&self) -> f32 { match self { - Self::Func | Self::RowEndSpacer => 0.8, + Self::Func => 0.8, + Self::RowEndSpacer => 0.1, Self::FuncBlank => 0.8, Self::FuncSpacer => 0.8, Self::Arrow | Self::ArrowBlank | Self::ArrowSpacer => 0.6, @@ -266,6 +268,20 @@ impl KeyShape { _ => false, } } + + pub const fn is_arrow_cluster(&self) -> bool { + match self { + Self::Arrow | Self::ArrowBlank | Self::ArrowSpacer => true, + _ => false, + } + } + + pub const fn is_arrow_splits(&self) -> bool { + match self { + Self::ArrowSplit | Self::ArrowSplitBlank | Self::ArrowSplitSpacer => true, + _ => false, + } + } } impl From for KeyShape { diff --git a/rog-control-center/src/main.rs b/rog-control-center/src/main.rs index fbe76bf7..0e703139 100644 --- a/rog-control-center/src/main.rs +++ b/rog-control-center/src/main.rs @@ -47,7 +47,7 @@ fn main() -> Result<(), Box> { let mut path = PathBuf::from(DATA_DIR); #[cfg(feature = "mocking")] { - board_name = "GX502".to_string(); + board_name = "G513".to_string(); path.pop(); path.push("rog-aura"); path.push("data"); diff --git a/rog-control-center/src/pages/aura_page.rs b/rog-control-center/src/pages/aura_page.rs index 567fef44..498b7c49 100644 --- a/rog-control-center/src/pages/aura_page.rs +++ b/rog-control-center/src/pages/aura_page.rs @@ -1,4 +1,4 @@ -use egui::{Color32, Vec2}; +use egui::{Align, Color32, Vec2}; use rog_aura::keys::KeyShape; use crate::{widgets::aura_modes_group, RogApp}; @@ -24,14 +24,20 @@ impl<'a> RogApp<'a> { aura_modes_group(supported, states, dbus, ui); ui.spacing_mut().item_spacing = egui::vec2(0.0, 0.0); + let mut arrows_done = false; for row in states.keyboard_layout.rows() { - ui.horizontal(|ui| { + ui.horizontal_top(|ui| { for key in row.row() { // your boat let shape = KeyShape::from(key); let label = <&str>::from(key); - if shape.is_blank() || shape.is_spacer() { + if shape.is_arrow_cluster() { + if !arrows_done { + arrow_cluster(ui, colour); + arrows_done = true; + } + } else if shape.is_blank() || shape.is_spacer() { blank(ui, shape); } else if shape.is_group() { key_group(ui, colour, shape.ux(), shape.uy()).on_hover_text(label); @@ -93,3 +99,27 @@ fn blank(ui: &mut egui::Ui, shape: KeyShape) { ui.spacing().interact_size.y * egui::vec2(2.0 * shape.ux(), 2.0 * shape.uy()); ui.allocate_exact_size(desired_size, egui::Sense::click()); } + +/// Draws entire arrow cluster block. This is visibly different to the split-arrows. +fn arrow_cluster(ui: &mut egui::Ui, colour: Color32) { + let space = KeyShape::ArrowSpacer; + let shape = KeyShape::Arrow; + ui.horizontal_top(|ui| { + ui.with_layout(egui::Layout::top_down(Align::LEFT), |ui| { + blank(ui, space); + ui.horizontal(|ui| { + blank(ui, KeyShape::RowEndSpacer); + blank(ui, KeyShape::RowEndSpacer); + key_shape(ui, colour, shape).on_hover_text("Left"); + }); + }); + ui.with_layout(egui::Layout::top_down(Align::LEFT), |ui| { + key_shape(ui, colour, shape).on_hover_text("Up"); + key_shape(ui, colour, shape).on_hover_text("Down"); + }); + ui.with_layout(egui::Layout::top_down(Align::LEFT), |ui| { + blank(ui, space); + key_shape(ui, colour, shape).on_hover_text("Right"); + }); + }); +}