diff --git a/src/ThreeEditor/components/Sidebar/EditorSidebar.tsx b/src/ThreeEditor/components/Sidebar/EditorSidebar.tsx index 39000f8a4..b233a6aea 100644 --- a/src/ThreeEditor/components/Sidebar/EditorSidebar.tsx +++ b/src/ThreeEditor/components/Sidebar/EditorSidebar.tsx @@ -116,6 +116,7 @@ export function EditorSidebar(props: { editor: Editor }) { t.spacing(1) }} /> (null); @@ -90,20 +92,12 @@ export function SidebarTree(props: { editor: Editor; sources: TreeSource }) { const objectRefs = useRef>(new Map()); - const canDrop = ( - source: TreeItem | undefined, - target: TreeItem | undefined, - dropTargetId: string | number - ): boolean => { + const canDrop = (source: TreeItem | undefined, dropTargetId: string | number): boolean => { if (!source) return false; if (source.data?.treeId !== treeId) return false; - const object3d = source.data?.object; - - if (isQuantity(object3d)) return object3d.parent === target?.data?.object; - - return source.parent === dropTargetId; + return source.parent === dropTargetId; // only allow drop on same parent }; return ( @@ -137,10 +131,10 @@ export function SidebarTree(props: { editor: Editor; sources: TreeSource }) { ); } }} - canDrop={(_, { dropTarget, dragSource, dropTargetId }) => { - return canDrop(dragSource, dropTarget, dropTargetId); + canDrop={(_, { dragSource, dropTargetId }) => { + return canDrop(dragSource, dropTargetId); }} - canDrag={node => !isWorldZone(node?.data?.object)} + canDrag={node => !props.dragDisabled} sort={false} insertDroppableFirst={false} dropTargetOffset={5}