restores code editor

This commit is contained in:
Steve Ruiz 2021-06-23 23:32:21 +01:00
parent badda0bb1c
commit 059d704404
23 changed files with 1944 additions and 129 deletions

View file

@ -1,14 +1,13 @@
import CodeShape from './index'
import { uniqueId } from 'utils/utils'
import { RayShape, ShapeType } from 'types'
import { RayShape, ShapeStyles, ShapeType } from 'types'
import { defaultStyle } from 'state/shape-styles'
import Utils from './utils'
/**
* ## Ray
*/
export default class Ray extends CodeShape<RayShape> {
constructor(props = {} as Partial<RayShape>) {
props.point = Utils.vectorToPoint(props.point)
props.direction = Utils.vectorToPoint(props.direction)
constructor(props = {} as Partial<RayShape> & Partial<ShapeStyles>) {
super({
id: uniqueId(),
seed: Math.random(),
@ -32,15 +31,6 @@ export default class Ray extends CodeShape<RayShape> {
})
}
export(): RayShape {
const shape = { ...this.shape }
shape.point = Utils.vectorToPoint(shape.point)
shape.direction = Utils.vectorToPoint(shape.direction)
return shape
}
get direction(): number[] {
return this.shape.direction
}