Refactor to hand-mode UI and reorganize WGSL shader
Replace spatial force / stats panels with unified hand force panels; simplify app.rs wiring and reorganize shader.wgsl for the hand rendering layout.
This commit is contained in:
60
src/app.rs
60
src/app.rs
@@ -13,7 +13,7 @@ use crate::{
|
||||
},
|
||||
ui::{
|
||||
ConfigPanelState, ConnectPanelState, FloatingPanelState, MatrixConfigState,
|
||||
draw_config_panel, draw_spatial_force_panel, draw_stats_panel, panel_restore_item,
|
||||
draw_config_panel, draw_hand_force_panels, panel_restore_item,
|
||||
},
|
||||
};
|
||||
use eframe::{egui, egui_wgpu};
|
||||
@@ -167,12 +167,7 @@ impl EskinDesktopApp {
|
||||
live_rates: LiveRateMeters::new(),
|
||||
context_menu_open: false,
|
||||
context_menu_pos: egui::pos2(24.0, 48.0),
|
||||
active_mode: ActiveMode::Finger(FingerMode {
|
||||
rows: 12,
|
||||
cols: 7,
|
||||
range: 0..7000,
|
||||
dot: true,
|
||||
}),
|
||||
active_mode: ActiveMode::Hand(HandGatewayMode { range: 0..7000 }),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -190,7 +185,6 @@ impl EskinDesktopApp {
|
||||
active_mode: self.active_mode.clone(),
|
||||
},
|
||||
));
|
||||
self.paint_spatial_force_overlay(ui, rect);
|
||||
}
|
||||
|
||||
fn paint_spatial_force_overlay(&self, ui: &egui::Ui, rect: egui::Rect) {
|
||||
@@ -223,11 +217,7 @@ impl EskinDesktopApp {
|
||||
}
|
||||
|
||||
fn draw_workspace(&mut self, ui: &mut egui::Ui) {
|
||||
if self.breakout_visible {
|
||||
self.draw_split_workspace(ui);
|
||||
} else {
|
||||
self.draw_wgpu_background_rect(ui, ui.max_rect());
|
||||
}
|
||||
self.draw_wgpu_background_rect(ui, ui.max_rect());
|
||||
}
|
||||
|
||||
fn draw_split_workspace(&mut self, ui: &mut egui::Ui) {
|
||||
@@ -295,9 +285,7 @@ impl EskinDesktopApp {
|
||||
self.signal_history.remove(0);
|
||||
}
|
||||
|
||||
if self.config_state.mode == SerialMode::Hand {
|
||||
update_hand_signal_histories(&mut self.hand_signal_histories, &sample.matrix);
|
||||
}
|
||||
update_hand_signal_histories(&mut self.hand_signal_histories, &sample.matrix);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -423,12 +411,6 @@ impl EskinDesktopApp {
|
||||
self.matrix_config_panel.visible = false;
|
||||
self.context_menu_open = false;
|
||||
|
||||
if self.breakout_visible {
|
||||
self.config_panel.visible = false;
|
||||
self.stats_panel.visible = false;
|
||||
return;
|
||||
}
|
||||
|
||||
if let Some(next_mode) = draw_config_panel(
|
||||
ctx,
|
||||
&mut self.config_panel,
|
||||
@@ -439,39 +421,11 @@ impl EskinDesktopApp {
|
||||
self.live_rates.sample_rate_hz,
|
||||
self.live_rates.render_rate_hz,
|
||||
) {
|
||||
if next_mode == SerialMode::Hand {
|
||||
self.config_state.mode = SerialMode::Finger;
|
||||
self.connect_state.mode = SerialMode::Finger;
|
||||
self.config_state.baud_rate = SerialMode::Finger.baud_rate();
|
||||
self.active_mode = ActiveMode::Finger(FingerMode {
|
||||
rows: self.matrix_config.rows,
|
||||
cols: self.matrix_config.cols,
|
||||
range: 0..7000,
|
||||
dot: true,
|
||||
});
|
||||
self.breakout_visible = true;
|
||||
} else {
|
||||
self.switch_mode(next_mode);
|
||||
}
|
||||
self.switch_mode(next_mode);
|
||||
}
|
||||
|
||||
if self.config_state.mode == SerialMode::Finger {
|
||||
self.stats_panel.visible = true;
|
||||
draw_stats_panel(
|
||||
ctx,
|
||||
&mut self.stats_panel,
|
||||
&self.signal_history,
|
||||
self.latest_spatial_force,
|
||||
);
|
||||
} else {
|
||||
self.stats_panel.visible = false;
|
||||
}
|
||||
|
||||
if let Some(force) = self.latest_spatial_force {
|
||||
self.spatial_force_panel_force = Some(force);
|
||||
}
|
||||
|
||||
draw_spatial_force_panel(ctx, self.spatial_force_panel_force, &self.signal_history);
|
||||
self.stats_panel.visible = false;
|
||||
draw_hand_force_panels(ctx, true, &self.hand_signal_histories);
|
||||
}
|
||||
|
||||
fn draw_panel_context_menu(&mut self, ctx: &egui::Context) {
|
||||
|
||||
Reference in New Issue
Block a user