tldraw/state/code/draw.ts

33 lines
723 B
TypeScript
Raw Normal View History

2021-06-23 22:32:21 +00:00
import CodeShape from './index'
2021-06-24 08:18:14 +00:00
import { uniqueId } from 'utils'
import { DrawShape, ShapeProps, ShapeType } from 'types'
2021-06-23 22:32:21 +00:00
import { defaultStyle } from 'state/shape-styles'
/**
* ## Draw
*/
export default class Draw extends CodeShape<DrawShape> {
constructor(props = {} as ShapeProps<DrawShape>) {
2021-06-23 22:32:21 +00:00
super({
id: uniqueId(),
seed: Math.random(),
type: ShapeType.Draw,
isGenerated: false,
name: 'Draw',
parentId: 'page1',
childIndex: 0,
point: [0, 0],
points: [],
rotation: 0,
isAspectRatioLocked: false,
isLocked: false,
isHidden: false,
...props,
style: {
...defaultStyle,
...props.style,
},
})
}
}