Background:
I have a window that starts with a width of 240 pixels, some visual elements can only be displayed in a certain way at that width, however, resizing is allowed and should be allowed.
If someone decides to resize, then I will need some kind of “snap” to return to the original width. It would be painful / near impossible to require users to get accurate pixels to restore full visual effects.
Question: So, how can I do this, if they reach a certain distance (say, within 4 pixels) from 240 pixels in any direction, it will be tied to this width and resize to a different size only when the resize cursor deviates to 4 pixels wide.
Failed ideas: a game with several different things that set the window width to 240 with the sizeChanged event, if it is inside 4px, but since it is a size event, it will do the calculations after the window has already changed. this means that you get a really mutable effect when it changes to / by default width.
source
share