Description
Problem
partition_pptx()
excludes "off-slide" shapes from partitioning. However, it only detects off-slide shapes that are to the left or above the slide. Shapes can also be off-slide to the right or bottom of the slide.
Also, only the top-left corner of the shape is considered; when that corner is off-slide the shape is excluded. An off-slide corner can occur in the normal course of authoring when a shape is placed close to or marginally over a slide edge for layout purposes (full-bleed image for example), so this simple approach can easily produce false positives.
Solution
Include shapes that are off-slide to the right and bottom.
Refine the is_off_slide()
computation to consider the width and height of the shape and only consider it off-slide when a certain adjustable threshold proportion (say 75%) of the shapes's area is outside the slide boundaries.
Context
A slide author can place a shape "off-slide" such that the shape does not appear when the slide is presented or printed, but remains on the "pasteboard" when the presentation is saved. Doing so can be handy for preserving a shape the author might need later or a pre-formated "template" shape that is used as a starting point for others on the slide.
However, it is not uncommon for an author to scoot a shape partially off the slide to achieve alignment or a certain "look" when they don't understand (or care) how to adjust the shape margins or cropping. Such a shape is automatically cropped to the slide boundaries at presentation or printing time.