Sync snapshot (2026-08-26) (#159)
- Sheets: CSV export and save support, Excel-matching data validation - Docs: image, shape, WordArt, and chart rendering fixes - Slides: downloadable font catalog with a missing-font banner - Slides: better AI text layout and a speaker-notes tool Co-authored-by: GenOffice <merrick-2002@users.noreply.github.com>
This commit is contained in:
co-authored by
GenOffice
parent
9711a4507c
commit
0a2c25d483
@@ -382,6 +382,7 @@ function buildShape(
|
||||
...(el.placeholder ? { placeholder: el.placeholder } : {}),
|
||||
...(el.txBox ? { txBox: true } : {}),
|
||||
...(el.presetGeometry ? { presetGeometry: el.presetGeometry } : {}),
|
||||
...(el.softEdge ? { softEdgePx: emuToPx(el.softEdge, vp.scale) } : {}),
|
||||
}
|
||||
// Raw avLst values ride along for the edit layer (yellow adjust handles)
|
||||
if (el.adjust) node.adjust = { ...el.adjust }
|
||||
|
||||
@@ -1324,6 +1324,34 @@ export function presetPath(
|
||||
.Z()
|
||||
return { path: b.d() }
|
||||
}
|
||||
case 'swooshArrow': {
|
||||
// ECMA-376 swooshArrow: rising swoosh body (two quad beziers) with an arrowhead at top-right
|
||||
const a1 = Math.min(Math.max(adjust?.adj1 ?? 25000, 1), 75000) / 100000
|
||||
const maxAdj2 = (70000 * w) / ss
|
||||
const a2 = Math.min(Math.max(adjust?.adj2 ?? 16667, 0), maxAdj2)
|
||||
const ad1 = h * a1
|
||||
const ad2 = (ss * a2) / 100000
|
||||
const ssd8 = ss / 8
|
||||
const tanAlfa = Math.tan(Math.PI / 2 / 14)
|
||||
const xB = w - ad2
|
||||
const yB = ssd8
|
||||
const xC = xB - ssd8 * tanAlfa
|
||||
const yF = yB + ad1
|
||||
const xF = xB + ad1 * tanAlfa
|
||||
const xE = xF + ssd8 * tanAlfa
|
||||
const yE = yF + ssd8
|
||||
const yD = yE / 2 + h / 20
|
||||
const b = new PathB()
|
||||
b.M(0, h)
|
||||
.Q(w / 6, h / 3, xB, yB)
|
||||
.L(xC, 0)
|
||||
.L(w, yD)
|
||||
.L(xE, yE)
|
||||
.L(xF, yF)
|
||||
.Q(w / 4, yF + h / 12, 0, h)
|
||||
.Z()
|
||||
return { path: b.d() }
|
||||
}
|
||||
case 'wedgeRoundRectCallout': {
|
||||
const r = ss * frac('adj3', 16667)
|
||||
const tipX = cx + w * adjRaw(adjust, 'adj1', -20833)
|
||||
|
||||
@@ -294,6 +294,8 @@ export interface ShapeRenderNode extends RenderNodeBase {
|
||||
fill: RenderFill
|
||||
/** <a:fillOverlay>: second fill drawn over the base with multiply blending */
|
||||
fillOverlay?: RenderFill
|
||||
/** Soft-edge feather radius (px) */
|
||||
softEdgePx?: number
|
||||
stroke?: RenderStroke
|
||||
shadow?: RenderShadow
|
||||
glow?: RenderGlow
|
||||
|
||||
@@ -364,3 +364,22 @@ describe('arrow callouts (tdf150789 SmartArt section arrows)', () => {
|
||||
expect(pts[9]).toBe(100)
|
||||
})
|
||||
})
|
||||
|
||||
describe('swooshArrow (prod SmartArt rising-arrow diagrams)', () => {
|
||||
it('returns a curved arrow path, not a rect fallback', () => {
|
||||
const r = presetPath('swooshArrow', 788, 358, { adj1: 25000, adj2: 25000 })
|
||||
expect(r).toBeTruthy()
|
||||
// Body sweep = two quad beziers; arrowhead = straight segments
|
||||
expect((r!.path!.match(/Q /g) ?? []).length).toBe(2)
|
||||
// Starts at bottom-left corner
|
||||
expect(r!.path!.startsWith('M 0 358')).toBe(true)
|
||||
// Arrowhead tip on the right edge, in the upper part (yD = yE/2 + h/20)
|
||||
expect(r!.path).toContain('L 788 ')
|
||||
})
|
||||
|
||||
it('clamps adj2 to maxAdj2 = 70000*w/ss', () => {
|
||||
const r = presetPath('swooshArrow', 100, 100, { adj1: 25000, adj2: 999999 })
|
||||
// ad2 capped at 70% of ss → xB = w - 70
|
||||
expect(r!.path).toContain('Q 16.67 33.33 30 12.5')
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user