MCPcopy Create free account
hub / github.com/KebsCS/KBotExt / GetDraggedColumnOffset

Function GetDraggedColumnOffset

KBotExt/imgui/imgui_tables.cpp:3756–3771  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3754static const float COLUMNS_HIT_RECT_HALF_WIDTH = 4.0f;
3755
3756static float GetDraggedColumnOffset(ImGuiOldColumns* columns, int column_index)
3757{
3758 // Active (dragged) column always follow mouse. The reason we need this is that dragging a column to the right edge of an auto-resizing
3759 // window creates a feedback loop because we store normalized positions. So while dragging we enforce absolute positioning.
3760 ImGuiContext& g = *GImGui;
3761 ImGuiWindow* window = g.CurrentWindow;
3762 IM_ASSERT(column_index > 0); // We are not supposed to drag column 0.
3763 IM_ASSERT(g.ActiveId == columns->ID + ImGuiID(column_index));
3764
3765 float x = g.IO.MousePos.x - g.ActiveIdClickOffset.x + COLUMNS_HIT_RECT_HALF_WIDTH - window->Pos.x;
3766 x = ImMax(x, ImGui::GetColumnOffset(column_index - 1) + g.Style.ColumnsMinSpacing);
3767 if ((columns->Flags & ImGuiOldColumnFlags_NoPreserveWidths))
3768 x = ImMin(x, ImGui::GetColumnOffset(column_index + 1) - g.Style.ColumnsMinSpacing);
3769
3770 return x;
3771}
3772
3773float ImGui::GetColumnOffset(int column_index)
3774{

Callers 1

EndColumnsMethod · 0.85

Calls 2

ImMaxFunction · 0.85
ImMinFunction · 0.85

Tested by

no test coverage detected