-
-
Notifications
You must be signed in to change notification settings - Fork 9k
frontend: Improve preview source snapping #12298
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
base: master
Are you sure you want to change the base?
Conversation
PatTheMav
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Functionally this PR is fine, but it seems very brute force and not particularly efficient to me and falls victim to "featuritis", just piling on little features one by one, each doing its own thing in isolation with no regard to other (similar) features and the architecture behind it.
Preview control drawing should be a single process, by a single responsible entity in code that knows about all of its "features" and thus set up a single render pass to draw all the pieces it knows should be visible for any given frame.
| if (centerSnap && fabsf(screenSize.y - (br.y - tl.y)) > clampDist && | ||
| fabsf(screenSize.y / 2.0f - centerY) < clampDist) | ||
| clampOffset.y = screenSize.y / 2.0f - centerY; | ||
| if (screenSnap) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if it wouldn't be easier to just calculate the vector between the source's centre point and the screen edges and check which vector has the shortest distance (that eliminates 2 edges at once) and then check the x and y parts of the vector (that give you the actual edge).
Using dot product there's probably also a way to do this with common vector math even.
Given that the current code does this the "brute force" way and the PR just extends that, it's probably fine, but I wish this were more elegant.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've made this at least a little bit more elegant.
Description
This PR makes a number of changes to source snapping in the preview:
Additionally
obs64_wuvM7eemGG.mp4
Motivation and Context
I want to improve source snapping behaviour and visual feedback
How Has This Been Tested?
Moved a bunch of sources around. Toggles relevant snapping settings on and off to ensure behaviour matched settings.
Types of changes
Checklist: