Remove references to core, fix core example
This commit is contained in:
parent
a8377139ab
commit
b6f2e2940f
3 changed files with 72 additions and 85 deletions
|
@ -2,16 +2,7 @@
|
||||||
/* refresh-reset */
|
/* refresh-reset */
|
||||||
|
|
||||||
import * as React from 'react'
|
import * as React from 'react'
|
||||||
import {
|
import { TLShape, Utils, TLBounds, TLShapeUtil, HTMLContainer, SVGContainer } from '@tldraw/core'
|
||||||
TLShape,
|
|
||||||
Utils,
|
|
||||||
TLBounds,
|
|
||||||
TLShapeUtil,
|
|
||||||
HTMLContainer,
|
|
||||||
TLComponent,
|
|
||||||
SVGContainer,
|
|
||||||
TLIndicator,
|
|
||||||
} from '@tldraw/core'
|
|
||||||
|
|
||||||
// Define a custom shape
|
// Define a custom shape
|
||||||
|
|
||||||
|
@ -37,11 +28,8 @@ export const boxShape: BoxShape = {
|
||||||
export class BoxUtil extends TLShapeUtil<BoxShape, HTMLDivElement> {
|
export class BoxUtil extends TLShapeUtil<BoxShape, HTMLDivElement> {
|
||||||
age = 100
|
age = 100
|
||||||
|
|
||||||
Component: TLComponent<BoxShape, HTMLDivElement> = (
|
Component = TLShapeUtil.Component<BoxShape, HTMLDivElement>(
|
||||||
{ shape, events, onShapeChange, isEditing, meta },
|
({ shape, events, onShapeChange, isEditing, meta }, ref) => {
|
||||||
ref
|
|
||||||
) => {
|
|
||||||
console.log('hi')
|
|
||||||
const color = meta.isDarkMode ? 'white' : 'black'
|
const color = meta.isDarkMode ? 'white' : 'black'
|
||||||
|
|
||||||
const rInput = React.useRef<HTMLDivElement>(null)
|
const rInput = React.useRef<HTMLDivElement>(null)
|
||||||
|
@ -115,8 +103,9 @@ export class BoxUtil extends TLShapeUtil<BoxShape, HTMLDivElement> {
|
||||||
</HTMLContainer>
|
</HTMLContainer>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
)
|
||||||
|
|
||||||
Indicator: TLIndicator<BoxShape> = ({ shape }) => {
|
Indicator = TLShapeUtil.Indicator<BoxShape>(({ shape }) => {
|
||||||
return (
|
return (
|
||||||
<SVGContainer>
|
<SVGContainer>
|
||||||
<rect
|
<rect
|
||||||
|
@ -129,7 +118,7 @@ export class BoxUtil extends TLShapeUtil<BoxShape, HTMLDivElement> {
|
||||||
/>
|
/>
|
||||||
</SVGContainer>
|
</SVGContainer>
|
||||||
)
|
)
|
||||||
}
|
})
|
||||||
|
|
||||||
getBounds = (shape: BoxShape) => {
|
getBounds = (shape: BoxShape) => {
|
||||||
const bounds = Utils.getFromCache(this.boundsCache, shape, () => {
|
const bounds = Utils.getFromCache(this.boundsCache, shape, () => {
|
||||||
|
|
|
@ -9,7 +9,6 @@
|
||||||
"emitDeclarationOnly": false,
|
"emitDeclarationOnly": false,
|
||||||
"paths": {
|
"paths": {
|
||||||
"+*": ["./*"],
|
"+*": ["./*"],
|
||||||
"@tldraw/core": ["../core"],
|
|
||||||
"@tldraw/tldraw": ["../tldraw"]
|
"@tldraw/tldraw": ["../tldraw"]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
@ -8,7 +8,6 @@
|
||||||
"baseUrl": "src",
|
"baseUrl": "src",
|
||||||
"paths": {
|
"paths": {
|
||||||
"~*": ["./*"],
|
"~*": ["./*"],
|
||||||
"@tldraw/core": ["../core"],
|
|
||||||
"@tldraw/vec": ["../vec"],
|
"@tldraw/vec": ["../vec"],
|
||||||
"@tldraw/intersect": ["../intersect"]
|
"@tldraw/intersect": ["../intersect"]
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue