web-stories-wp icon indicating copy to clipboard operation
web-stories-wp copied to clipboard

Video Cropping: Handle element rotation

Open timarney opened this issue 2 years ago • 3 comments

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

timarney avatar Sep 01 '22 11:09 timarney

Related: #8715

swissspidy avatar Sep 02 '22 12:09 swissspidy

Som example cases that would need to be covered when having to crop off-screen parts of a video:

Screenshot 2022-09-20 at 14 00 57

Screenshot 2022-09-20 at 14 00 01

@miina Do we have any existing utils to help calculate this? Perhaps with SAT?

swissspidy avatar Sep 20 '22 12:09 swissspidy

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

miina avatar Sep 21 '22 14:09 miina