web-stories-wp
web-stories-wp copied to clipboard
Video Cropping: Handle element rotation
Feature Description
PR #12156 handles off-screen cropping but not for rotated elements
Per
Would be nice to cater for element rotation here as well. Maybe in a follow-up, but I think we can avoid using custom checks for each side of the element here. Basically calculating the area of two overlapping rectangles.
This issue covers added detection for rotated off-canvas elements
https://github.com/GoogleForCreators/web-stories-wp/pull/12156#discussion_r959410395
Alternatives Considered
Additional Context
Related: #8715
Som example cases that would need to be covered when having to crop off-screen parts of a video:
@miina Do we have any existing utils to help calculate this? Perhaps with SAT?
https://www.npmjs.com/package/sat#satresponse - this is the information we get when testing two polygons colliding, looks like currently it doesn't reveal the collision points. Also found this issue in the repo with a link to an article about how to potentially get those points (didn't have time to check the link in detail right now): https://github.com/jriecken/sat-js/issues/63