Fix preview clip mask hiding dac id

This commit is contained in:
Ruben van de Ven 2025-08-04 16:09:01 +02:00
parent 0b9d4d12f7
commit df7f0f26df

View file

@ -978,16 +978,7 @@ fn view_laser_preview(app: &App, model: &GuiModel, frame: Frame) {
// 1. get config for laser // 1. get config for laser
let config = model.per_laser_config.get(&dac_id).expect("Selected stream not found in configs"); let config = model.per_laser_config.get(&dac_id).expect("Selected stream not found in configs");
// 2 draw identifier of laser // 2. clipping mask + its anchor points
draw.text(&format!("{} {:?}", config.name, dac_id))
.h(win_rect.h())
.font_size(10)
.align_text_bottom()
.left_justify()
.color(WHITE)
.w(win_rect.w());
// 3. clipping mask + its anchor points
let clip_points: Vec<[f32;2]> = config.filters.clip.mask.iter().map(|p| { let clip_points: Vec<[f32;2]> = config.filters.clip.mask.iter().map(|p| {
[p[0] * hw, p[1] * hh] [p[0] * hw, p[1] * hh]
@ -1002,14 +993,14 @@ fn view_laser_preview(app: &App, model: &GuiModel, frame: Frame) {
} }
draw.polygon() draw.polygon()
.color(srgba(0.3, 0.3, 0.3, 1.)) .color(srgba(0.2, 0.2, 0.2, 0.3))
.stroke(PINK) .stroke(PINK)
.stroke_weight(thickness) .stroke_weight(thickness)
.join_round() .join_round()
.points(clip_points); .points(clip_points);
// 4. current shape of the laser // 3. current shape of the laser
let current_points: LaserPoints = (&model.current_lines).into(); let current_points: LaserPoints = (&model.current_lines).into();
@ -1048,6 +1039,15 @@ fn view_laser_preview(app: &App, model: &GuiModel, frame: Frame) {
.points_colored(vertices); .points_colored(vertices);
} }
// 4. Last, draw identifier of laser on top
draw.text(&format!("{} {:?}", config.name, dac_id))
.h(win_rect.h())
.font_size(10)
.align_text_bottom()
.left_justify()
.color(WHITE)
.w(win_rect.w());
} }
} }