mirror of
https://github.com/gwm17/implot.git
synced 2024-11-23 02:38:53 -05:00
temp fix for time formatted mouse position text
This commit is contained in:
parent
8c53333489
commit
1fed5c2c19
12
implot.cpp
12
implot.cpp
|
@ -1563,9 +1563,21 @@ static inline double RoundAxisValue(const ImPlotAxis& axis, double value) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void LabelAxisValue(const ImPlotAxis& axis, double value, char* buff, int size, bool round) {
|
void LabelAxisValue(const ImPlotAxis& axis, double value, char* buff, int size, bool round) {
|
||||||
|
ImPlotContext& gp = *GImPlot;
|
||||||
|
// TODO: We shouldn't explicitly check that the axis is Time here. Ideally,
|
||||||
|
// Formatter_Time would handle the formatting for us, but the code below
|
||||||
|
// needs additional arguments which are not currently available in ImPlotFormatter
|
||||||
|
if (axis.Locator == Locator_Time) {
|
||||||
|
ImPlotTimeUnit unit = axis.Vertical
|
||||||
|
? GetUnitForRange(axis.Range.Size() / (gp.CurrentPlot->PlotRect.GetHeight() / 100)) // TODO: magic value!
|
||||||
|
: GetUnitForRange(axis.Range.Size() / (gp.CurrentPlot->PlotRect.GetWidth() / 100)); // TODO: magic value!
|
||||||
|
FormatDateTime(ImPlotTime::FromDouble(value), buff, size, GetDateTimeFmt(TimeFormatMouseCursor, unit));
|
||||||
|
}
|
||||||
|
else {
|
||||||
if (round)
|
if (round)
|
||||||
value = RoundAxisValue(axis, value);
|
value = RoundAxisValue(axis, value);
|
||||||
axis.Formatter(value, buff, size, axis.FormatterData);
|
axis.Formatter(value, buff, size, axis.FormatterData);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void UpdateAxisColors(ImPlotAxis& axis) {
|
void UpdateAxisColors(ImPlotAxis& axis) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user