Fixed the build for examples/basic-dom (runtime only)

This commit is contained in:
Aria Minaei 2021-09-22 09:20:19 +02:00
parent 0ea4cc2b57
commit 3c00645e40

View file

@ -18,7 +18,7 @@ const Box: React.FC<{
selectedObject: ISheetObject | undefined selectedObject: ISheetObject | undefined
}> = ({id, sheet, selectedObject}) => { }> = ({id, sheet, selectedObject}) => {
// This is cheap to call and always returns the same value, so no need for useMemo() // This is cheap to call and always returns the same value, so no need for useMemo()
const obj = sheet.object(id, null, boxObjectConfig) const obj = sheet.object(id, boxObjectConfig)
const isSelected = selectedObject === obj const isSelected = selectedObject === obj
@ -45,7 +45,7 @@ const Box: React.FC<{
}, },
onDrag(x, y) { onDrag(x, y) {
if (!firstOnDragCalled) { if (!firstOnDragCalled) {
studio.__experimental_setSelection([obj]) studio.setSelection([obj])
firstOnDragCalled = true firstOnDragCalled = true
} }
scrub!.capture(({set}) => { scrub!.capture(({set}) => {
@ -68,7 +68,7 @@ const Box: React.FC<{
return ( return (
<div <div
onClick={() => { onClick={() => {
studio.__experimental_setSelection([obj]) studio.setSelection([obj])
}} }}
ref={setDivRef} ref={setDivRef}
style={{ style={{
@ -95,7 +95,7 @@ export const Scene: React.FC<{project: IProject}> = ({project}) => {
const [selection, _setSelection] = useState<IStudio['selection']>([]) const [selection, _setSelection] = useState<IStudio['selection']>([])
useLayoutEffect(() => { useLayoutEffect(() => {
return studio.__experimental_onSelectionChange((newSelection) => { return studio.onSelectionChange((newSelection) => {
_setSelection(newSelection) _setSelection(newSelection)
}) })
}) })