More progress on shorthand types

This commit is contained in:
Aria Minaei 2021-09-06 11:26:00 +02:00
parent aefb769855
commit f6cf3711f4
14 changed files with 109 additions and 103 deletions

View file

@ -3,15 +3,14 @@ import type {UseDragOpts} from './useDrag'
import useDrag from './useDrag'
import React, {useLayoutEffect, useMemo, useState} from 'react'
import type {IProject, ISheet} from '@theatre/core'
import {types as t} from '@theatre/core'
import type {IScrub, IStudio} from '@theatre/studio'
studio.initialize()
const boxObjectConfig = t.compound({
x: t.number(0),
y: t.number(0),
})
const boxObjectConfig = {
x: 0,
y: 0,
}
const Box: React.FC<{
id: string

View file

@ -3,28 +3,27 @@ import useDrag from '@theatre/studio/uiComponents/useDrag'
import React, {useLayoutEffect, useMemo, useState} from 'react'
import studio from '@theatre/studio'
import type {IProject, ISheet} from '@theatre/core'
import {types as t} from '@theatre/core'
import type {IScrub, IStudio} from '@theatre/studio'
studio.initialize()
const boxObjectConfig = t.compound({
position: t.compound({
x: t.number(0),
y: t.number(0),
z: t.number(0),
}),
scale: t.compound({
x: t.number(0),
y: t.number(0),
z: t.number(0),
origin: t.compound({
x: t.number(0),
y: t.number(0),
}),
w: t.number(0),
}),
})
const boxObjectConfig = {
position: {
x: 0,
y: 0,
z: 0,
},
scale: {
x: 0,
y: 0,
z: 0,
origin: {
x: 0,
y: 0,
},
w: 0,
},
}
const Box: React.FC<{
id: string

View file

@ -15,13 +15,13 @@ import {drawTurtlePlan, makeTurtlePlan} from './turtle'
studio.initialize()
const objConfig = types.compound({
startingPoint: types.compound({
const objConfig = {
startingPoint: {
x: types.number(0.5, {range: [0, 1]}),
y: types.number(0.5, {range: [0, 1]}),
}),
},
scale: types.number(1, {range: [0.1, 1000]}),
})
}
const TurtleRenderer: React.FC<{
sheet: ISheet