GUI: display chevrons if macro values out of view

This commit is contained in:
tildearrow 2023-10-29 19:43:41 -05:00
parent a9f77a3ff7
commit 83c4d5ba97

View file

@ -394,6 +394,8 @@ int PlotCustomEx(ImGuiPlotType plot_type, const char* label, float (*values_gett
window->DrawList->AddLine(ImLerp(inner_bb.Min,inner_bb.Max,ImVec2(0.0f,histogram_zero_line_t)),ImLerp(inner_bb.Min,inner_bb.Max,ImVec2(1.0f,histogram_zero_line_t)),col_base);
}
ImVec2 chevron[3];
for (int n = 0; n < res_w; n++)
{
const float t1 = t0 + t_step;
@ -421,11 +423,30 @@ int PlotCustomEx(ImGuiPlotType plot_type, const char* label, float (*values_gett
if (values_highlight!=NULL) {
if (values_highlight[v1_idx]) rCol=ImGui::GetColorU32(highlightColor);
}
window->DrawList->AddRectFilled(pos0, pos1, rCol);
if (blockMode) {
if ((int)v0>=(int)(scale_max+0.5)) {
float chScale=(pos1.x-pos0.x)*0.125;
chevron[0]=ImVec2(pos0.x+(pos1.x-pos0.x)*0.25,pos1.y+4.0f*chScale);
chevron[1]=ImVec2(pos0.x+(pos1.x-pos0.x)*0.5,pos1.y+2.0f*chScale);
chevron[2]=ImVec2(pos0.x+(pos1.x-pos0.x)*0.75,pos1.y+4.0f*chScale);
window->DrawList->AddPolyline(chevron, 3, rCol, 0, chScale);
} else if ((int)v0<(int)(scale_min)) {
float chScale=(pos1.x-pos0.x)*0.125;
chevron[0]=ImVec2(pos0.x+(pos1.x-pos0.x)*0.25,pos1.y-4.0f*chScale);
chevron[1]=ImVec2(pos0.x+(pos1.x-pos0.x)*0.5,pos1.y-2.0f*chScale);
chevron[2]=ImVec2(pos0.x+(pos1.x-pos0.x)*0.75,pos1.y-4.0f*chScale);
window->DrawList->AddPolyline(chevron, 3, rCol, 0, chScale);
} else {
window->DrawList->AddRectFilled(pos0, pos1, rCol);
}
} else {
window->DrawList->AddRectFilled(pos0, pos1, rCol);
}
}
t0 = t1;
tp0 = tp1;
v0 = v1;
}
}