1
0
mirror of https://github.com/emilk/egui.git synced 2026-08-30 05:10:03 -04:00

Expand plot axes thickness to fit their labels (#3921)

Expand the plot axis thickness as the contained plot axis labels get
wider.

This fixes a problem where the plot labels would otherwise get clipped.


![plot-axis-expansion](https://github.com/emilk/egui/assets/1148717/4500a26e-4a11-401d-9e8e-2d98d02ef3b7)
This commit is contained in:
Emil Ernerfeldt
2024-01-30 12:45:27 +01:00
committed by GitHub
parent 01597fe1a1
commit 527f4bfdf6
5 changed files with 332 additions and 268 deletions

View File

@@ -1,3 +1,5 @@
use std::collections::BTreeMap;
use egui::{ahash, Context, Id, Pos2, Vec2b};
use crate::{PlotBounds, PlotTransform};
@@ -23,6 +25,13 @@ pub struct PlotMemory {
/// Allows to remember the first click position when performing a boxed zoom
pub(crate) last_click_pos_for_zoom: Option<Pos2>,
/// The thickness of each of the axes the previous frame.
///
/// This is used in the next frame to make the axes thicker
/// in order to fit the labels, if necessary.
pub(crate) x_axis_thickness: BTreeMap<usize, f32>,
pub(crate) y_axis_thickness: BTreeMap<usize, f32>,
}
impl PlotMemory {