1
0
Fork 0
mirror of https://github.com/gwm17/implot.git synced 2024-11-22 18:28:53 -05:00

bandaid for zero formatting issues

This commit is contained in:
epezent 2021-03-03 09:10:33 -06:00
parent 67e0876f89
commit b958abf459

View File

@ -644,11 +644,16 @@ void ShowLegendEntries(ImPlotPlot& plot, const ImRect& legend_bb, bool interacta
// Tick Utils
//-----------------------------------------------------------------------------
#define BASICALLY_ZERO 1e-16
void LabelTickDefault(ImPlotTick& tick, ImGuiTextBuffer& buffer) {
char temp[32];
if (tick.ShowLabel) {
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);
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);
ImGuiContext &G = *GImGui;
ImGuiWindow * Window = G.CurrentWindow;
if (Window->SkipItems)