Skip to content

Commit

Permalink
GUI: display chevrons if macro values out of view
Browse files Browse the repository at this point in the history
  • Loading branch information
tildearrow committed Oct 30, 2023
1 parent a9f77a3 commit 83c4d5b
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion src/gui/plot_nolerp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
}
}

Expand Down

0 comments on commit 83c4d5b

Please sign in to comment.