Removed nativeObject from the API
This commit is contained in:
parent
b63fcb9f1e
commit
6b373ccae5
8 changed files with 7 additions and 9 deletions
|
@ -19,7 +19,7 @@ const Box: React.FC<{
|
||||||
selection: ISheetObject[]
|
selection: ISheetObject[]
|
||||||
}> = ({id, sheet, selection}) => {
|
}> = ({id, sheet, selection}) => {
|
||||||
// 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 = selection.includes(obj)
|
const isSelected = selection.includes(obj)
|
||||||
|
|
||||||
|
|
|
@ -32,7 +32,7 @@ const Box: React.FC<{
|
||||||
selection: ISheetObject[]
|
selection: ISheetObject[]
|
||||||
}> = ({id, sheet, selection: selection}) => {
|
}> = ({id, sheet, selection: selection}) => {
|
||||||
// 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('object ' + id, null, boxObjectConfig)
|
const obj = sheet.object('object ' + id, boxObjectConfig)
|
||||||
|
|
||||||
const isSelected = selection.includes(obj)
|
const isSelected = selection.includes(obj)
|
||||||
|
|
||||||
|
|
|
@ -42,7 +42,7 @@ const TurtleRenderer: React.FC<{
|
||||||
dimsRef.current = {width: props.width, height: props.height}
|
dimsRef.current = {width: props.width, height: props.height}
|
||||||
|
|
||||||
const obj = useMemo(() => {
|
const obj = useMemo(() => {
|
||||||
return props.sheet.object(props.objKey, null, objConfig)
|
return props.sheet.object(props.objKey, objConfig)
|
||||||
}, [props.sheet, props.objKey])
|
}, [props.sheet, props.objKey])
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
|
|
@ -59,7 +59,7 @@ const editable = <
|
||||||
|
|
||||||
useLayoutEffect(() => {
|
useLayoutEffect(() => {
|
||||||
if (!sheet) return
|
if (!sheet) return
|
||||||
const sheetObject = sheet.object(uniqueName, {}, baseSheetObjectType)
|
const sheetObject = sheet.object(uniqueName, baseSheetObjectType)
|
||||||
setSheetObject(sheetObject)
|
setSheetObject(sheetObject)
|
||||||
|
|
||||||
useEditorStore
|
useEditorStore
|
||||||
|
|
|
@ -66,7 +66,7 @@ export function getEditorSheetObject(): ISheetObject<
|
||||||
> | null {
|
> | null {
|
||||||
if (!sheetObject) {
|
if (!sheetObject) {
|
||||||
sheetObject =
|
sheetObject =
|
||||||
getEditorSheet().object('Editor', null, editorSheetObjectConfig) || null
|
getEditorSheet().object('Editor', editorSheetObjectConfig) || null
|
||||||
}
|
}
|
||||||
return sheetObject
|
return sheetObject
|
||||||
}
|
}
|
||||||
|
|
|
@ -57,7 +57,6 @@ export default function useSnapshotEditorCamera(
|
||||||
if (!objRef.current) {
|
if (!objRef.current) {
|
||||||
objRef.current = snapshotEditorSheet.object(
|
objRef.current = snapshotEditorSheet.object(
|
||||||
`Editor Camera ${paneId}`,
|
`Editor Camera ${paneId}`,
|
||||||
{},
|
|
||||||
camConf,
|
camConf,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,7 +22,6 @@ export interface ISheet {
|
||||||
|
|
||||||
object<Props extends PropTypeConfig_Compound<$IntentionalAny>>(
|
object<Props extends PropTypeConfig_Compound<$IntentionalAny>>(
|
||||||
key: string,
|
key: string,
|
||||||
nativeObject: unknown,
|
|
||||||
config: SheetObjectConfig<Props>,
|
config: SheetObjectConfig<Props>,
|
||||||
): ISheetObject<Props>
|
): ISheetObject<Props>
|
||||||
|
|
||||||
|
@ -42,7 +41,6 @@ export default class TheatreSheet implements ISheet {
|
||||||
|
|
||||||
object<Props extends PropTypeConfig_Compound<$IntentionalAny>>(
|
object<Props extends PropTypeConfig_Compound<$IntentionalAny>>(
|
||||||
key: string,
|
key: string,
|
||||||
nativeObject: unknown,
|
|
||||||
config: SheetObjectConfig<Props>,
|
config: SheetObjectConfig<Props>,
|
||||||
): ISheetObject<Props> {
|
): ISheetObject<Props> {
|
||||||
const internal = privateAPI(this)
|
const internal = privateAPI(this)
|
||||||
|
@ -55,6 +53,8 @@ export default class TheatreSheet implements ISheet {
|
||||||
|
|
||||||
const existingObject = internal.getObject(sanitizedPath)
|
const existingObject = internal.getObject(sanitizedPath)
|
||||||
|
|
||||||
|
const nativeObject = null
|
||||||
|
|
||||||
if (existingObject) {
|
if (existingObject) {
|
||||||
existingObject.overrideConfig(nativeObject, config)
|
existingObject.overrideConfig(nativeObject, config)
|
||||||
return existingObject.publicApi as $IntentionalAny
|
return existingObject.publicApi as $IntentionalAny
|
||||||
|
|
|
@ -30,7 +30,6 @@ export async function setupTestSheet(sheetState: SheetState_Historic) {
|
||||||
const sheetPublicAPI = project.sheet('Sheet')
|
const sheetPublicAPI = project.sheet('Sheet')
|
||||||
const objPublicAPI = sheetPublicAPI.object(
|
const objPublicAPI = sheetPublicAPI.object(
|
||||||
'obj',
|
'obj',
|
||||||
null,
|
|
||||||
t.compound({
|
t.compound({
|
||||||
position: t.compound({
|
position: t.compound({
|
||||||
x: t.number(0),
|
x: t.number(0),
|
||||||
|
|
Loading…
Reference in a new issue