* Extract xfrm position/size from a raw placeholder XML node.
(phNode: SafeXmlNode)
| 298 | * Extract xfrm position/size from a raw placeholder XML node. |
| 299 | */ |
| 300 | function getPhXfrm(phNode: SafeXmlNode): { position: Position; size: Size } | undefined { |
| 301 | // Try spPr > xfrm first (most shapes) |
| 302 | const spPr = phNode.child('spPr') |
| 303 | if (spPr.exists()) { |
| 304 | const xfrm = spPr.child('xfrm') |
| 305 | if (xfrm.exists()) { |
| 306 | const off = xfrm.child('off') |
| 307 | const ext = xfrm.child('ext') |
| 308 | const x = off.numAttr('x') |
| 309 | const cx = ext.numAttr('cx') |
| 310 | if (x !== undefined && cx !== undefined) { |
| 311 | return { |
| 312 | position: { x: emuToPx(off.numAttr('x') ?? 0), y: emuToPx(off.numAttr('y') ?? 0) }, |
| 313 | size: { w: emuToPx(ext.numAttr('cx') ?? 0), h: emuToPx(ext.numAttr('cy') ?? 0) }, |
| 314 | } |
| 315 | } |
| 316 | } |
| 317 | } |
| 318 | return undefined |
| 319 | } |
| 320 | |
| 321 | /** |
| 322 | * Find a matching placeholder node by type and idx. |
no test coverage detected