Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This PR adds a customizable square grid feature to improve source alignment within the preview.
The grid settings offer a range of options, including defining grid visibility, adjusting grid size using unit values, and optionally snapping sources to the grid for precise positioning. Grid visibility options include being always visible, never visible, or only visible when moving a source. Additionally, the existing snapping sensitivity setting can be used to fine-tune the grid snapping behavior, making it more or less tolerant to movement. Grid snapping can also be used in combination with the previously existing snapping features to make sources snap to grid lines, center lines and preview borders.
Grids are implemented using dotted lines featuring three distinct dot types: single pixels, 5-pixel crosses, and 9-pixel squares. The selection of dot types and the dot density between each grid line adapts dynamically based on the chosen preview size and grid spacing to preserve overall visibility.
This PR also introduces the possibility to personalize the grid color in the accessibility menu to better accommodate to users' preferences.
OBS.recording.mp4
Motivation and Context
These changes provide an implementation for a highly requested feature on the ideas page: https://ideas.obsproject.com/posts/329/grid-for-positioning
How Has This Been Tested?
Manual testing involved aligning various source types with the preview grid and exploring different combinations of grid visibility settings. The snapping behaviour was tested across various grid sizes and grid sensitivities, using varied sources and preview window dimensions. We also tested grid snapping by displacing sources in different directions and resizing them, confirming their alignment with the nearest grid line. Different colors were used for the grid throughout the testing process to ensure that the accessibility menu is working as expected. Finally, performance evaluations were conducted using multiple and various sources and grid spacings to ensure that the grid rendering does not affect the overall performance of the app.
Testing environment
Windows 11 23H2 (OS Build 22631.3447), 1920x1080 laptop screen
Types of changes
Checklist: