Skip to content

Suggestion: add possibility to affect popup fallback position policy #9045

@IceLuna

Description

@IceLuna

Version/Branch of Dear ImGui:

Version 1.92.4, Branch: docking

Back-ends:

imgui.cpp

Compiler, OS:

Win10, MSVC 2022

Full config/build information:

No response

Details:

Hi! I'm using imgui-node-editor and BeginCombo is rendered in the wrong position within the editor (see the first screenshot). And I found out that it's because fallback login inside in the end of FindBestWindowPosForPopupEx() (see the second screenshot). It tries to keep the position within bounds, but in the editor, coords can go out of the bounds. If I remove these two lines, it works as expected.

Is it possible to add an API to disable this fallback logic and make it return ref_pos without the clamp? I can implement it in my ImGui fork, but it'd be nice if it was official, hence the question if you think it's reasonable. I could probably prepare a PR myself, but I'm not sure how the API should look like.

Maybe something like?

ImGui::SetPopupSizeClampingEnabled(false); // Temporarily disable clamp within the editor
ImGui::BeginCombo();
ImGui::SetPopupSizeClampingEnabled(true); // Enable back

Screenshots/Video:

BeginCombo being rendered in the wrong position
Image

Image

Minimal, Complete and Verifiable Example code:

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions