UI: favorite themes and appearance shortcuts
Port of storytold/photocraft#2445. Each theme in the appearance picker gets a star at the right edge of its row. Starred themes are saved with the preferences and listed in a right-click menu on the header's appearance button, next to Appearance Settings, so switching between favorites takes one click.
This commit is contained in:
@@ -22,6 +22,7 @@ pub enum Icon {
|
||||
Ellipse,
|
||||
Polygon,
|
||||
Star,
|
||||
StarFilled,
|
||||
Pen,
|
||||
PenAdd,
|
||||
PenDelete,
|
||||
@@ -271,6 +272,18 @@ pub fn paint(painter: &Painter, rect: Rect, icon: Icon, color: Color32) {
|
||||
let pts = pen.star(8.0, 8.6, 6.4, 2.7, 5);
|
||||
pen.closed(&pts);
|
||||
}
|
||||
StarFilled => {
|
||||
// Five triangles fill the concave star without a convex-polygon approximation.
|
||||
let pts = pen.star(8.0, 8.6, 6.4, 2.7, 5);
|
||||
for pair in pts.windows(2) {
|
||||
if let [a, b] = pair {
|
||||
pen.fill(&[(8.0, 8.6), *a, *b]);
|
||||
}
|
||||
}
|
||||
if let (Some(first), Some(last)) = (pts.first(), pts.last()) {
|
||||
pen.fill(&[(8.0, 8.6), *last, *first]);
|
||||
}
|
||||
}
|
||||
Pen => {
|
||||
pen.closed(&[(8.0, 1.8), (12.0, 9.0), (8.0, 14.0), (4.0, 9.0)]);
|
||||
pen.dot(8.0, 8.6, 1.1);
|
||||
|
||||
Reference in New Issue
Block a user