MCPcopy Create free account
hub / github.com/danoon2/Boxedwine / GetDraggedColumnOffset

Function GetDraggedColumnOffset

lib/imgui/imgui_widgets.cpp:7346–7361  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

7344static const float COLUMNS_HIT_RECT_HALF_WIDTH = 4.0f;
7345
7346static float GetDraggedColumnOffset(ImGuiColumns* columns, int column_index)
7347{
7348 // Active (dragged) column always follow mouse. The reason we need this is that dragging a column to the right edge of an auto-resizing
7349 // window creates a feedback loop because we store normalized positions. So while dragging we enforce absolute positioning.
7350 ImGuiContext& g = *GImGui;
7351 ImGuiWindow* window = g.CurrentWindow;
7352 IM_ASSERT(column_index > 0); // We are not supposed to drag column 0.
7353 IM_ASSERT(g.ActiveId == columns->ID + ImGuiID(column_index));
7354
7355 float x = g.IO.MousePos.x - g.ActiveIdClickOffset.x + COLUMNS_HIT_RECT_HALF_WIDTH - window->Pos.x;
7356 x = ImMax(x, ImGui::GetColumnOffset(column_index - 1) + g.Style.ColumnsMinSpacing);
7357 if ((columns->Flags & ImGuiColumnsFlags_NoPreserveWidths))
7358 x = ImMin(x, ImGui::GetColumnOffset(column_index + 1) - g.Style.ColumnsMinSpacing);
7359
7360 return x;
7361}
7362
7363float ImGui::GetColumnOffset(int column_index)
7364{

Callers 1

EndColumnsMethod · 0.85

Calls 2

ImMaxFunction · 0.85
ImMinFunction · 0.85

Tested by

no test coverage detected