Remove references to core, fix core example

This commit is contained in:
Steve Ruiz 2021-10-29 15:00:55 +01:00
parent a8377139ab
commit b6f2e2940f
3 changed files with 72 additions and 85 deletions

View file

@ -2,16 +2,7 @@
/* refresh-reset */
import * as React from 'react'
import {
TLShape,
Utils,
TLBounds,
TLShapeUtil,
HTMLContainer,
TLComponent,
SVGContainer,
TLIndicator,
} from '@tldraw/core'
import { TLShape, Utils, TLBounds, TLShapeUtil, HTMLContainer, SVGContainer } from '@tldraw/core'
// Define a custom shape
@ -37,11 +28,8 @@ export const boxShape: BoxShape = {
export class BoxUtil extends TLShapeUtil<BoxShape, HTMLDivElement> {
age = 100
Component: TLComponent<BoxShape, HTMLDivElement> = (
{ shape, events, onShapeChange, isEditing, meta },
ref
) => {
console.log('hi')
Component = TLShapeUtil.Component<BoxShape, HTMLDivElement>(
({ shape, events, onShapeChange, isEditing, meta }, ref) => {
const color = meta.isDarkMode ? 'white' : 'black'
const rInput = React.useRef<HTMLDivElement>(null)
@ -115,8 +103,9 @@ export class BoxUtil extends TLShapeUtil<BoxShape, HTMLDivElement> {
</HTMLContainer>
)
}
)
Indicator: TLIndicator<BoxShape> = ({ shape }) => {
Indicator = TLShapeUtil.Indicator<BoxShape>(({ shape }) => {
return (
<SVGContainer>
<rect
@ -129,7 +118,7 @@ export class BoxUtil extends TLShapeUtil<BoxShape, HTMLDivElement> {
/>
</SVGContainer>
)
}
})
getBounds = (shape: BoxShape) => {
const bounds = Utils.getFromCache(this.boundsCache, shape, () => {

View file

@ -9,7 +9,6 @@
"emitDeclarationOnly": false,
"paths": {
"+*": ["./*"],
"@tldraw/core": ["../core"],
"@tldraw/tldraw": ["../tldraw"]
}
},

View file

@ -8,7 +8,6 @@
"baseUrl": "src",
"paths": {
"~*": ["./*"],
"@tldraw/core": ["../core"],
"@tldraw/vec": ["../vec"],
"@tldraw/intersect": ["../intersect"]
}