Window.fixed_size() et al. do not work
Using the fixed_size() method on a window makes it non-resizable, but the size of the window always conforms to the contents. The size passed to the method is completely ignored.
I did some digging and discovered that the issue is in the following condition: https://github.com/emilk/egui/blob/60fd70921df538c5cfab9918ddac1a2df5a06c66/egui/src/containers/resize.rs#L266-L277
Because the window is not resizable, it will not be given the requested size.
Unconditionally using the first branch seems to fix it, but I do not know what else might break.
Is there a workaround or fix for this? Thanks.
This workaround worked for me.
From looking at the file that @parasyte linked above, it seems like there's just a condition missing that checks whether the user has set fixed_size(). I'm happy to PR a fix if you'd like @emilk ?
From what I can tell, it looks like there are two options for fixing this that come down to how we want to express that fixed_size has been set:
- Check whether
default_size == min_size == max_size(might have to add tolerances for those since I think they're implemented in terms of f32s). This is the current definition, more or less, offixed_sizebased on thefixed_size()function. - Add a property to the struct for
fixed_sizethat gets set when it's called and then unset anytime thatdefault_size,min_size, ormax_sizeare changed.
In either case, we can just add the appropriate condition to the if statement mentioned above.
I'd opt for (1) as it's simpler and more consistent with the current code (and I can define a helper function is_fixed_size() that's consistent with this definition), but happy to do either. Just let me know if that works for you @emilk.
Any action on this one ?
@emilk, looks like the author can throw a PR together for this--do either of his approaches see acceptable?
I added my thoughts here (https://github.com/emilk/egui/discussions/5660) but then found this thread.
@barries Did you manage to do a PR for this?