mirror of
https://github.com/a-b-street/abstreet.git
synced 2024-12-27 16:36:02 +03:00
draw_text_at centers the text box
This commit is contained in:
parent
3d40f7c91b
commit
2026acde32
@ -86,7 +86,9 @@ impl Canvas {
|
||||
}
|
||||
|
||||
pub fn draw_text_at(&self, g: &mut GfxCtx, txt: Text, pt: Pt2D) {
|
||||
text::draw_text_bubble(g, self.map_to_screen(pt), txt);
|
||||
let (width, height) = txt.dims(g);
|
||||
let (x, y) = self.map_to_screen(pt);
|
||||
text::draw_text_bubble(g, (x - (width / 2.0), y - (height / 2.0)), txt);
|
||||
}
|
||||
|
||||
pub fn draw_text(
|
||||
|
Loading…
Reference in New Issue
Block a user