mirror of https://codeberg.org/topola/topola.git
Distinguish one layer as active
This commit is contained in:
parent
2ed6e13a50
commit
24af694c6b
|
|
@ -34,18 +34,20 @@ pub struct LayerColors {
|
|||
}
|
||||
|
||||
#[derive(Clone, Debug, Deserialize, Serialize)]
|
||||
pub struct AppearancePanel {
|
||||
pub struct LayersPanel {
|
||||
// TODO:
|
||||
// In1.Cu shall be #7fc87f (#d5ecd5 when selected).
|
||||
// In2.Cu shall be #ce7d2c (#e8c39e when selected).
|
||||
dark_colors: Colors,
|
||||
light_colors: Colors,
|
||||
|
||||
#[serde(skip)]
|
||||
pub active: usize,
|
||||
#[serde(skip)]
|
||||
pub visible: Box<[bool]>,
|
||||
}
|
||||
|
||||
impl AppearancePanel {
|
||||
impl LayersPanel {
|
||||
pub fn new(board: &Board) -> Self {
|
||||
let dark_colors = Colors {
|
||||
layers: ColorLayers {
|
||||
|
|
@ -159,6 +161,7 @@ impl AppearancePanel {
|
|||
Self {
|
||||
dark_colors,
|
||||
light_colors,
|
||||
active: 0,
|
||||
visible,
|
||||
}
|
||||
}
|
||||
|
|
@ -178,22 +181,11 @@ impl AppearancePanel {
|
|||
.num_columns(3)
|
||||
.start_row(start_row)
|
||||
.show(ui, |ui| {
|
||||
for (layer, visible) in self.visible[row_range].iter_mut().enumerate() {
|
||||
let layer = layer + start_row;
|
||||
for layer in row_range {
|
||||
let visible = &mut self.visible[layer];
|
||||
let layer_name = board.layer_name(layer);
|
||||
|
||||
// unnamed layers can't be used for routing
|
||||
/*if layer_name.is_some() {
|
||||
ui.radio_value(
|
||||
&mut options.planar.principal_layer,
|
||||
layer,
|
||||
WidgetText::default(),
|
||||
);
|
||||
} else {
|
||||
// dummy item to bump the grid
|
||||
ui.label("");
|
||||
}*/
|
||||
|
||||
ui.radio_value(&mut self.active, layer, WidgetText::default());
|
||||
ui.checkbox(visible, WidgetText::default());
|
||||
ui.label(
|
||||
layer_name
|
||||
|
|
@ -7,8 +7,8 @@
|
|||
mod action;
|
||||
mod actions;
|
||||
mod app;
|
||||
mod appearance_panel;
|
||||
mod display;
|
||||
mod layers_panel;
|
||||
mod menu_bar;
|
||||
mod translator;
|
||||
mod viewport;
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@ impl Viewport {
|
|||
.navmesher_board()
|
||||
.board()
|
||||
.point_pin_selector(
|
||||
0,
|
||||
workspace.appearance_panel.active,
|
||||
Vector2::new(
|
||||
pointer_scene_pos.x as i64,
|
||||
pointer_scene_pos.y as i64,
|
||||
|
|
|
|||
|
|
@ -4,17 +4,17 @@
|
|||
|
||||
use topola::{Autorouter, Board, selections::PersistableSelection};
|
||||
|
||||
use crate::{appearance_panel::AppearancePanel, translator::Translator};
|
||||
use crate::{layers_panel::LayersPanel, translator::Translator};
|
||||
|
||||
pub struct Workspace {
|
||||
pub autorouter: Autorouter,
|
||||
pub appearance_panel: AppearancePanel,
|
||||
pub appearance_panel: LayersPanel,
|
||||
pub selection: PersistableSelection,
|
||||
}
|
||||
|
||||
impl Workspace {
|
||||
pub fn new(board: Board, tr: &Translator) -> Self {
|
||||
let appearance_panel = AppearancePanel::new(&board);
|
||||
let appearance_panel = LayersPanel::new(&board);
|
||||
|
||||
Self {
|
||||
autorouter: Autorouter::new(board),
|
||||
|
|
|
|||
Loading…
Reference in New Issue