Skip to content
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

Windows with (0,0) size should fit content #62

Closed
ebriney opened this issue Oct 25, 2014 · 6 comments
Closed

Windows with (0,0) size should fit content #62

ebriney opened this issue Oct 25, 2014 · 6 comments

Comments

@ebriney
Copy link

ebriney commented Oct 25, 2014

It's strange to get a window without any content with null size.

And I didn't find any method to adjust window size to fit his content !

@ocornut
Copy link
Owner

ocornut commented Oct 25, 2014

Could you clarify what you are reporting with code sample and a screenshot?

At the time of first creating a window with (0,0) size the window should automatically readjust to content size by gathering the maximum content frame over the next frame or two.
Double-clicking on a lower-right corner also fit the window.

However note that if your code is using window size to size widgets then auto-fitting create a feedback loop, so every auto-fitting will slightly readjust the window size.

@ebriney
Copy link
Author

ebriney commented Oct 25, 2014

Perhaps this is because my window has the ImGuiWindowFlags_NoResize flags indeed.

@ocornut
Copy link
Owner

ocornut commented Oct 25, 2014

Correct! It currently skips all resizing behaviors with ImGuiWindowFlags_NoResize. Perhaps I should add a separate flag to distinguish manual user resize from initial auto-fit resize. Would you like that?

@ebriney
Copy link
Author

ebriney commented Oct 25, 2014

A flag is ok, but you should assert if size <= 0 or set this flag.

@ocornut
Copy link
Owner

ocornut commented Oct 26, 2014

I made it that (0,0) perform auto-sizing even on a window with NoResize flag.
Also added a SetWindowSize() entry point.
Let me know if it's alright for you.

@ocornut ocornut closed this as completed Oct 26, 2014
@ocornut
Copy link
Owner

ocornut commented May 2, 2015

FYI I reorganised the Begin() functions which was full of traps (subtle ordering dependencies). It should be better and healthier now but there is the possibility that I've created bugs or changes of behavior related to window size. Let me know if you notice anything unusual.

The changes are spread over many commits ending with this
d84b573
(spreading them should make it easier to bissect for bugs shall we need to)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants