MCPcopy Index your code
hub / github.com/simstudioai/sim / getPhXfrm

Function getPhXfrm

apps/sim/lib/pptx-renderer/model/presentation.ts:300–319  ·  view source on GitHub ↗

* Extract xfrm position/size from a raw placeholder XML node.

(phNode: SafeXmlNode)

Source from the content-addressed store, hash-verified

298 * Extract xfrm position/size from a raw placeholder XML node.
299 */
300function 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.

Callers 1

resolveNodesPlaceholdersFunction · 0.85

Calls 4

emuToPxFunction · 0.90
childMethod · 0.80
existsMethod · 0.80
numAttrMethod · 0.80

Tested by

no test coverage detected