Skip to content

Class: DiagramPoint ​

One point (dgm:pt) of a diagram's data model.

Constructors ​

Constructor ​

new DiagramPoint(pt, part, themeContext, relationships, drawing?): DiagramPoint

Parameters ​

ParameterTypeDescription
ptElement-
partPartThe diagram data part, so a text edit marks the right part dirty.
themeContextThemeContext-
relationshipsRelationships-
drawing?() => DrawingIndexThe owning diagram's drawing index, built on first use; absent when reached without one.

Returns ​

DiagramPoint

Accessors ​

connectionId ​

Get Signature ​

get connectionId(): string | null

For a transition point, the edge it labels (@cxnId), or null. The schema's default is the literal 0, which means "none" rather than naming a point, so it reads null.

Returns ​

string | null


drawnShape ​

Get Signature ​

get drawnShape(): DiagramDrawnShape | null

The paragraph of the fallback drawing part (dsp:drawing) that carries this point's text, or null when nothing draws it.

The mapping runs through the pres point rather than directly: a dsp:sp/@modelId is always a pres point's id, so a lookup keyed on the authored point's own id finds nothing at all. It is many-to-one in both directions — one shape draws several points (@destOrd says which paragraph is whose, and it can contradict document order), and one point has several presentations, of which at most one holds text.

null is a defined outcome, not a failure, and covers four real cases: the package carries no drawing part; the point has no presOf edge (every unlabelled parTrans/sibTrans); the pres point draws no dsp:sp; and the shape it draws has no dsp:txBody (a connector, or a picture node's filled rectangle).

Returns ​

DiagramDrawnShape | null


element_ ​

Get Signature ​

get element_(): Element

Escape hatch: the underlying dgm:pt element. After mutating it call Diagram.markDirty.

Returns ​

Element


isPlaceholder ​

Get Signature ​

get isPlaceholder(): boolean

Whether this point is an unfilled prompt (dgm:prSet/@phldr) — a node PowerPoint draws with a grey placeholder string and treats as empty. Excluded from Diagram.text: a layout that stores its prompt in dgm:t would otherwise extract as content.

Returns ​

boolean


modelId ​

Get Signature ​

get modelId(): string | null

This point's id (@modelId), which connections reference.

Returns ​

string | null


placeholderText ​

Get Signature ​

get placeholderText(): string | null

The prompt string a placeholder point displays (dgm:prSet/@phldrT), or null.

Returns ​

string | null


presentationId ​

Get Signature ​

get presentationId(): string | null

The generated pres point that presents this one (dgm:cxn[@type="presOf"]/@destId), or null when nothing presents it — the normal state of an unlabelled transition point.

Where a point has several presOf arms the one named here is the arm that draws text; see drawnShape, which resolves both.

Returns ​

string | null


text ​

Get Signature ​

get text(): string

This point's text, paragraphs joined by \n; '' when it carries none.

Returns ​

string

Set Signature ​

set text(value): void

Replace this point's text, in the data model and in the drawing cache.

A diagram stores every string twice. dgm:t is what PowerPoint reads, and it recomputes the drawing from the data model on open; the dsp:drawing part is what every other renderer paints, and none of them recompute anything. Writing only the first is an edit that is invisible in LibreOffice, Google Slides, thumbnailers and web previews until someone opens the deck in PowerPoint and saves it.

The data-model write always happens. The mirror is best-effort: when the point resolves to no drawn paragraph (see drawnShape for the four ways that occurs) the cache keeps the old string and a diagram/drawing-cache-not-updated diagnostic says so. Throwing instead would make the common case unusable in order to report the rare one, and returning a status would be a shape no other text setter here has.

Two things it deliberately does not do. It does not recompute geometry: the drawn shape keeps its cached position and size, so a much longer string overflows its box in those same renderers until PowerPoint re-lays the diagram out. And it does not create a place to draw text — a transition point whose layout has no label slot has no dsp:sp, and PowerPoint strips text put on one, so the honest outcome is the diagnostic. Like every other text setter here it collapses the point to one run, keeping the first run's a:rPr; use textFrame for run-level work.

Parameters ​
ParameterType
valuestring
Returns ​

void


textFrame ​

Get Signature ​

get textFrame(): TextFrame | null

This point's text body (dgm:t) as a TextFrame, or null when the point carries none. It is an a:CT_TextBody like any other, so paragraphs, runs and the resolved* getters all apply.

Writing through this edits the data model only, and leaves the drawing cache holding the old string — which is what PowerPoint-less renderers draw. It is the escape hatch for run-level formatting, so it does exactly what it is told and nothing more; text's setter is the path that mirrors.

Returns ​

TextFrame | null


type ​

Get Signature ​

get type(): DiagramPointType

What kind of point this is (@type); node when absent, its schema default.

Returns ​

DiagramPointType