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

Function parseAdjustments

apps/sim/lib/pptx-renderer/model/nodes/shape-node.ts:148–168  ·  view source on GitHub ↗

* Parse adjustment values from `a:avLst > a:gd` elements. * Each guide has a `name` attribute and a `fmla` attribute like "val 50000".

(avLst: SafeXmlNode)

Source from the content-addressed store, hash-verified

146 * Each guide has a `name` attribute and a `fmla` attribute like "val 50000".
147 */
148function parseAdjustments(avLst: SafeXmlNode): Map<string, number> {
149 const adjustments = new Map<string, number>()
150 for (const gd of avLst.children('gd')) {
151 const name = gd.attr('name')
152 const fmla = gd.attr('fmla') ?? ''
153 if (!name) continue
154
155 // fmla is typically "val NNNNN" — extract the numeric part
156 const match = fmla.match(/val\s+(-?\d+)/)
157 if (match) {
158 adjustments.set(name, Number(match[1]))
159 } else {
160 // Try direct numeric value
161 const num = Number(fmla)
162 if (!Number.isNaN(num)) {
163 adjustments.set(name, num)
164 }
165 }
166 }
167 return adjustments
168}
169
170/**
171 * Parse a shape XML node (`p:sp` or `p:cxnSp`) into ShapeNodeData.

Callers 1

parseShapeNodeFunction · 0.85

Calls 3

childrenMethod · 0.80
attrMethod · 0.80
setMethod · 0.65

Tested by

no test coverage detected