-
-
Notifications
You must be signed in to change notification settings - Fork 10.9k
Make a movable windows that follows the viewer transforms #1604
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Hello Jérémie, Some thoughts out of my heads (I haven't digged much):
|
Hi Omar, Thanks for the suggestions! In the meantime I found out about ImGuizmo and ended up using it (adapting the code for 2D), as it fits my need perfectly in this case. So I think there is no point in me trying to implement the cache mechanism you suggest. Feel free to close this issue! |
Cool, closing. Depending on what you were doing, if it is something like ImGuiGizmo where you just draw stuff over the scene, it may be simpler to create a fullscreen window (pos = 0,0, size = io.DisplaySize) with the |
I wanted a gizmo to position a box in my scene, so I needed interactions too! (I'm already using a transparent window to draw text labels on my scene :p) |
Hi,
I am trying to draw a window that follows an object in a 2D viewer. I want the window to follow my object when I pan/zoom the viewer (it needs to scale/move accordingly). Moreover, I want that the user be able to move/resize the window when he is not changing the viewer transform. I am currently struggling to achieve that under the current API of ImGui.
My current approach is as follows:
ImGui::SetNextWindowPos()
andImGui::SetNextWindowSize()
according to the transformed window corner in screen space.ImGui::Begin()/ImGui::End()
, retrieve the window coordinate and size from ImGui (maybe the user has moved/resized the window).I am not sure this is the best approach, since I am not very familiar with the internals of ImGui. I currently have two problems with this procedure:
imgui.h
only offers to set the window position/size with integer coordinates. So going back and forth with the world-space floatting point position makes the window "drift away" under repeated zoom/pan of the viewer.ImGui::SetNextWindowPos()
at every frame). If I set the position withImGui::SetWindowPos()
inside theBegin/End
, on the condition that the window is not focused, then the user can also move the window. But then the window also "lags behind" when I update the viewer transform, so it's doesn't look so smooth.It seems that I am making my life complicated for no reason, and maybe I shouldn't use ImGui for doing this. But if you have any advice on how these kind of things should be done, I would be glad to hear it.
The text was updated successfully, but these errors were encountered: