ly-wang19 6d1fd2babb
fix(export): compute SVG path bounding box via getBounds() (#656)
getSvgPathRange rolled its own bbox by reading x/y off every command and
defaulting missing coordinates to 0. That:
- injected a spurious (0,0) for Z/close (no x/y), stretching any glyph that
  doesn't touch the origin;
- injected a 0 on the missing axis for H/V commands;
- treated relative-command deltas as absolute coordinates (the parser does
  not normalise to absolute), producing a completely wrong box;
- ignored arc bulge, giving e.g. a semicircle zero extent on its bulge axis.

These bounds feed the viewBox of the LaTeX -> SVG-image fallback in the PPTX
export (use-export-pptx.ts), so affected formulas were shifted, clipped, or
collapsed. Delegate to svg-pathdata's getBounds(), which handles all of the
above, keeping the empty/malformed -> {0,0,0,0} contract.

Co-authored-by: ly-wang19 <ly-wang19@users.noreply.github.com>
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-authored-by: wyuc <wang-yc24@mails.tsinghua.edu.cn>
2026-07-01 04:51:26 -04:00
..