mirror of
https://github.com/gwm17/implot.git
synced 2024-11-22 18:28:53 -05:00
Center constant data when fitting. (#154)
Co-authored-by: Yan Zaretskiy <yzaretskiy@stoneridgetechnology.com>
This commit is contained in:
parent
4af202a988
commit
9b5adca5f1
|
@ -2393,8 +2393,8 @@ void EndPlot() {
|
|||
if (!ImHasFlag(plot.XAxis.Flags, ImPlotAxisFlags_LockMax) && !ImNanOrInf(gp.ExtentsX.Max))
|
||||
plot.XAxis.Range.Max = (gp.ExtentsX.Max);
|
||||
if (ImAlmostEqual(plot.XAxis.Range.Max, plot.XAxis.Range.Min)) {
|
||||
plot.XAxis.Range.Max += plot.XAxis.Range.Max * 1.01;
|
||||
plot.XAxis.Range.Min -= plot.XAxis.Range.Max * 1.01;
|
||||
plot.XAxis.Range.Max += 0.5;
|
||||
plot.XAxis.Range.Min -= 0.5;
|
||||
}
|
||||
plot.XAxis.Constrain();
|
||||
if (axis_equal && !gp.FitY[0])
|
||||
|
@ -2410,8 +2410,8 @@ void EndPlot() {
|
|||
if (!ImHasFlag(plot.YAxis[i].Flags, ImPlotAxisFlags_LockMax) && !ImNanOrInf(gp.ExtentsY[i].Max))
|
||||
plot.YAxis[i].Range.Max = (gp.ExtentsY[i].Max);
|
||||
if (ImAlmostEqual(plot.YAxis[i].Range.Max, plot.YAxis[i].Range.Min)) {
|
||||
plot.YAxis[i].Range.Max += plot.YAxis[i].Range.Max * 1.01;
|
||||
plot.YAxis[i].Range.Min -= plot.YAxis[i].Range.Max * 1.01;
|
||||
plot.YAxis[i].Range.Max += 0.5;
|
||||
plot.YAxis[i].Range.Min -= 0.5;
|
||||
}
|
||||
plot.YAxis[i].Constrain();
|
||||
if (i == 0 && axis_equal && !gp.FitX)
|
||||
|
|
Loading…
Reference in New Issue
Block a user