mirror of https://codeberg.org/topola/topola.git
egui: hide layers marked as hidden
This commit is contained in:
parent
339387c657
commit
300529ea75
|
|
@ -204,6 +204,7 @@ impl eframe::App for App {
|
|||
self.shared_data.clone(),
|
||||
&self.invoker,
|
||||
&mut self.overlay,
|
||||
&self.layers,
|
||||
);
|
||||
|
||||
if ctx.input(|i| i.key_pressed(egui::Key::Escape)) {
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
use topola::board::{mesadata::MesadataTrait, Board};
|
||||
|
||||
pub struct Layers {
|
||||
visible: Box<[bool]>,
|
||||
pub visible: Box<[bool]>,
|
||||
}
|
||||
|
||||
impl Layers {
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@ use topola::{
|
|||
|
||||
use crate::{
|
||||
app::{execute, SharedData},
|
||||
layers::Layers,
|
||||
overlay::Overlay,
|
||||
painter::Painter,
|
||||
top::Top,
|
||||
|
|
@ -38,6 +39,7 @@ impl Viewport {
|
|||
shared_data: Arc<Mutex<SharedData>>,
|
||||
maybe_invoker: &Option<Arc<Mutex<Invoker<DsnMesadata>>>>,
|
||||
maybe_overlay: &mut Option<Overlay>,
|
||||
maybe_layers: &Option<Layers>,
|
||||
) {
|
||||
egui::CentralPanel::default().show(ctx, |ui| {
|
||||
egui::Frame::canvas(ui.style()).show(ui, |ui| {
|
||||
|
|
@ -106,6 +108,8 @@ impl Viewport {
|
|||
) {
|
||||
let board = invoker.autorouter().board();
|
||||
|
||||
if let Some(layers) = maybe_layers {
|
||||
if layers.visible[1] {
|
||||
for primitive in board.layout().drawing().layer_primitive_nodes(1) {
|
||||
let shape = primitive.primitive(board.layout().drawing()).shape();
|
||||
|
||||
|
|
@ -132,7 +136,9 @@ impl Viewport {
|
|||
};
|
||||
painter.paint_polygon(&board.layout().zone(zone).shape().polygon, color)
|
||||
}
|
||||
}
|
||||
|
||||
if layers.visible[0] {
|
||||
for primitive in board.layout().drawing().layer_primitive_nodes(0) {
|
||||
let shape = primitive.primitive(board.layout().drawing()).shape();
|
||||
|
||||
|
|
@ -159,6 +165,8 @@ impl Viewport {
|
|||
};
|
||||
painter.paint_polygon(&board.layout().zone(zone).shape().polygon, color)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if top.show_ratsnest {
|
||||
for edge in overlay.ratsnest().graph().edge_references() {
|
||||
|
|
|
|||
Loading…
Reference in New Issue