Use essential canvas boundaries and outline selected state rows
This commit is contained in:
@@ -2074,7 +2074,7 @@ impl canvas::Program<Message> for Scene {
|
|||||||
.with_color(if activation.call == self.selected {
|
.with_color(if activation.call == self.selected {
|
||||||
style::TEAL
|
style::TEAL
|
||||||
} else {
|
} else {
|
||||||
style::LINE
|
style::BOUNDARY
|
||||||
})
|
})
|
||||||
.with_width(if activation.call == self.selected {
|
.with_width(if activation.call == self.selected {
|
||||||
2.5
|
2.5
|
||||||
@@ -2091,7 +2091,7 @@ impl canvas::Program<Message> for Scene {
|
|||||||
let color = if b.id == self.selected {
|
let color = if b.id == self.selected {
|
||||||
style::TEAL
|
style::TEAL
|
||||||
} else {
|
} else {
|
||||||
style::LINE
|
style::BOUNDARY
|
||||||
};
|
};
|
||||||
if outline {
|
if outline {
|
||||||
f.stroke(
|
f.stroke(
|
||||||
|
|||||||
@@ -240,9 +240,9 @@ impl Rendering {
|
|||||||
..Stroke::default()
|
..Stroke::default()
|
||||||
.with_width(1.)
|
.with_width(1.)
|
||||||
.with_color(if id == selected {
|
.with_color(if id == selected {
|
||||||
Color::from_rgb8(148, 190, 187)
|
style::TEAL
|
||||||
} else {
|
} else {
|
||||||
Color::from_rgb8(214, 222, 222)
|
style::BOUNDARY
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
@@ -262,7 +262,7 @@ impl Rendering {
|
|||||||
if lifetime.lifeline == selected {
|
if lifetime.lifeline == selected {
|
||||||
style::TEAL
|
style::TEAL
|
||||||
} else {
|
} 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) {
|
for (relation, row) in state_action_rows(project, node) {
|
||||||
if relation.id == selected {
|
if relation.id == selected {
|
||||||
frame.fill_rectangle(row.position(), row.size(), Color::from_rgb8(224, 247, 242));
|
paint_selected_row(frame, row);
|
||||||
}
|
}
|
||||||
label_text(
|
label_text(
|
||||||
frame,
|
frame,
|
||||||
@@ -1530,7 +1530,7 @@ fn paint_node(
|
|||||||
}
|
}
|
||||||
for (relation, row) in internal_rows(project, node) {
|
for (relation, row) in internal_rows(project, node) {
|
||||||
if relation.id == selected {
|
if relation.id == selected {
|
||||||
frame.fill_rectangle(row.position(), row.size(), Color::from_rgb8(224, 247, 242));
|
paint_selected_row(frame, row);
|
||||||
}
|
}
|
||||||
frame.stroke(
|
frame.stroke(
|
||||||
&line(row.position(), Point::new(row.x + row.width, row.y)),
|
&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)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::*;
|
use super::*;
|
||||||
|
|||||||
@@ -1173,7 +1173,7 @@ impl canvas::Program<Message> for DiagramCanvas<'_> {
|
|||||||
} else if edge.trace {
|
} else if edge.trace {
|
||||||
Color::from_rgb8(134, 107, 168)
|
Color::from_rgb8(134, 107, 168)
|
||||||
} else {
|
} else {
|
||||||
Color::from_rgb8(144, 158, 173)
|
style::BOUNDARY
|
||||||
};
|
};
|
||||||
let capability_label = relationship_stereotype(project, edge.id);
|
let capability_label = relationship_stereotype(project, edge.id);
|
||||||
let mut stroke =
|
let mut stroke =
|
||||||
@@ -1596,7 +1596,11 @@ fn paint_node(f: &mut Frame, p: &Project, n: &ProjectedNode, selected: Id, conta
|
|||||||
};
|
};
|
||||||
f.fill(&path, if container { tint } else { Color::WHITE });
|
f.fill(&path, if container { tint } else { Color::WHITE });
|
||||||
let mut stroke = Stroke::default()
|
let mut stroke = Stroke::default()
|
||||||
.with_color(if e.id == selected { color } else { style::LINE })
|
.with_color(if e.id == selected {
|
||||||
|
color
|
||||||
|
} else {
|
||||||
|
style::BOUNDARY
|
||||||
|
})
|
||||||
.with_width(if e.id == selected { 2.6 } else { 1.2 });
|
.with_width(if e.id == selected { 2.6 } else { 1.2 });
|
||||||
if n.allocation_summary {
|
if n.allocation_summary {
|
||||||
stroke.line_dash = canvas::LineDash {
|
stroke.line_dash = canvas::LineDash {
|
||||||
|
|||||||
Reference in New Issue
Block a user