Skip to content

Documentation / @ripl/core / Line

Class: Line ​

Defined in: packages/core/src/elements/line.ts:45

A straight line segment between two points.

Extends ​

Constructors ​

Constructor ​

new Line(options): Line

Defined in: packages/core/src/elements/line.ts:83

Parameters ​

ParameterType
optionsShape2DOptions<LineState>

Returns ​

Line

Overrides ​

Shape2D.constructor

Properties ​

PropertyModifierTypeDefault valueDescriptionInherited fromDefined in
abstractpublicbooleanfalseWhen true, the element skips transform and drawing-state application during Element.render; used by containers such as Group.Shape2D.abstractpackages/core/src/core/element.ts:339
autoFillpublicbooleanundefinedWhen true, the shape is automatically filled after rendering whenever Element.fill is set.Shape2D.autoFillpackages/core/src/core/shape.ts:81
autoStrokepublicbooleanundefinedWhen true, the shape's outline is automatically stroked after rendering whenever Element.stroke is set.Shape2D.autoStrokepackages/core/src/core/shape.ts:79
cachePathpublicbooleanundefinedWhen true, the shape reuses its traced path across render cycles while unchanged, on backends that support path caching.Shape2D.cachePathpackages/core/src/core/shape.ts:85
classListreadonlySet<string>undefinedSet of CSS-like class names used for querying and selection.Shape2D.classListpackages/core/src/core/element.ts:336
clippublicbooleanundefinedWhen true, the shape's path is used as a clipping region for descendants instead of being filled or stroked.Shape2D.clippackages/core/src/core/shape.ts:83
context?protectedContext<Element, Record<string, unknown>>undefined-Shape2D.contextpackages/core/src/core/element.ts:326
datapublicunknownundefinedArbitrary user data bound to the element, typically the datum backing a data-driven visual.Shape2D.datapackages/core/src/core/element.ts:348
idpublicstringundefinedUnique identifier for this element, defaulting to type:uniqueId when not supplied.Shape2D.idpackages/core/src/core/element.ts:330
interpolatorsprotectedElementInterpolators<TState>undefined-Shape2D.interpolatorspackages/core/src/core/element.ts:327
parent?publicGroup<ElementEventMap>undefinedThe parent Group this element is attached to, or undefined when detached.Shape2D.parentpackages/core/src/core/element.ts:345
path?protectedContextPathundefined-Shape2D.pathpackages/core/src/core/shape.ts:76
pointerEventspublicElementPointerEvents'all'Controls which parts of the element respond to pointer hit testing. See ElementPointerEvents.Shape2D.pointerEventspackages/core/src/core/element.ts:342
stateprotectedLineStateundefined-Shape2D.statepackages/core/src/core/element.ts:325
typereadonlystringundefinedThe element type name (e.g. circle, rect, group).Shape2D.typepackages/core/src/core/element.ts:333
defaultKeyreadonlytypeof defaultKeyundefinedThe key under which resources are retained when no explicit key is provided.Shape2D.defaultKeypackages/core/src/core/disposer.ts:11

Accessors ​

_boundsCacheable ​

Get Signature ​

get protected _boundsCacheable(): boolean

Defined in: packages/core/src/core/element.ts:794

Whether this element's bounding boxes may be cached against its own state version. Groups opt out; their box composes from children whose changes are not visible in the group's own state.

Returns ​

boolean

Inherited from ​

Shape2D._boundsCacheable


$anyDirty ​

Get Signature ​

get $anyDirty(): boolean

Defined in: packages/core/src/core/element.ts:361

Whether this element or any ancestor Group is dirty. Provided for subtree-level render skipping; the path cache uses Element.$dirty (own) because paths are authored in local space.

Returns ​

boolean

Inherited from ​

Shape2D.$anyDirty


$dirty ​

Get Signature ​

get $dirty(): boolean

Defined in: packages/core/src/core/element.ts:351

Whether an own state value has changed since the last render cycle. Drives per-element path-cache invalidation and is reset after each render cycle.

Returns ​

boolean

Inherited from ​

Shape2D.$dirty


$events ​

Get Signature ​

get $events(): keyof TEventMap[]

Defined in: packages/core/src/core/element.ts:371

The event types an element can emit. See EventBus.$events.

Returns ​

keyof TEventMap[]

Inherited from ​

Shape2D.$events


$state ​

Get Signature ​

get $state(): Readonly<TState>

Defined in: packages/core/src/core/element.ts:366

A shallow copy of the element's own set state values, without inherited or computed resolution. Intended for inspection and serialization (e.g. devtools); mutating the returned object has no effect on the element.

Returns ​

Readonly<TState>

Inherited from ​

Shape2D.$state


$touched ​

Get Signature ​

get $touched(): boolean

Defined in: packages/core/src/core/element.ts:356

Whether a state value was set since the last render cycle (the element was addressed), whether or not the value changed, so a real change also sets this. Reset after each render cycle.

Returns ​

boolean

Inherited from ​

Shape2D.$touched


direction ​

Get Signature ​

get direction(): TState["direction"]

Defined in: packages/core/src/core/element.ts:393

Text directionality used when rendering text, mirroring the canvas direction drawing-state property (inherit, ltr, or rtl).

Returns ​

TState["direction"]

Set Signature ​

set direction(value): void

Defined in: packages/core/src/core/element.ts:397

Parameters ​
ParameterType
valueTState["direction"]
Returns ​

void

Inherited from ​

Shape2D.direction


fill ​

Get Signature ​

get fill(): TState["fill"]

Defined in: packages/core/src/core/element.ts:402

Fill style (color or gradient) painted inside the element, mirroring the canvas fillStyle drawing-state property.

Returns ​

TState["fill"]

Set Signature ​

set fill(value): void

Defined in: packages/core/src/core/element.ts:406

Parameters ​
ParameterType
valueTState["fill"]
Returns ​

void

Inherited from ​

Shape2D.fill


filter ​

Get Signature ​

get filter(): TState["filter"]

Defined in: packages/core/src/core/element.ts:411

Filter effects applied to the element, mirroring the canvas filter drawing-state property.

Returns ​

TState["filter"]

Set Signature ​

set filter(value): void

Defined in: packages/core/src/core/element.ts:415

Parameters ​
ParameterType
valueTState["filter"]
Returns ​

void

Inherited from ​

Shape2D.filter


font ​

Get Signature ​

get font(): TState["font"]

Defined in: packages/core/src/core/element.ts:420

Font used for text rendering, mirroring the canvas font drawing-state property.

Returns ​

TState["font"]

Set Signature ​

set font(value): void

Defined in: packages/core/src/core/element.ts:424

Parameters ​
ParameterType
valueTState["font"]
Returns ​

void

Inherited from ​

Shape2D.font


globalCompositeOperation ​

Get Signature ​

get globalCompositeOperation(): TState["globalCompositeOperation"]

Defined in: packages/core/src/core/element.ts:438

Compositing/blend mode used to draw the element, mirroring the canvas globalCompositeOperation drawing-state property.

Returns ​

TState["globalCompositeOperation"]

Set Signature ​

set globalCompositeOperation(value): void

Defined in: packages/core/src/core/element.ts:442

Parameters ​
ParameterType
valueTState["globalCompositeOperation"]
Returns ​

void

Inherited from ​

Shape2D.globalCompositeOperation


hitPaths ​

Get Signature ​

get protected hitPaths(): ContextPath[]

Defined in: packages/core/src/core/shape.ts:126

Returns ​

ContextPath[]

Inherited from ​

Shape2D.hitPaths


lineCap ​

Get Signature ​

get lineCap(): TState["lineCap"]

Defined in: packages/core/src/core/element.ts:447

Cap style drawn at the ends of stroked lines, mirroring the canvas lineCap drawing-state property (butt, round, or square).

Returns ​

TState["lineCap"]

Set Signature ​

set lineCap(value): void

Defined in: packages/core/src/core/element.ts:451

Parameters ​
ParameterType
valueTState["lineCap"]
Returns ​

void

Inherited from ​

Shape2D.lineCap


lineDash ​

Get Signature ​

get lineDash(): TState["lineDash"]

Defined in: packages/core/src/core/element.ts:456

Dash pattern for stroked lines, mirroring the canvas line-dash array set via setLineDash.

Returns ​

TState["lineDash"]

Set Signature ​

set lineDash(value): void

Defined in: packages/core/src/core/element.ts:460

Parameters ​
ParameterType
valueTState["lineDash"]
Returns ​

void

Inherited from ​

Shape2D.lineDash


lineDashOffset ​

Get Signature ​

get lineDashOffset(): TState["lineDashOffset"]

Defined in: packages/core/src/core/element.ts:465

Offset into the line-dash pattern, mirroring the canvas lineDashOffset drawing-state property.

Returns ​

TState["lineDashOffset"]

Set Signature ​

set lineDashOffset(value): void

Defined in: packages/core/src/core/element.ts:469

Parameters ​
ParameterType
valueTState["lineDashOffset"]
Returns ​

void

Inherited from ​

Shape2D.lineDashOffset


lineJoin ​

Get Signature ​

get lineJoin(): TState["lineJoin"]

Defined in: packages/core/src/core/element.ts:474

Join style drawn where stroked segments meet, mirroring the canvas lineJoin drawing-state property (bevel, miter, or round).

Returns ​

TState["lineJoin"]

Set Signature ​

set lineJoin(value): void

Defined in: packages/core/src/core/element.ts:478

Parameters ​
ParameterType
valueTState["lineJoin"]
Returns ​

void

Inherited from ​

Shape2D.lineJoin


lineWidth ​

Get Signature ​

get lineWidth(): TState["lineWidth"]

Defined in: packages/core/src/core/element.ts:483

Width of stroked lines in pixels, mirroring the canvas lineWidth drawing-state property.

Returns ​

TState["lineWidth"]

Set Signature ​

set lineWidth(value): void

Defined in: packages/core/src/core/element.ts:487

Parameters ​
ParameterType
valueTState["lineWidth"]
Returns ​

void

Inherited from ​

Shape2D.lineWidth


miterLimit ​

Get Signature ​

get miterLimit(): TState["miterLimit"]

Defined in: packages/core/src/core/element.ts:492

Miter length limit for miter line joins, mirroring the canvas miterLimit drawing-state property.

Returns ​

TState["miterLimit"]

Set Signature ​

set miterLimit(value): void

Defined in: packages/core/src/core/element.ts:496

Parameters ​
ParameterType
valueTState["miterLimit"]
Returns ​

void

Inherited from ​

Shape2D.miterLimit


opacity ​

Get Signature ​

get opacity(): TState["opacity"]

Defined in: packages/core/src/core/element.ts:429

Opacity of the element from 0 (transparent) to 1 (opaque), mapping to the canvas globalAlpha drawing-state property.

Returns ​

TState["opacity"]

Set Signature ​

set opacity(value): void

Defined in: packages/core/src/core/element.ts:433

Parameters ​
ParameterType
valueTState["opacity"]
Returns ​

void

Inherited from ​

Shape2D.opacity


rotation ​

Get Signature ​

get rotation(): TState["rotation"]

Defined in: packages/core/src/core/element.ts:609

Rotation applied to the element during rendering, in radians or as a CSS-like angle string.

Returns ​

TState["rotation"]

Set Signature ​

set rotation(value): void

Defined in: packages/core/src/core/element.ts:613

Parameters ​
ParameterType
valueTState["rotation"]
Returns ​

void

Inherited from ​

Shape2D.rotation


shadowBlur ​

Get Signature ​

get shadowBlur(): TState["shadowBlur"]

Defined in: packages/core/src/core/element.ts:501

Blur radius applied to the element's shadow, mirroring the canvas shadowBlur drawing-state property.

Returns ​

TState["shadowBlur"]

Set Signature ​

set shadowBlur(value): void

Defined in: packages/core/src/core/element.ts:505

Parameters ​
ParameterType
valueTState["shadowBlur"]
Returns ​

void

Inherited from ​

Shape2D.shadowBlur


shadowColor ​

Get Signature ​

get shadowColor(): TState["shadowColor"]

Defined in: packages/core/src/core/element.ts:510

Color of the element's shadow, mirroring the canvas shadowColor drawing-state property.

Returns ​

TState["shadowColor"]

Set Signature ​

set shadowColor(value): void

Defined in: packages/core/src/core/element.ts:514

Parameters ​
ParameterType
valueTState["shadowColor"]
Returns ​

void

Inherited from ​

Shape2D.shadowColor


shadowOffsetX ​

Get Signature ​

get shadowOffsetX(): TState["shadowOffsetX"]

Defined in: packages/core/src/core/element.ts:519

Horizontal offset of the element's shadow, mirroring the canvas shadowOffsetX drawing-state property.

Returns ​

TState["shadowOffsetX"]

Set Signature ​

set shadowOffsetX(value): void

Defined in: packages/core/src/core/element.ts:523

Parameters ​
ParameterType
valueTState["shadowOffsetX"]
Returns ​

void

Inherited from ​

Shape2D.shadowOffsetX


shadowOffsetY ​

Get Signature ​

get shadowOffsetY(): TState["shadowOffsetY"]

Defined in: packages/core/src/core/element.ts:528

Vertical offset of the element's shadow, mirroring the canvas shadowOffsetY drawing-state property.

Returns ​

TState["shadowOffsetY"]

Set Signature ​

set shadowOffsetY(value): void

Defined in: packages/core/src/core/element.ts:532

Parameters ​
ParameterType
valueTState["shadowOffsetY"]
Returns ​

void

Inherited from ​

Shape2D.shadowOffsetY


stroke ​

Get Signature ​

get stroke(): TState["stroke"]

Defined in: packages/core/src/core/element.ts:537

Stroke style (color or gradient) painted along the element's outline, mirroring the canvas strokeStyle drawing-state property.

Returns ​

TState["stroke"]

Set Signature ​

set stroke(value): void

Defined in: packages/core/src/core/element.ts:541

Parameters ​
ParameterType
valueTState["stroke"]
Returns ​

void

Inherited from ​

Shape2D.stroke


textAlign ​

Get Signature ​

get textAlign(): TState["textAlign"]

Defined in: packages/core/src/core/element.ts:546

Horizontal alignment of rendered text, mirroring the canvas textAlign drawing-state property.

Returns ​

TState["textAlign"]

Set Signature ​

set textAlign(value): void

Defined in: packages/core/src/core/element.ts:550

Parameters ​
ParameterType
valueTState["textAlign"]
Returns ​

void

Inherited from ​

Shape2D.textAlign


textBaseline ​

Get Signature ​

get textBaseline(): TState["textBaseline"]

Defined in: packages/core/src/core/element.ts:555

Vertical baseline of rendered text, mirroring the canvas textBaseline drawing-state property.

Returns ​

TState["textBaseline"]

Set Signature ​

set textBaseline(value): void

Defined in: packages/core/src/core/element.ts:559

Parameters ​
ParameterType
valueTState["textBaseline"]
Returns ​

void

Inherited from ​

Shape2D.textBaseline


transformOriginX ​

Get Signature ​

get transformOriginX(): TState["transformOriginX"]

Defined in: packages/core/src/core/element.ts:618

Horizontal origin about which transforms are applied, as a pixel value or percentage string.

Returns ​

TState["transformOriginX"]

Set Signature ​

set transformOriginX(value): void

Defined in: packages/core/src/core/element.ts:622

Parameters ​
ParameterType
valueTState["transformOriginX"]
Returns ​

void

Inherited from ​

Shape2D.transformOriginX


transformOriginY ​

Get Signature ​

get transformOriginY(): TState["transformOriginY"]

Defined in: packages/core/src/core/element.ts:627

Vertical origin about which transforms are applied, as a pixel value or percentage string.

Returns ​

TState["transformOriginY"]

Set Signature ​

set transformOriginY(value): void

Defined in: packages/core/src/core/element.ts:631

Parameters ​
ParameterType
valueTState["transformOriginY"]
Returns ​

void

Inherited from ​

Shape2D.transformOriginY


transformScaleX ​

Get Signature ​

get transformScaleX(): TState["transformScaleX"]

Defined in: packages/core/src/core/element.ts:591

Horizontal scale factor applied to the element during rendering (1 is unscaled).

Returns ​

TState["transformScaleX"]

Set Signature ​

set transformScaleX(value): void

Defined in: packages/core/src/core/element.ts:595

Parameters ​
ParameterType
valueTState["transformScaleX"]
Returns ​

void

Inherited from ​

Shape2D.transformScaleX


transformScaleY ​

Get Signature ​

get transformScaleY(): TState["transformScaleY"]

Defined in: packages/core/src/core/element.ts:600

Vertical scale factor applied to the element during rendering (1 is unscaled).

Returns ​

TState["transformScaleY"]

Set Signature ​

set transformScaleY(value): void

Defined in: packages/core/src/core/element.ts:604

Parameters ​
ParameterType
valueTState["transformScaleY"]
Returns ​

void

Inherited from ​

Shape2D.transformScaleY


translateX ​

Get Signature ​

get translateX(): TState["translateX"]

Defined in: packages/core/src/core/element.ts:573

Horizontal translation applied to the element during rendering, in pixels.

Returns ​

TState["translateX"]

Set Signature ​

set translateX(value): void

Defined in: packages/core/src/core/element.ts:577

Parameters ​
ParameterType
valueTState["translateX"]
Returns ​

void

Inherited from ​

Shape2D.translateX


translateY ​

Get Signature ​

get translateY(): TState["translateY"]

Defined in: packages/core/src/core/element.ts:582

Vertical translation applied to the element during rendering, in pixels.

Returns ​

TState["translateY"]

Set Signature ​

set translateY(value): void

Defined in: packages/core/src/core/element.ts:586

Parameters ​
ParameterType
valueTState["translateY"]
Returns ​

void

Inherited from ​

Shape2D.translateY


x1 ​

Get Signature ​

get x1(): number

Defined in: packages/core/src/elements/line.ts:48

The x-coordinate of the line's start point.

Returns ​

number

Set Signature ​

set x1(value): void

Defined in: packages/core/src/elements/line.ts:52

Parameters ​
ParameterType
valuenumber
Returns ​

void


x2 ​

Get Signature ​

get x2(): number

Defined in: packages/core/src/elements/line.ts:66

The x-coordinate of the line's end point.

Returns ​

number

Set Signature ​

set x2(value): void

Defined in: packages/core/src/elements/line.ts:70

Parameters ​
ParameterType
valuenumber
Returns ​

void


y1 ​

Get Signature ​

get y1(): number

Defined in: packages/core/src/elements/line.ts:57

The y-coordinate of the line's start point.

Returns ​

number

Set Signature ​

set y1(value): void

Defined in: packages/core/src/elements/line.ts:61

Parameters ​
ParameterType
valuenumber
Returns ​

void


y2 ​

Get Signature ​

get y2(): number

Defined in: packages/core/src/elements/line.ts:75

The y-coordinate of the line's end point.

Returns ​

number

Set Signature ​

set y2(value): void

Defined in: packages/core/src/elements/line.ts:79

Parameters ​
ParameterType
valuenumber
Returns ​

void


zIndex ​

Get Signature ​

get zIndex(): number

Defined in: packages/core/src/core/element.ts:564

Effective stacking order of the element, combining its own z-index with its parent Group's. Higher values render on top.

Returns ​

number

Set Signature ​

set zIndex(value): void

Defined in: packages/core/src/core/element.ts:568

Parameters ​
ParameterType
valuenumber
Returns ​

void

Inherited from ​

Shape2D.zIndex

Methods ​

$reset() ​

$reset(): void

Defined in: packages/core/src/core/element.ts:1019

Resets this element's per-render-cycle change flags (Element.$dirty and Element.$touched). Called automatically at the end of each render cycle, by an element's own Element.render for leaves, and by the scene/renderer at each group pop and for the root. Consumers do not normally call this directly.

Returns ​

void

Inherited from ​

Shape2D.$reset


clone() ​

clone(): Element<LineState, ElementEventMap>

Defined in: packages/core/src/core/element.ts:762

Creates a shallow clone of this element with the same id, classes, and state.

Returns ​

Element<LineState, ElementEventMap>

Inherited from ​

Shape2D.clone


closest() ​

closest<TElement>(selector): TElement | undefined

Defined in: packages/core/src/core/element.ts:776

Returns the closest ancestor (including this element) matching the CSS-like selector, or undefined.

Type Parameters ​

Type ParameterDefault type
TElement extends Element<Partial<BaseState>, ElementEventMap>Element<Partial<BaseState>, ElementEventMap>

Parameters ​

ParameterType
selectorstring

Returns ​

TElement | undefined

Inherited from ​

Shape2D.closest


destroy() ​

destroy(): void

Defined in: packages/core/src/core/element.ts:1025

Detaches the element from its parent Group and tears down its event subscriptions.

Returns ​

void

Inherited from ​

Shape2D.destroy


dispose() ​

protected dispose(key?): void

Defined in: packages/core/src/core/disposer.ts:25

Disposes all resources under the given key, or all resources if no key is provided.

Parameters ​

ParameterType
key?PropertyKey

Returns ​

void

Inherited from ​

Shape2D.dispose


emit() ​

Call Signature ​

emit<TEvent>(event): TEvent

Defined in: packages/core/src/core/event-bus.ts:185

Emits an event, invoking all matching handlers and bubbling to the parent if applicable. Handlers for the event's own type run first, then EVENT_WILDCARD subscriptions.

Type Parameters ​
Type ParameterDefault type
TEvent extends Event<undefined>Event<undefined>
Parameters ​
ParameterType
eventTEvent
Returns ​

TEvent

Inherited from ​

Shape2D.emit

Call Signature ​

emit<TEvent>(type, data): Event<ElementEventMap[TEvent]>

Defined in: packages/core/src/core/event-bus.ts:186

Emits an event, invoking all matching handlers and bubbling to the parent if applicable. Handlers for the event's own type run first, then EVENT_WILDCARD subscriptions.

Type Parameters ​
Type Parameter
TEvent extends keyof ElementEventMap
Parameters ​
ParameterType
typeTEvent
dataElementEventMap[TEvent]
Returns ​

Event<ElementEventMap[TEvent]>

Inherited from ​

Shape2D.emit


getBoundingBox() ​

getBoundingBox(local?): Box

Defined in: packages/core/src/core/element.ts:871

Returns this element's bounding box: the on-screen (world) box by default, or the raw local box when local is true. The world box applies this element's own and every ancestor group's transform (mirroring the DOM's getBoundingClientRect); a rotated element yields a conservative axis-aligned box.

Parameters ​

ParameterTypeDefault valueDescription
localbooleanfalsewhen true, returns the untransformed authored geometry instead of the world box.

Returns ​

Box

Inherited from ​

Shape2D.getBoundingBox


getComputedValue() ​

getComputedValue<TKey>(key): LineState[TKey]

Defined in: packages/core/src/core/element.ts:723

Resolves a state value against the parent chain (own value, else the nearest ancestor's), the effective value an element renders with. Used where the resolved value is needed without a live context, such as computing a transition's start value.

Type Parameters ​

Type Parameter
TKey extends keyof LineState

Parameters ​

ParameterTypeDescription
keyTKeyThe state property to resolve.

Returns ​

LineState[TKey]

The element's own value for key, or the nearest ancestor's when unset, else undefined.

Inherited from ​

Shape2D.getComputedValue


getStateValue() ​

protected getStateValue<TKey>(key): LineState[TKey]

Defined in: packages/core/src/core/element.ts:686

Reads this element's own state value (no inheritance). Inherited paint now cascades through the render tree: a group applies its paint at its boundary (Context.pushGroup) and descendants pick it up from the context's copied state, so property getters return own values only, mirroring how the browser resolves computed style at paint time. Use Element.getComputedValue when the effective (inheritance-resolved) value is required outside a render pass (e.g. animation start values).

Type Parameters ​

Type Parameter
TKey extends keyof LineState

Parameters ​

ParameterType
keyTKey

Returns ​

LineState[TKey]

Inherited from ​

Shape2D.getStateValue


getWorldTransform() ​

getWorldTransform(): Matrix | null

Defined in: packages/core/src/core/element.ts:805

The element's world transform (own and every ancestor's transform composed root-first), or null when the composition is the identity. Cached against the parent chain's state versions, so static scenes skip the matrix rebuild; any state change (or reparent) along the chain recomputes. A chain node whose transform origin resolves against an uncacheable box (a group with a string origin) bypasses the cache entirely.

Returns ​

Matrix | null

Inherited from ​

Shape2D.getWorldTransform


has() ​

has(type): boolean

Defined in: packages/core/src/core/event-bus.ts:123

Returns whether there are any listeners registered for the given event type. Wildcard subscriptions (EVENT_WILDCARD) are not listeners for any concrete type, so a bus observed only through the wildcard still reports false here.

Parameters ​

ParameterType
typekeyof ElementEventMap

Returns ​

boolean

Inherited from ​

Shape2D.has


interpolate() ​

interpolate(newState, interpolators?): Interpolator<void>

Defined in: packages/core/src/core/element.ts:945

Creates an interpolator that transitions from the current state towards the target state, supporting keyframes and custom interpolator overrides.

Parameters ​

ParameterType
newStatePartial<ElementInterpolationState<TState>>
interpolatorsElementInterpolators<TState>

Returns ​

Interpolator<void>

Inherited from ​

Shape2D.interpolate


intersectsWith() ​

intersectsWith(x, y, options?): boolean

Defined in: packages/core/src/core/shape.ts:144

Tests whether a point intersects this shape using path-based fill and stroke hit testing.

Parameters ​

ParameterTypeDescription
xnumberX coordinate in logical space (CSS pixels relative to the context's top-left), the same space pointer event payloads report.
ynumberY coordinate in logical space (CSS pixels relative to the context's top-left).
options?Partial<ElementIntersectionOptions>Hit-testing options, such as whether the test originates from a pointer event.

Returns ​

boolean

Whether the point lies within the shape's fill or stroke, honoring its pointer-event region.

Inherited from ​

Shape2D.intersectsWith


matches() ​

matches(selector): boolean

Defined in: packages/core/src/core/element.ts:771

Tests whether this element matches the CSS-like selector.

Parameters ​

ParameterType
selectorstring

Returns ​

boolean

Inherited from ​

Shape2D.matches


off() ​

off<TEvent>(type, handler): void

Defined in: packages/core/src/core/event-bus.ts:144

Removes a previously registered handler for the given event type.

Type Parameters ​

Type Parameter
TEvent extends keyof ElementEventMap

Parameters ​

ParameterType
typeTEvent
handlerEventHandler<ElementEventMap[TEvent]>

Returns ​

void

Inherited from ​

Shape2D.off


on() ​

on<TEvent>(event, handler, options?): Disposable

Defined in: packages/core/src/core/element.ts:744

Subscribes a handler to an element event, returning a disposable subscription.

Overrides EventBus.on to additionally invalidate the Context's tracked-element cache for interaction events, keeping hit testing accurate as listeners are added and removed.

Type Parameters ​

Type Parameter
TEvent extends keyof ElementEventMap

Parameters ​

ParameterTypeDescription
eventTEventThe event name to listen for.
handlerEventHandler<ElementEventMap[TEvent]>Callback invoked when the event is emitted.
options?EventSubscriptionOptionsOptional subscription options (e.g. self-only filtering).

Returns ​

Disposable

A disposable used to remove the subscription.

Inherited from ​

Shape2D.on


once() ​

once<TEvent>(type, handler, options?): Disposable

Defined in: packages/core/src/core/event-bus.ts:159

Subscribes a handler that is automatically removed after it fires once.

Type Parameters ​

Type Parameter
TEvent extends keyof ElementEventMap

Parameters ​

ParameterType
typeTEvent
handlerEventHandler<ElementEventMap[TEvent]>
options?EventSubscriptionOptions

Returns ​

Disposable

Inherited from ​

Shape2D.once


render() ​

render(context): void

Defined in: packages/core/src/elements/line.ts:98

Renders the line to the provided Context.

Parameters ​

ParameterType
contextContext

Returns ​

void

Overrides ​

Shape2D.render


retain() ​

protected retain(value, key?): void

Defined in: packages/core/src/core/disposer.ts:14

Registers a disposable resource under an optional key for later cleanup.

Parameters ​

ParameterTypeDefault value
valueDisposableundefined
keyPropertyKeyDisposer.defaultKey

Returns ​

void

Inherited from ​

Shape2D.retain


setStateValue() ​

protected setStateValue<TKey>(key, value): void

Defined in: packages/core/src/core/element.ts:698

Sets a state value, marking the element Element.$touched. When the value differs from the current one it is written, the element is marked Element.$dirty, and an updated event is emitted; setting a primitive value equal to the current one is a no-op beyond $touched (no write, no $dirty, no event). Reference-equal objects and arrays always take the full path, since in-place mutation makes them indistinguishable from a changed value.

Type Parameters ​

Type Parameter
TKey extends keyof LineState

Parameters ​

ParameterType
keyTKey
valueLineState[TKey]

Returns ​

void

Inherited from ​

Shape2D.setStateValue


strokePath() ​

protected strokePath(context, path): void

Defined in: packages/core/src/core/shape.ts:132

Parameters ​

ParameterType
contextContext
pathContextPath

Returns ​

void

Inherited from ​

Shape2D.strokePath