-
Notifications
You must be signed in to change notification settings - Fork 1
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
Math to prevent clipping in browser. #2
base: main
Are you sure you want to change the base?
Conversation
Some automatic styling as my IDE enforces that.
Some changes for warning the ide gives.
Interesting changes. Using |
Recording.2023-05-07.212243.mp4That's definitely something I didn't notice. Attached an example on how that looks a bit weird, as i'm pulling top handle, the bottom moves instead. But at least in your way the user decides which handle they pull and what happens. But your experience using it is probably correct. Notice I broke 100% and fit to frame. |
I wasn't able to replicate that with 1 edge touching, but with 2 edges touching I did run into it. Added a few lines that after doing centered re-scaling it will try to just pull in each corner if it's not yet sized correctly. |
That works great! I was using the |
I actually think the aspect ratio is going wrong. By zooming in a lot and using a different bounding box mode for easier visibility, I see that there is a bit where the error is horizontal, and a bit where the error is vertical. Best is an example: Recording.2023-05-17.230642.mp4So I don't think it's an rounding issue, but an issue with the aspect ratio. |
This is using math to make sure that any change does not first clip into the frame, and then afterwards get corrected.
This visually looks a bit better.
Some changes in the code for what my IDE automatically does in styling, some .tostring() === because the IDE complains about it.
I was making the changes mostly to see what I could do for the scaling issue.
As for the issue of image moving around when scaling;
Because OBS derives how the image is shown from the crop + size, different scalings show the image differently, as the cropping can only be as precise as one pixel, there is often no "correct" cropping to show the image the same between two scalings.