Use essential canvas boundaries and outline selected state rows
This commit is contained in:
@@ -240,9 +240,9 @@ impl Rendering {
|
||||
..Stroke::default()
|
||||
.with_width(1.)
|
||||
.with_color(if id == selected {
|
||||
Color::from_rgb8(148, 190, 187)
|
||||
style::TEAL
|
||||
} else {
|
||||
Color::from_rgb8(214, 222, 222)
|
||||
style::BOUNDARY
|
||||
})
|
||||
},
|
||||
);
|
||||
@@ -262,7 +262,7 @@ impl Rendering {
|
||||
if lifetime.lifeline == selected {
|
||||
style::TEAL
|
||||
} else {
|
||||
Color::from_rgb8(91, 113, 113)
|
||||
style::BOUNDARY
|
||||
},
|
||||
),
|
||||
),
|
||||
|
||||
@@ -1514,7 +1514,7 @@ fn paint_node(
|
||||
}
|
||||
for (relation, row) in state_action_rows(project, node) {
|
||||
if relation.id == selected {
|
||||
frame.fill_rectangle(row.position(), row.size(), Color::from_rgb8(224, 247, 242));
|
||||
paint_selected_row(frame, row);
|
||||
}
|
||||
label_text(
|
||||
frame,
|
||||
@@ -1530,7 +1530,7 @@ fn paint_node(
|
||||
}
|
||||
for (relation, row) in internal_rows(project, node) {
|
||||
if relation.id == selected {
|
||||
frame.fill_rectangle(row.position(), row.size(), Color::from_rgb8(224, 247, 242));
|
||||
paint_selected_row(frame, row);
|
||||
}
|
||||
frame.stroke(
|
||||
&line(row.position(), Point::new(row.x + row.width, row.y)),
|
||||
@@ -1565,6 +1565,22 @@ fn paint_node(
|
||||
}
|
||||
}
|
||||
|
||||
fn paint_selected_row(frame: &mut Frame, row: Rectangle) {
|
||||
frame.fill_rectangle(row.position(), row.size(), Color::from_rgb8(224, 247, 242));
|
||||
if row.width <= 2. || row.height <= 2. {
|
||||
return;
|
||||
}
|
||||
// Selection remains visible without hue. Keep the outline inside the
|
||||
// existing row so it cannot cover its separator or change its hit bounds.
|
||||
frame.stroke(
|
||||
&Path::rectangle(
|
||||
row.position() + Vector::new(1., 1.),
|
||||
Size::new(row.width - 2., row.height - 2.),
|
||||
),
|
||||
Stroke::default().with_color(style::TEAL).with_width(1.5),
|
||||
);
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
Reference in New Issue
Block a user