| 1820 | //----------------------------------------------------------------------------- |
| 1821 | |
| 1822 | static inline void RenderGridLinesX(ImDrawList& DrawList, const ImPlotTicker& ticker, const ImRect& rect, ImU32 col_maj, ImU32 col_min, float size_maj, float size_min) { |
| 1823 | const float density = ticker.TickCount() / rect.GetWidth(); |
| 1824 | ImVec4 col_min4 = ImGui::ColorConvertU32ToFloat4(col_min); |
| 1825 | col_min4.w *= ImClamp(ImRemap(density, 0.1f, 0.2f, 1.0f, 0.0f), 0.0f, 1.0f); |
| 1826 | col_min = ImGui::ColorConvertFloat4ToU32(col_min4); |
| 1827 | for (int t = 0; t < ticker.TickCount(); t++) { |
| 1828 | const ImPlotTick& xt = ticker.Ticks[t]; |
| 1829 | if (xt.PixelPos < rect.Min.x || xt.PixelPos > rect.Max.x) |
| 1830 | continue; |
| 1831 | if (xt.Level == 0) { |
| 1832 | if (xt.Major) |
| 1833 | DrawList.AddLine(ImVec2(xt.PixelPos, rect.Min.y), ImVec2(xt.PixelPos, rect.Max.y), col_maj, size_maj); |
| 1834 | else if (density < 0.2f) |
| 1835 | DrawList.AddLine(ImVec2(xt.PixelPos, rect.Min.y), ImVec2(xt.PixelPos, rect.Max.y), col_min, size_min); |
| 1836 | } |
| 1837 | } |
| 1838 | } |
| 1839 | |
| 1840 | static inline void RenderGridLinesY(ImDrawList& DrawList, const ImPlotTicker& ticker, const ImRect& rect, ImU32 col_maj, ImU32 col_min, float size_maj, float size_min) { |
| 1841 | const float density = ticker.TickCount() / rect.GetHeight(); |