mirror of
https://github.com/FliegendeWurst/cursive.git
synced 2024-11-23 17:35:00 +00:00
simplified offset calculation in dialogboxtitle
This commit is contained in:
parent
592ecf4c09
commit
f8e7427f75
@ -362,11 +362,8 @@ impl Dialog {
|
|||||||
if len + 4 > printer.size.x {
|
if len + 4 > printer.size.x {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
let x = match self.title_position {
|
let spacing = 3; //minimum distance to borders
|
||||||
HAlign::Left => 3,
|
let x = spacing + self.title_position.get_offset(len, printer.size.x - 2 * spacing);
|
||||||
HAlign::Center => (printer.size.x - len) / 2,
|
|
||||||
HAlign::Right => printer.size.x - len - 3,
|
|
||||||
};
|
|
||||||
printer.with_high_border(false, |printer| {
|
printer.with_high_border(false, |printer| {
|
||||||
printer.print((x - 2, 0), "┤ ");
|
printer.print((x - 2, 0), "┤ ");
|
||||||
printer.print((x + len, 0), " ├");
|
printer.print((x + len, 0), " ├");
|
||||||
|
Loading…
Reference in New Issue
Block a user