@univerjs/core v0.4.2 • Docs
Class: Rectangle
This class provides a set of methods to calculate IRange
.
Constructors
new Rectangle()
new Rectangle(): Rectangle
Returns
Methods
clone()
static clone(src): IRange
Parameters
Parameter | Type |
---|---|
src | IRange |
Returns
Defined in
submodules/univer/packages/core/src/shared/rectangle.ts:25 (opens in a new tab)
contains()
static contains(src, target): boolean
Parameters
Parameter | Type |
---|---|
src | IRange |
target | IRange |
Returns
boolean
Defined in
submodules/univer/packages/core/src/shared/rectangle.ts:193 (opens in a new tab)
equals()
static equals(src, target): boolean
Parameters
Parameter | Type |
---|---|
src | IRange |
target | IRange |
Returns
boolean
Defined in
submodules/univer/packages/core/src/shared/rectangle.ts:44 (opens in a new tab)
getIntersectionBetweenTwoRect()
static getIntersectionBetweenTwoRect(rect1, rect2): null | Required<IRectLTRB>
Parameters
Parameter | Type |
---|---|
rect1 | IRectLTRB |
rect2 | IRectLTRB |
Returns
null
| Required
<IRectLTRB
>
Defined in
submodules/univer/packages/core/src/shared/rectangle.ts:379 (opens in a new tab)
getIntersects()
static getIntersects(src, target): Nullable<IRange>
Parameters
Parameter | Type |
---|---|
src | IRange |
target | IRange |
Returns
Deprecated
use getIntersectRange
instead. This method does not handle NaN and does not return the correct rangeType
Defined in
submodules/univer/packages/core/src/shared/rectangle.ts:116 (opens in a new tab)
getPositionRange()
static getPositionRange(
relativeRange,
originRange,
absoluteRange?): IRange
Parameters
Parameter | Type |
---|---|
relativeRange | IRange |
originRange | IRange |
absoluteRange ? | IRange |
Returns
Defined in
submodules/univer/packages/core/src/shared/rectangle.ts:247 (opens in a new tab)
getRelativeRange()
static getRelativeRange(range, originRange): IRange
Parameters
Parameter | Type |
---|---|
range | IRange |
originRange | IRange |
Returns
Defined in
submodules/univer/packages/core/src/shared/rectangle.ts:239 (opens in a new tab)
hasIntersectionBetweenTwoRect()
static hasIntersectionBetweenTwoRect(rect1, rect2): boolean
Parameters
Parameter | Type |
---|---|
rect1 | IRectLTRB |
rect2 | IRectLTRB |
Returns
boolean
Defined in
submodules/univer/packages/core/src/shared/rectangle.ts:366 (opens in a new tab)
intersects()
static intersects(src, target): boolean
Parameters
Parameter | Type |
---|---|
src | IRange |
target | IRange |
Returns
boolean
Defined in
submodules/univer/packages/core/src/shared/rectangle.ts:76 (opens in a new tab)
mergeRanges()
static mergeRanges(ranges): IRange[]
Combine smaller rectangles into larger ones
Parameters
Parameter | Type |
---|---|
ranges | IRange [] |
Returns
IRange
[]
Defined in
submodules/univer/packages/core/src/shared/rectangle.ts:349 (opens in a new tab)
moveHorizontal()
static moveHorizontal(
range,
step,
length): IRange
Parameters
Parameter | Type | Default value |
---|---|---|
range | IRange | undefined |
step | number | 0 |
length | number | 0 |
Returns
Defined in
submodules/univer/packages/core/src/shared/rectangle.ts:257 (opens in a new tab)
moveOffset()
static moveOffset(
range,
offsetX,
offsetY): IRange
Parameters
Parameter | Type |
---|---|
range | IRange |
offsetX | number |
offsetY | number |
Returns
Defined in
submodules/univer/packages/core/src/shared/rectangle.ts:269 (opens in a new tab)
moveVertical()
static moveVertical(
range,
step,
length): IRange
Parameters
Parameter | Type | Default value |
---|---|---|
range | IRange | undefined |
step | number | 0 |
length | number | 0 |
Returns
Defined in
submodules/univer/packages/core/src/shared/rectangle.ts:263 (opens in a new tab)
realContain()
static realContain(src, target): boolean
Parameters
Parameter | Type |
---|---|
src | IRange |
target | IRange |
Returns
boolean
Defined in
submodules/univer/packages/core/src/shared/rectangle.ts:202 (opens in a new tab)
realUnion()
static realUnion(...ranges): IRange
Parameters
Parameter | Type |
---|---|
...ranges | IRange [] |
Returns
Defined in
submodules/univer/packages/core/src/shared/rectangle.ts:226 (opens in a new tab)
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
Parameter | Type |
---|---|
rangeA | IRange |
rangeB | IRange |
Returns
boolean
boolean
Defined in
submodules/univer/packages/core/src/shared/rectangle.ts:66 (opens in a new tab)
sort()
static sort(ranges): IRange[]
Parameters
Parameter | Type |
---|---|
ranges | IRange [] |
Returns
IRange
[]
Defined in
submodules/univer/packages/core/src/shared/rectangle.ts:402 (opens in a new tab)
subtract()
static subtract(range1, range2): IRange[]
Subtract range2 from range1, the result is is horizontal first then vertical
Parameters
Parameter | Type | Description |
---|---|---|
range1 | IRange | The source range |
range2 | IRange | The range to be subtracted |
Returns
IRange
[]
Returns the array of ranges, which are the result not intersected with range1
Defined in
submodules/univer/packages/core/src/shared/rectangle.ts:283 (opens in a new tab)
subtractMulti()
static subtractMulti(ranges1, ranges2): IRange[]
Parameters
Parameter | Type |
---|---|
ranges1 | IRange [] |
ranges2 | IRange [] |
Returns
IRange
[]
Defined in
submodules/univer/packages/core/src/shared/rectangle.ts:353 (opens in a new tab)
union()
static union(...ranges): IRange
Parameters
Parameter | Type |
---|---|
...ranges | IRange [] |
Returns
Defined in
submodules/univer/packages/core/src/shared/rectangle.ts:212 (opens in a new tab)