MCPcopy Create free account
hub / github.com/RenderKit/embree / GetDraggedColumnOffset

Function GetDraggedColumnOffset

tutorials/common/imgui/imgui_tables.cpp:3702–3717  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3700static const float COLUMNS_HIT_RECT_HALF_WIDTH = 4.0f;
3701
3702static float GetDraggedColumnOffset(ImGuiOldColumns* columns, int column_index)
3703{
3704 // Active (dragged) column always follow mouse. The reason we need this is that dragging a column to the right edge of an auto-resizing
3705 // window creates a feedback loop because we store normalized positions. So while dragging we enforce absolute positioning.
3706 ImGuiContext& g = *GImGui;
3707 ImGuiWindow* window = g.CurrentWindow;
3708 IM_ASSERT(column_index > 0); // We are not supposed to drag column 0.
3709 IM_ASSERT(g.ActiveId == columns->ID + ImGuiID(column_index));
3710
3711 float x = g.IO.MousePos.x - g.ActiveIdClickOffset.x + COLUMNS_HIT_RECT_HALF_WIDTH - window->Pos.x;
3712 x = ImMax(x, ImGui::GetColumnOffset(column_index - 1) + g.Style.ColumnsMinSpacing);
3713 if ((columns->Flags & ImGuiOldColumnFlags_NoPreserveWidths))
3714 x = ImMin(x, ImGui::GetColumnOffset(column_index + 1) - g.Style.ColumnsMinSpacing);
3715
3716 return x;
3717}
3718
3719float ImGui::GetColumnOffset(int column_index)
3720{

Callers 1

EndColumnsMethod · 0.85

Calls 2

ImMaxFunction · 0.85
ImMinFunction · 0.85

Tested by

no test coverage detected