mirror of
https://github.com/gwm17/implot.git
synced 2024-11-23 02:38:53 -05:00
bandaid for zero formatting issues
This commit is contained in:
parent
67e0876f89
commit
b958abf459
|
@ -644,11 +644,16 @@ void ShowLegendEntries(ImPlotPlot& plot, const ImRect& legend_bb, bool interacta
|
||||||
// Tick Utils
|
// Tick Utils
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
#define BASICALLY_ZERO 1e-16
|
||||||
|
|
||||||
void LabelTickDefault(ImPlotTick& tick, ImGuiTextBuffer& buffer) {
|
void LabelTickDefault(ImPlotTick& tick, ImGuiTextBuffer& buffer) {
|
||||||
char temp[32];
|
char temp[32];
|
||||||
if (tick.ShowLabel) {
|
if (tick.ShowLabel) {
|
||||||
tick.TextOffset = buffer.size();
|
tick.TextOffset = buffer.size();
|
||||||
snprintf(temp, 32, "%.10g", tick.PlotPos);
|
if (ImAbs(tick.PlotPos) < BASICALLY_ZERO)
|
||||||
|
snprintf(temp, 32, "0");
|
||||||
|
else
|
||||||
|
snprintf(temp, 32, "%.10g", tick.PlotPos);
|
||||||
buffer.append(temp, temp + strlen(temp) + 1);
|
buffer.append(temp, temp + strlen(temp) + 1);
|
||||||
tick.LabelSize = ImGui::CalcTextSize(buffer.Buf.Data + tick.TextOffset);
|
tick.LabelSize = ImGui::CalcTextSize(buffer.Buf.Data + tick.TextOffset);
|
||||||
}
|
}
|
||||||
|
@ -3480,7 +3485,6 @@ void ShowColormapScale(double scale_min, double scale_max, float height) {
|
||||||
|
|
||||||
AddTicksDefault(range, 10, 0, ticks);
|
AddTicksDefault(range, 10, 0, ticks);
|
||||||
|
|
||||||
|
|
||||||
ImGuiContext &G = *GImGui;
|
ImGuiContext &G = *GImGui;
|
||||||
ImGuiWindow * Window = G.CurrentWindow;
|
ImGuiWindow * Window = G.CurrentWindow;
|
||||||
if (Window->SkipItems)
|
if (Window->SkipItems)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user