MCPcopy Create free account
hub / github.com/MrDrElliot/LuminaEngine / SubplotSetCell

Function SubplotSetCell

Engine/Source/ThirdParty/imgui/implot.cpp:3277–3316  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3275static const float SUBPLOT_SPLITTER_FEEDBACK_TIMER = 0.06f;
3276
3277void SubplotSetCell(int row, int col) {
3278 ImPlotContext& gp = *GImPlot;
3279 ImPlotSubplot& subplot = *gp.CurrentSubplot;
3280 if (row >= subplot.Rows || col >= subplot.Cols)
3281 return;
3282 float xoff = 0;
3283 float yoff = 0;
3284 for (int c = 0; c < col; ++c)
3285 xoff += subplot.ColRatios[c];
3286 for (int r = 0; r < row; ++r)
3287 yoff += subplot.RowRatios[r];
3288 const ImVec2 grid_size = subplot.GridRect.GetSize();
3289 ImVec2 cpos = subplot.GridRect.Min + ImVec2(xoff*grid_size.x,yoff*grid_size.y);
3290 cpos.x = IM_ROUND(cpos.x);
3291 cpos.y = IM_ROUND(cpos.y);
3292 ImGui::GetCurrentWindow()->DC.CursorPos = cpos;
3293 // set cell size
3294 subplot.CellSize.x = IM_ROUND(subplot.GridRect.GetWidth() * subplot.ColRatios[col]);
3295 subplot.CellSize.y = IM_ROUND(subplot.GridRect.GetHeight() * subplot.RowRatios[row]);
3296 // setup links
3297 const bool lx = ImHasFlag(subplot.Flags, ImPlotSubplotFlags_LinkAllX);
3298 const bool ly = ImHasFlag(subplot.Flags, ImPlotSubplotFlags_LinkAllY);
3299 const bool lr = ImHasFlag(subplot.Flags, ImPlotSubplotFlags_LinkRows);
3300 const bool lc = ImHasFlag(subplot.Flags, ImPlotSubplotFlags_LinkCols);
3301
3302 SetNextAxisLinks(ImAxis_X1, lx ? &subplot.ColLinkData[0].Min : lc ? &subplot.ColLinkData[col].Min : nullptr,
3303 lx ? &subplot.ColLinkData[0].Max : lc ? &subplot.ColLinkData[col].Max : nullptr);
3304 SetNextAxisLinks(ImAxis_Y1, ly ? &subplot.RowLinkData[0].Min : lr ? &subplot.RowLinkData[row].Min : nullptr,
3305 ly ? &subplot.RowLinkData[0].Max : lr ? &subplot.RowLinkData[row].Max : nullptr);
3306 // setup alignment
3307 if (!ImHasFlag(subplot.Flags, ImPlotSubplotFlags_NoAlign)) {
3308 gp.CurrentAlignmentH = &subplot.RowAlignmentData[row];
3309 gp.CurrentAlignmentV = &subplot.ColAlignmentData[col];
3310 }
3311 // set idx
3312 if (ImHasFlag(subplot.Flags, ImPlotSubplotFlags_ColMajor))
3313 subplot.CurrentIdx = col * subplot.Rows + row;
3314 else
3315 subplot.CurrentIdx = row * subplot.Cols + col;
3316}
3317
3318void SubplotSetCell(int idx) {
3319 ImPlotContext& gp = *GImPlot;

Callers 2

SubplotNextCellFunction · 0.85
BeginSubplotsFunction · 0.85

Calls 7

GetCurrentWindowFunction · 0.85
ImHasFlagFunction · 0.85
SetNextAxisLinksFunction · 0.85
ImVec2Function · 0.70
GetSizeMethod · 0.45
GetWidthMethod · 0.45
GetHeightMethod · 0.45

Tested by

no test coverage detected