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

Function renderNode

apps/sim/lib/pptx-renderer/renderer/slide-renderer.ts:64–87  ·  view source on GitHub ↗

* Dispatch a typed node to its appropriate renderer. * This function is also passed into GroupRenderer for recursive child rendering.

(node: BaseNodeData, ctx: RenderContext)

Source from the content-addressed store, hash-verified

62 * This function is also passed into GroupRenderer for recursive child rendering.
63 */
64function renderNode(node: BaseNodeData, ctx: RenderContext): HTMLElement {
65 switch (node.nodeType) {
66 case 'shape':
67 return renderShape(node as ShapeNodeData, ctx)
68 case 'picture':
69 return renderImage(node as PicNodeData, ctx)
70 case 'table':
71 return renderTable(node as TableNodeData, ctx)
72 case 'group':
73 return renderGroup(node as GroupNodeData, ctx, renderNode)
74 case 'chart':
75 return renderChart(node as ChartNodeData, ctx)
76 default: {
77 // Unknown node type — render as empty positioned div
78 const el = document.createElement('div')
79 el.style.position = 'absolute'
80 el.style.left = `${node.position.x}px`
81 el.style.top = `${node.position.y}px`
82 el.style.width = `${node.size.w}px`
83 el.style.height = `${node.size.h}px`
84 return el
85 }
86 }
87}
88
89// ---------------------------------------------------------------------------
90// Error Placeholder

Callers 2

renderSlideFunction · 0.85
renderGroupFunction · 0.85

Calls 5

renderShapeFunction · 0.90
renderImageFunction · 0.90
renderTableFunction · 0.90
renderGroupFunction · 0.90
renderChartFunction · 0.90

Tested by

no test coverage detected