{"action":"created","issue":{"url":"https://api.github.com/repos/ocornut/imgui/issues/573","repository_url":"https://api.github.com/repos/ocornut/imgui","labels_url":"https://api.github.com/repos/ocornut/imgui/issues/573/labels{/name}","comments_url":"https://api.github.com/repos/ocornut/imgui/issues/573/comments","events_url":"https://api.github.com/repos/ocornut/imgui/issues/573/events","html_url":"https://github.com/ocornut/imgui/issues/573","id":145532999,"number":573,"title":"Scroll.y too large when shrinking child window. Possible solution(s) included.","user":{"login":"johanwendin","id":16607879,"avatar_url":"https://avatars.githubusercontent.com/u/16607879?v=3","gravatar_id":"","url":"https://api.github.com/users/johanwendin","html_url":"https://github.com/johanwendin","followers_url":"https://api.github.com/users/johanwendin/followers","following_url":"https://api.github.com/users/johanwendin/following{/other_user}","gists_url":"https://api.github.com/users/johanwendin/gists{/gist_id}","starred_url":"https://api.github.com/users/johanwendin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/johanwendin/subscriptions","organizations_url":"https://api.github.com/users/johanwendin/orgs","repos_url":"https://api.github.com/users/johanwendin/repos","events_url":"https://api.github.com/users/johanwendin/events{/privacy}","received_events_url":"https://api.github.com/users/johanwendin/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":14,"created_at":"2016-04-03T19:34:39Z","updated_at":"2016-04-03T20:26:37Z","closed_at":null,"body":"Greetings!\r\n\r\nWhen shrinking a child window, the child window's \"window->Scroll.y\" becomes \"ItemSpacing.y\" too large.\r\n\r\nThis is because of line 3752 (imgui.cpp, master branch - I've looked at commit 26be151 which is the current one when writing this) where window->SizeContents.y gets calculated like so:\r\n`(window->DC.CursorMaxPos.y - window->Pos.y) + window->Scroll.y;`\r\n\r\nHowever, \"CursorMaxPos.y\" will always be \"style.ItemSpacing.y\" bigger than it should, probably due to ImGui::ItemSize adding \"ItemSpacing.y\" to \"CursorPos\", resulting in an extra ItemSpacing.y at the very end.\r\n\r\nOne possible solution, although somewhat contrived would be to changing the line 3752 to:\r\n\r\n window->SizeContents.y = (float)(int)((window->SizeContentsExplicit.y != 0.0f) ? window->SizeContentsExplicit.y : ((window_is_new ? 0.0f : window->DC.CursorMaxPos.y **- style.ItemSpacing.y** - window->Pos.y) + window->Scroll.y));\r\n\r\nAnother, possibly better solution would probably be to just subtract ItemSpacing.y from CursorMaxPos.y inside \"ImGui::End\".   (I went for the latter locally)\r\n\r\nNote: The problem doesn't show itself if I resize while hovering the scrollbar. I haven't looked closer as to why, but my guess would be that \"CursorMaxPos.y\" gets updated to not include the itemspacing."},"comment":{"url":"https://api.github.com/repos/ocornut/imgui/issues/comments/205047863","html_url":"https://github.com/ocornut/imgui/issues/573#issuecomment-205047863","issue_url":"https://api.github.com/repos/ocornut/imgui/issues/573","id":205047863,"user":{"login":"ocornut","id":8225057,"avatar_url":"https://avatars.githubusercontent.com/u/8225057?v=3","gravatar_id":"","url":"https://api.github.com/users/ocornut","html_url":"https://github.com/ocornut","followers_url":"https://api.github.com/users/ocornut/followers","following_url":"https://api.github.com/users/ocornut/following{/other_user}","gists_url":"https://api.github.com/users/ocornut/gists{/gist_id}","starred_url":"https://api.github.com/users/ocornut/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ocornut/subscriptions","organizations_url":"https://api.github.com/users/ocornut/orgs","repos_url":"https://api.github.com/users/ocornut/repos","events_url":"https://api.github.com/users/ocornut/events{/privacy}","received_events_url":"https://api.github.com/users/ocornut/received_events","type":"User","site_admin":false},"created_at":"2016-04-03T20:26:37Z","updated_at":"2016-04-03T20:26:37Z","body":"Your first statement was\r\n> When shrinking a child window, the **child window's** \"window->Scroll.y\" becomes \"ItemSpacing.y\" too large.\r\n"}}