@univerjscoreclassesRectangle

@univerjs/core v0.5.0-beta.1Docs


Class: Rectangle

This class provides a set of methods to calculate IRange.

Constructors

new Rectangle()

new Rectangle(): Rectangle

Returns

Rectangle

Methods

clone()

static clone(src): IRange

Parameters

ParameterType
srcIRange

Returns

IRange

Defined in

packages/api/tmp/univer-pro/submodules/univer/packages/core/src/shared/rectangle.ts:25


contains()

static contains(src, target): boolean

Parameters

ParameterType
srcIRange
targetIRange

Returns

boolean

Defined in

packages/api/tmp/univer-pro/submodules/univer/packages/core/src/shared/rectangle.ts:193


equals()

static equals(src, target): boolean

Parameters

ParameterType
srcIRange
targetIRange

Returns

boolean

Defined in

packages/api/tmp/univer-pro/submodules/univer/packages/core/src/shared/rectangle.ts:44


getIntersectionBetweenTwoRect()

static getIntersectionBetweenTwoRect(rect1, rect2): null | Required<IRectLTRB>

Parameters

ParameterType
rect1IRectLTRB
rect2IRectLTRB

Returns

null | Required<IRectLTRB>

Defined in

packages/api/tmp/univer-pro/submodules/univer/packages/core/src/shared/rectangle.ts:383


getIntersects()

static getIntersects(src, target): Nullable<IRange>

Parameters

ParameterType
srcIRange
targetIRange

Returns

Nullable<IRange>

Deprecated

use getIntersectRange instead. This method does not handle NaN and does not return the correct rangeType

Defined in

packages/api/tmp/univer-pro/submodules/univer/packages/core/src/shared/rectangle.ts:116


getPositionRange()

static getPositionRange(
   relativeRange, 
   originRange, 
   absoluteRange?): IRange

Parameters

ParameterType
relativeRangeIRange
originRangeIRange
absoluteRange?IRange

Returns

IRange

Defined in

packages/api/tmp/univer-pro/submodules/univer/packages/core/src/shared/rectangle.ts:247


getRelativeRange()

static getRelativeRange(range, originRange): IRange

Parameters

ParameterType
rangeIRange
originRangeIRange

Returns

IRange

Defined in

packages/api/tmp/univer-pro/submodules/univer/packages/core/src/shared/rectangle.ts:239


hasIntersectionBetweenTwoRect()

static hasIntersectionBetweenTwoRect(rect1, rect2): boolean

Parameters

ParameterType
rect1IRectLTRB
rect2IRectLTRB

Returns

boolean

Defined in

packages/api/tmp/univer-pro/submodules/univer/packages/core/src/shared/rectangle.ts:370


intersects()

static intersects(src, target): boolean

Parameters

ParameterType
srcIRange
targetIRange

Returns

boolean

Defined in

packages/api/tmp/univer-pro/submodules/univer/packages/core/src/shared/rectangle.ts:76


mergeRanges()

static mergeRanges(ranges): IRange[]

Combine smaller rectangles into larger ones

Parameters

ParameterType
rangesIRange[]

Returns

IRange[]

Defined in

packages/api/tmp/univer-pro/submodules/univer/packages/core/src/shared/rectangle.ts:349


moveHorizontal()

static moveHorizontal(
   range, 
   step, 
   length): IRange

Parameters

ParameterTypeDefault value
rangeIRangeundefined
stepnumber0
lengthnumber0

Returns

IRange

Defined in

packages/api/tmp/univer-pro/submodules/univer/packages/core/src/shared/rectangle.ts:257


moveOffset()

static moveOffset(
   range, 
   offsetX, 
   offsetY): IRange

Parameters

ParameterType
rangeIRange
offsetXnumber
offsetYnumber

Returns

IRange

Defined in

packages/api/tmp/univer-pro/submodules/univer/packages/core/src/shared/rectangle.ts:269


moveVertical()

static moveVertical(
   range, 
   step, 
   length): IRange

Parameters

ParameterTypeDefault value
rangeIRangeundefined
stepnumber0
lengthnumber0

Returns

IRange

Defined in

packages/api/tmp/univer-pro/submodules/univer/packages/core/src/shared/rectangle.ts:263


realContain()

static realContain(src, target): boolean

Parameters

ParameterType
srcIRange
targetIRange

Returns

boolean

Defined in

packages/api/tmp/univer-pro/submodules/univer/packages/core/src/shared/rectangle.ts:202


realUnion()

static realUnion(...ranges): IRange

Parameters

ParameterType
rangesIRange[]

Returns

IRange

Defined in

packages/api/tmp/univer-pro/submodules/univer/packages/core/src/shared/rectangle.ts:226


simpleRangesIntersect()

static simpleRangesIntersect(rangeA, rangeB): boolean

Check intersects of normal range(RANGE_TYPE.NORMAL) For other types of ranges, please consider using the intersects method.

Parameters

ParameterType
rangeAIRange
rangeBIRange

Returns

boolean

boolean

Defined in

packages/api/tmp/univer-pro/submodules/univer/packages/core/src/shared/rectangle.ts:66


sort()

static sort(ranges): IRange[]

Parameters

ParameterType
rangesIRange[]

Returns

IRange[]

Defined in

packages/api/tmp/univer-pro/submodules/univer/packages/core/src/shared/rectangle.ts:406


splitIntoGrid()

static splitIntoGrid(ranges): IRange[]

Parameters

ParameterType
rangesIRange[]

Returns

IRange[]

Defined in

packages/api/tmp/univer-pro/submodules/univer/packages/core/src/shared/rectangle.ts:353


subtract()

static subtract(range1, range2): IRange[]

Subtract range2 from range1, the result is is horizontal first then vertical

Parameters

ParameterTypeDescription
range1IRangeThe source range
range2IRangeThe range to be subtracted

Returns

IRange[]

Returns the array of ranges, which are the result not intersected with range1

Defined in

packages/api/tmp/univer-pro/submodules/univer/packages/core/src/shared/rectangle.ts:283


subtractMulti()

static subtractMulti(ranges1, ranges2): IRange[]

Parameters

ParameterType
ranges1IRange[]
ranges2IRange[]

Returns

IRange[]

Defined in

packages/api/tmp/univer-pro/submodules/univer/packages/core/src/shared/rectangle.ts:357


union()

static union(...ranges): IRange

Parameters

ParameterType
rangesIRange[]

Returns

IRange

Defined in

packages/api/tmp/univer-pro/submodules/univer/packages/core/src/shared/rectangle.ts:212