提交 e5c457b3 编辑于 作者: epezent's avatar epezent
浏览文件

tidy up selection/query code, add new methods

显示 14 个添加7 个删除
+14 -7
......@@ -1281,6 +1281,17 @@ void UpdateAxisColors(int axis_flag, ImPlotAxis* axis) {
axis->ColorTxt = ImGui::GetColorU32(col_label);
}
//-----------------------------------------------------------------------------
// RENDERING
//-----------------------------------------------------------------------------
static inline void RenderSelectionRect(ImDrawList& DrawList, const ImVec2& p_min, const ImVec2& p_max, const ImVec4& col) {
const ImU32 col_bg = ImGui::GetColorU32(col * ImVec4(1,1,1,0.25f));
const ImU32 col_bd = ImGui::GetColorU32(col);
DrawList.AddRectFilled(p_min, p_max, col_bg);
DrawList.AddRect(p_min, p_max, col_bd);
}
//-----------------------------------------------------------------------------
// BeginPlot()
//-----------------------------------------------------------------------------
......@@ -2342,13 +2353,9 @@ void EndPlot() {
DrawList.AddText(pos + gp.Style.AnnotationPadding, an.ColorFg, txt);
}
// render selection
if (plot.Selected) {
const ImVec4 col = GetStyleColorVec4(ImPlotCol_Selection);
const ImU32 col_bg = ImGui::GetColorU32(col * ImVec4(1,1,1,0.25f));
const ImU32 col_bd = ImGui::GetColorU32(col);
DrawList.AddRectFilled(plot.SelectRect.Min + plot.PlotRect.Min, plot.SelectRect.Max + plot.PlotRect.Min, col_bg);
DrawList.AddRect( plot.SelectRect.Min + plot.PlotRect.Min, plot.SelectRect.Max + plot.PlotRect.Min, col_bd);
}
if (plot.Selected)
RenderSelectionRect(DrawList, plot.SelectRect.Min + plot.PlotRect.Min, plot.SelectRect.Max + plot.PlotRect.Min, GetStyleColorVec4(ImPlotCol_Selection));
// render query
if (plot.Queried) {
const ImVec4 col = GetStyleColorVec4(ImPlotCol_Query);
......
支持 Markdown
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册