Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion crates/ui-egui/src/fill_editor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -530,7 +530,7 @@ pub(crate) fn preview(p: &egui::Painter, r: Rect, fills: &[FillLayer], base: &Sy
let x = r.min.x + (col as f32 + 0.5) * dx + if row.rem_euclid(2) == 1 { shift[0] } else { 0.0 };
let y = r.min.y + (row as f32 + 0.5) * dy + if col.rem_euclid(2) == 1 { shift[1] } else { 0.0 };
match &image {
Some(image) => image.paint(&p, pos2(x, y), size.max(1.0)),
Some(image) => image.paint(&p, pos2(x, y), size.max(1.0), 0.0),
None => {
p.circle_filled(pos2(x, y), (size / 2.0).max(0.5), c);
}
Expand Down
13 changes: 10 additions & 3 deletions crates/ui-egui/src/markerimages.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,17 @@ pub(crate) struct Image {
impl Image {
/// Paints the image whole within the `side` × `side` square centred on `at`, in its
/// proportions: its longer side is `side` (the map draws it `side` wide, but a tall image
/// would leave a legend's row). Not turned: previews show no rotation.
pub(crate) fn paint(&self, p: &egui::Painter, at: Pos2, side: f32) {
/// would leave a legend's row), turned `turn` radians clockwise about `at`, as the map turns it.
pub(crate) fn paint(&self, p: &egui::Painter, at: Pos2, side: f32, turn: f32) {
let uv = Rect::from_min_max(pos2(0.0, 0.0), pos2(1.0, 1.0));
p.image(self.texture.id(), fitted(at, side, self.aspect), uv, Color32::WHITE);
if turn == 0.0 {
p.image(self.texture.id(), fitted(at, side, self.aspect), uv, Color32::WHITE);
return;
}
let mut mesh = egui::Mesh::with_texture(self.texture.id());
mesh.add_rect_with_uv(fitted(at, side, self.aspect), uv, Color32::WHITE);
mesh.rotate(egui::emath::Rot2::from_angle(turn), at);
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Resolved
p.add(mesh);
}
}

Expand Down
Loading
Loading