kopia lustrzana https://github.com/Tldraw/Tldraw
310 wiersze
3.7 KiB
Markdown
310 wiersze
3.7 KiB
Markdown
---
|
|
title: BaseBoxShapeUtil
|
|
status: published
|
|
category: editor
|
|
group: Class
|
|
author: api
|
|
date: 06/23/2023
|
|
order: 6
|
|
---<Small>Public Class</Small>
|
|
|
|
<details>
|
|
<summary>Table of Contents</summary>
|
|
- [Properties](#properties)
|
|
- [onResize](#BaseBoxShapeUtil-onResize-member)
|
|
- [Methods](#methods)
|
|
- [getBounds](#BaseBoxShapeUtil-getBounds-member-1)
|
|
- [getCenter](#BaseBoxShapeUtil-getCenter-member-1)
|
|
- [getOutline](#BaseBoxShapeUtil-getOutline-member-1)
|
|
- [hitTestLineSegment](#BaseBoxShapeUtil-hitTestLineSegment-member-1)
|
|
- [hitTestPoint](#BaseBoxShapeUtil-hitTestPoint-member-1)
|
|
</details>
|
|
|
|
|
|
|
|
|
|
##### Signature
|
|
|
|
|
|
```ts
|
|
abstract class BaseBoxShapeUtil<
|
|
Shape extends TLBaseBoxShape
|
|
> extends ShapeUtil<Shape> {}
|
|
```
|
|
|
|
##### References
|
|
|
|
[TLBaseBoxShape](/gen/editor/TLBaseBoxShape-type), [ShapeUtil](/gen/editor/ShapeUtil-class)
|
|
|
|
---
|
|
|
|
## Properties
|
|
|
|
### `onResize` \{#BaseBoxShapeUtil-onResize-member}
|
|
|
|
<Small>Public Property</Small>
|
|
|
|
##### Signature
|
|
|
|
|
|
```ts
|
|
onResize: TLOnResizeHandler<any>
|
|
```
|
|
|
|
##### References
|
|
|
|
[TLOnResizeHandler](/gen/editor/TLOnResizeHandler-type)
|
|
|
|
---
|
|
|
|
## Methods
|
|
|
|
### `getBounds()` \{#BaseBoxShapeUtil-getBounds-member-1}
|
|
|
|
<Small>Public Method</Small>
|
|
|
|
##### Parameters
|
|
|
|
|
|
<ParametersTable>
|
|
|
|
<ParametersTableRow>
|
|
<ParametersTableName>
|
|
|
|
`shape`
|
|
|
|
</ParametersTableName>
|
|
<ParametersTableDescription>
|
|
|
|
```ts
|
|
Shape
|
|
```
|
|
|
|
|
|
|
|
</ParametersTableDescription>
|
|
</ParametersTableRow>
|
|
</ParametersTable>
|
|
|
|
##### Returns
|
|
|
|
|
|
```ts
|
|
Box2d
|
|
```
|
|
|
|
##### References
|
|
|
|
[Box2d](/gen/primitives/Box2d-class)
|
|
|
|
---
|
|
|
|
### `getCenter()` \{#BaseBoxShapeUtil-getCenter-member-1}
|
|
|
|
<Small>Public Method</Small>
|
|
|
|
##### Parameters
|
|
|
|
|
|
<ParametersTable>
|
|
|
|
<ParametersTableRow>
|
|
<ParametersTableName>
|
|
|
|
`shape`
|
|
|
|
</ParametersTableName>
|
|
<ParametersTableDescription>
|
|
|
|
```ts
|
|
Shape
|
|
```
|
|
|
|
|
|
|
|
</ParametersTableDescription>
|
|
</ParametersTableRow>
|
|
</ParametersTable>
|
|
|
|
##### Returns
|
|
|
|
|
|
```ts
|
|
Vec2d
|
|
```
|
|
|
|
##### References
|
|
|
|
[Vec2d](/gen/primitives/Vec2d-class)
|
|
|
|
---
|
|
|
|
### `getOutline()` \{#BaseBoxShapeUtil-getOutline-member-1}
|
|
|
|
<Small>Public Method</Small>
|
|
|
|
##### Parameters
|
|
|
|
|
|
<ParametersTable>
|
|
|
|
<ParametersTableRow>
|
|
<ParametersTableName>
|
|
|
|
`shape`
|
|
|
|
</ParametersTableName>
|
|
<ParametersTableDescription>
|
|
|
|
```ts
|
|
Shape
|
|
```
|
|
|
|
|
|
|
|
</ParametersTableDescription>
|
|
</ParametersTableRow>
|
|
</ParametersTable>
|
|
|
|
##### Returns
|
|
|
|
|
|
```ts
|
|
Vec2d[]
|
|
```
|
|
|
|
##### References
|
|
|
|
[Vec2d](/gen/primitives/Vec2d-class)
|
|
|
|
---
|
|
|
|
### `hitTestLineSegment()` \{#BaseBoxShapeUtil-hitTestLineSegment-member-1}
|
|
|
|
<Small>Public Method</Small>
|
|
|
|
##### Parameters
|
|
|
|
|
|
<ParametersTable>
|
|
|
|
<ParametersTableRow>
|
|
<ParametersTableName>
|
|
|
|
`shape`
|
|
|
|
</ParametersTableName>
|
|
<ParametersTableDescription>
|
|
|
|
```ts
|
|
Shape
|
|
```
|
|
|
|
|
|
|
|
</ParametersTableDescription>
|
|
</ParametersTableRow>
|
|
<ParametersTableRow>
|
|
<ParametersTableName>
|
|
|
|
`A`
|
|
|
|
</ParametersTableName>
|
|
<ParametersTableDescription>
|
|
|
|
```ts
|
|
VecLike
|
|
```
|
|
|
|
|
|
|
|
</ParametersTableDescription>
|
|
</ParametersTableRow>
|
|
<ParametersTableRow>
|
|
<ParametersTableName>
|
|
|
|
`B`
|
|
|
|
</ParametersTableName>
|
|
<ParametersTableDescription>
|
|
|
|
```ts
|
|
VecLike
|
|
```
|
|
|
|
|
|
|
|
</ParametersTableDescription>
|
|
</ParametersTableRow>
|
|
</ParametersTable>
|
|
|
|
##### Returns
|
|
|
|
|
|
```ts
|
|
boolean
|
|
```
|
|
|
|
##### References
|
|
|
|
[VecLike](/gen/primitives/VecLike-type)
|
|
|
|
---
|
|
|
|
### `hitTestPoint()` \{#BaseBoxShapeUtil-hitTestPoint-member-1}
|
|
|
|
<Small>Public Method</Small>
|
|
|
|
##### Parameters
|
|
|
|
|
|
<ParametersTable>
|
|
|
|
<ParametersTableRow>
|
|
<ParametersTableName>
|
|
|
|
`shape`
|
|
|
|
</ParametersTableName>
|
|
<ParametersTableDescription>
|
|
|
|
```ts
|
|
Shape
|
|
```
|
|
|
|
|
|
|
|
</ParametersTableDescription>
|
|
</ParametersTableRow>
|
|
<ParametersTableRow>
|
|
<ParametersTableName>
|
|
|
|
`point`
|
|
|
|
</ParametersTableName>
|
|
<ParametersTableDescription>
|
|
|
|
```ts
|
|
VecLike
|
|
```
|
|
|
|
|
|
|
|
</ParametersTableDescription>
|
|
</ParametersTableRow>
|
|
</ParametersTable>
|
|
|
|
##### Returns
|
|
|
|
|
|
```ts
|
|
boolean
|
|
```
|
|
|
|
##### References
|
|
|
|
[VecLike](/gen/primitives/VecLike-type)
|
|
|
|
---
|
|
|