MotionScript

@motion-script/core


@motion-script/core / normalizeRanges

Function: normalizeRanges()

normalizeRanges(ranges, length): TextRange[]

Defined in: nodes/text/text-selection.ts:194

Clamp ranges to [0, length], drop empties, sort by start, and merge any that touch or overlap so each glyph is covered once per selection. The relative order selections were created in is preserved across selections by the node's registry, not here.

Parameters

ranges

TextRange[]

length

number

Returns

TextRange[]