API tweaks

This commit is contained in:
Aria Minaei 2021-09-03 19:29:21 +02:00
parent 58e46620cc
commit 9955730876
4 changed files with 44 additions and 14 deletions

View file

@ -2,7 +2,7 @@ import studio from '@theatre/studio'
import type {UseDragOpts} from '@theatre/studio/uiComponents/useDrag'
import useDrag from '@theatre/studio/uiComponents/useDrag'
import React, {useLayoutEffect, useMemo, useState} from 'react'
import type {IProject, ISheet, ISheetObject} from '@theatre/core'
import type {IProject, ISheet} from '@theatre/core'
import {types as t} from '@theatre/core'
import type {IScrub, IStudio} from '@theatre/studio'
@ -16,7 +16,7 @@ const boxObjectConfig = t.compound({
const Box: React.FC<{
id: string
sheet: ISheet
selection: ISheetObject[]
selection: IStudio['selection']
}> = ({id, sheet, selection}) => {
// This is cheap to call and always returns the same value, so no need for useMemo()
const obj = sheet.object(id, boxObjectConfig)

View file

@ -2,7 +2,7 @@ import type {UseDragOpts} from '@theatre/studio/uiComponents/useDrag'
import useDrag from '@theatre/studio/uiComponents/useDrag'
import React, {useLayoutEffect, useMemo, useState} from 'react'
import studio from '@theatre/studio'
import type {IProject, ISheet, ISheetObject} from '@theatre/core'
import type {IProject, ISheet} from '@theatre/core'
import {types as t} from '@theatre/core'
import type {IScrub, IStudio} from '@theatre/studio'
@ -29,7 +29,7 @@ const boxObjectConfig = t.compound({
const Box: React.FC<{
id: string
sheet: ISheet
selection: ISheetObject[]
selection: IStudio['selection']
}> = ({id, sheet, selection: selection}) => {
// This is cheap to call and always returns the same value, so no need for useMemo()
const obj = sheet.object('object ' + id, boxObjectConfig)