Compare commits

...

3 commits

Author SHA1 Message Date
Emil Ernerfeldt
c3dd6dbe89 Merge fix 2022-10-02 08:48:37 +02:00
Emil Ernerfeldt
e3f3410e1a Merge branch 'master' into data_aspect 2022-10-02 08:46:54 +02:00
Saecki
05d68d26bd fix: default to changing y axis when changing data aspect 2022-09-26 17:49:49 +02:00

View file

@ -79,6 +79,13 @@ struct AxisBools {
y: bool, y: bool,
} }
impl AxisBools {
#[inline]
pub fn any(&self) -> bool {
self.x || self.y
}
}
impl From<bool> for AxisBools { impl From<bool> for AxisBools {
fn from(val: bool) -> Self { fn from(val: bool) -> Self {
AxisBools { x: val, y: val } AxisBools { x: val, y: val }
@ -843,8 +850,10 @@ impl Plot {
if let Some(linked_axes) = &linked_axes { if let Some(linked_axes) = &linked_axes {
let change_x = linked_axes.link_y && !linked_axes.link_x; let change_x = linked_axes.link_y && !linked_axes.link_x;
transform.set_aspect_by_changing_axis(data_aspect as f64, change_x); transform.set_aspect_by_changing_axis(data_aspect as f64, change_x);
} else { } else if auto_bounds.any() {
transform.set_aspect_by_expanding(data_aspect as f64); transform.set_aspect_by_expanding(data_aspect as f64);
} else {
transform.set_aspect_by_changing_axis(data_aspect as f64, false);
} }
} }