mirror of https://codeberg.org/topola/topola.git
egui: give 20% margin from each side when zooming to fit
This commit is contained in:
parent
a31bb43791
commit
92f82ff332
|
|
@ -299,9 +299,9 @@ impl Viewport {
|
||||||
if root_bbox_width / root_bbox_height
|
if root_bbox_width / root_bbox_height
|
||||||
>= (viewport_rect.width() as f64) / (viewport_rect.height() as f64)
|
>= (viewport_rect.width() as f64) / (viewport_rect.height() as f64)
|
||||||
{
|
{
|
||||||
self.transform.scaling = viewport_rect.width() / root_bbox_width as f32;
|
self.transform.scaling = 0.8 * viewport_rect.width() / root_bbox_width as f32;
|
||||||
} else {
|
} else {
|
||||||
self.transform.scaling = viewport_rect.height() / root_bbox_height as f32;
|
self.transform.scaling = 0.8 * viewport_rect.height() / root_bbox_height as f32;
|
||||||
}
|
}
|
||||||
|
|
||||||
self.transform.translation = egui::Vec2::new(
|
self.transform.translation = egui::Vec2::new(
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue