Skip to content

Keep rotated PPTX shapes inside their group's bbox#259

Merged
hackerwins merged 1 commit into
mainfrom
fix/pptx-rotated-child-group-scale
May 17, 2026
Merged

Keep rotated PPTX shapes inside their group's bbox#259
hackerwins merged 1 commit into
mainfrom
fix/pptx-rotated-child-group-scale

Conversation

@hackerwins

Copy link
Copy Markdown
Collaborator

Summary

  • applyGroupTransform previously scaled a child's unrotated w/h by the group's per-axis scales and ignored frame.rotation. For shapes with their own rotation living inside a <p:grpSp> whose chExt is sized for the rotated visual bbox (the standard PowerPoint / Google Slides emission), this produced shapes that overflowed their group. On slide 7 of a real customer deck, a 90°-rotated rightArrowCallout rendered ~503 px tall in a ~295 px slot and breached the rectangle above it.
  • Fix: solve a 2×2 linear system for new (w', h') such that the rotated rectangle's visual bbox matches the pre-import visual bbox scaled per-axis. Uniform-scale and zero-rotation cases short-circuit to the prior w*scaleX, h*scaleY (preserves all prior numerical behaviour). Singular determinants (45° + k·90°) and the negative-w'/h' regime (off-axis with sufficiently mismatched scale) fall back to per-axis scaling.
  • Three new unit tests: the slide-7 90° case using the exact EMU values, an off-axis (30°) solver test that exercises the general path with positive solutions, and a negative-fallback test that locks in the bail-out behaviour.

See docs/tasks/active/20260517-pptx-rotated-child-group-scale-todo.md and …-lessons.md for the full root-cause derivation and review-pass takeaways.

Test plan

  • pnpm verify:fast green (frontend 1268, slides 1006, backend 191, docs 792 tests).
  • All 8 group-transform unit tests pass, including the three new ones.
  • Manual smoke: re-import Yorkie, 캐즘 뛰어넘기.pptx, verify slide 7 arrow now fits inside its enclosing group. (Strong analytical evidence already in the 90° unit test, which uses the exact EMU values from slide 7.)
  • Regression watch: check that other rotated shapes inside groups across the rest of the deck still look correct.

🤖 Generated with Claude Code

@coderabbitai

coderabbitai Bot commented May 17, 2026

Copy link
Copy Markdown

Warning

Rate limit exceeded

@hackerwins has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 14 minutes and 18 seconds before requesting another review.

You’ve run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: f828253f-0b83-4008-9716-9dbed4120f31

📥 Commits

Reviewing files that changed from the base of the PR and between 1ba9b3f and 3c7b73d.

📒 Files selected for processing (4)
  • docs/tasks/active/20260517-pptx-rotated-child-group-scale-lessons.md
  • docs/tasks/active/20260517-pptx-rotated-child-group-scale-todo.md
  • packages/slides/src/import/pptx/group.ts
  • packages/slides/test/import/pptx/group.test.ts
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/pptx-rotated-child-group-scale

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

When PowerPoint / Google Slides emit a `<p:grpSp>` containing a
shape with its own `<a:xfrm rot>`, the group's `<a:chExt>` is sized
for the **rotated visual** bbox of the children, not the unrotated
`<a:ext>` of each child. The previous importer applied the group's
per-axis scale directly to the child's unrotated `w`/`h` and ignored
`frame.rotation`, which works for 0°/180° rotations but visually
misshapes 90°/270° (and any non-axis-aligned) children — they end
up scaled along the wrong axes and overflow the group.

On slide 7 of a real deck, a 90°-rotated `rightArrowCallout` ended
up ~503 px tall in a ~295 px slot, breaching the rectangle above it.

`applyGroupTransform` now solves a 2×2 linear system to find new
`(w', h')` such that the rotated rectangle's visual bbox matches the
pre-import visual bbox scaled per-axis. Uniform-scale / zero-rotation
cases short-circuit to the prior `w*scaleX`, `h*scaleY` and preserve
existing numerical behaviour. Singular determinants (45° + k·90°)
and the negative-w'/h' regime (off-axis with sufficiently mismatched
scale) fall back to per-axis scaling — no rotated rectangle can
satisfy both visual extents in those cases.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
@hackerwins
hackerwins force-pushed the fix/pptx-rotated-child-group-scale branch from fbb787a to 3c7b73d Compare May 17, 2026 13:41
@github-actions

github-actions Bot commented May 17, 2026

Copy link
Copy Markdown
Contributor

Verification: verify:self

Result: ✅ PASS in 211.8s

Lane Status Duration
sheets:build ✅ pass 13.3s
docs:build ✅ pass 12.5s
slides:build ✅ pass 13.1s
verify:fast ✅ pass 125.1s
frontend:build ✅ pass 19.2s
verify:frontend:chunks ✅ pass 0.3s
backend:build ✅ pass 5.0s
cli:build ✅ pass 2.2s
verify:entropy ✅ pass 21.0s

Verification: verify:integration

Result: ✅ PASS

@hackerwins
hackerwins merged commit aa056f3 into main May 17, 2026
1 check passed
@hackerwins
hackerwins deleted the fix/pptx-rotated-child-group-scale branch May 17, 2026 13:46
@codecov

codecov Bot commented May 17, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

hackerwins added a commit that referenced this pull request May 18, 2026
These seven slides + PPTX tasks shipped (PRs #238, #240, #241, #255,
#259, #260, #261) but their checklist boxes were never ticked during
execution, so the archive script left them in active/. Sweep the
checkboxes to reflect what actually landed, add lessons files for the
two that were missing (keyboard-shortcuts, presentation-mode), and
convert the keyboard-shortcuts onLinkRequest popover bullet from a
checkbox to a "Deferred (follow-up)" note so the gate stops blocking on
work that is intentionally out of scope.

Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant