From e8fcc840d59e93cd105b435aec0945ed89f4a58b Mon Sep 17 00:00:00 2001 From: wass08 Date: Wed, 18 Feb 2026 16:26:17 +0900 Subject: [PATCH] surface placement --- apps/editor/components/tools/item/move-tool.tsx | 6 +++--- .../components/tools/item/use-placement-coordinator.tsx | 2 +- apps/editor/components/ui/item-catalog/catalog-items.tsx | 4 +++- .../ui/sidebar/panels/site-panel/item-tree-node.tsx | 2 +- apps/editor/features/community/lib/feedback/actions.ts | 3 ++- packages/core/src/schema/nodes/item.ts | 2 +- .../viewer/src/components/renderers/item/item-renderer.tsx | 2 +- 7 files changed, 12 insertions(+), 9 deletions(-) diff --git a/apps/editor/components/tools/item/move-tool.tsx b/apps/editor/components/tools/item/move-tool.tsx index 65d3b85f..2a22802b 100644 --- a/apps/editor/components/tools/item/move-tool.tsx +++ b/apps/editor/components/tools/item/move-tool.tsx @@ -11,12 +11,12 @@ function getInitialState(node: { }): PlacementState { const attachTo = node.asset.attachTo if (attachTo === 'wall' || attachTo === 'wall-side') { - return { surface: 'wall', wallId: node.parentId, ceilingId: null } + return { surface: 'wall', wallId: node.parentId, ceilingId: null, surfaceItemId: null } } if (attachTo === 'ceiling') { - return { surface: 'ceiling', wallId: null, ceilingId: node.parentId } + return { surface: 'ceiling', wallId: null, ceilingId: node.parentId, surfaceItemId: null } } - return { surface: 'floor', wallId: null, ceilingId: null } + return { surface: 'floor', wallId: null, ceilingId: null, surfaceItemId: null } } export const MoveTool: React.FC = () => { diff --git a/apps/editor/components/tools/item/use-placement-coordinator.tsx b/apps/editor/components/tools/item/use-placement-coordinator.tsx index c38293aa..27b136be 100644 --- a/apps/editor/components/tools/item/use-placement-coordinator.tsx +++ b/apps/editor/components/tools/item/use-placement-coordinator.tsx @@ -73,7 +73,7 @@ export function usePlacementCoordinator(config: PlacementCoordinatorConfig): Rea const basePlaneRef = useRef(null!) const gridPosition = useRef(new Vector3(0, 0, 0)) const placementState = useRef( - config.initialState ?? { surface: 'floor', wallId: null, ceilingId: null }, + config.initialState ?? { surface: 'floor', wallId: null, ceilingId: null, surfaceItemId: null }, ) const shiftFreeRef = useRef(false) diff --git a/apps/editor/components/ui/item-catalog/catalog-items.tsx b/apps/editor/components/ui/item-catalog/catalog-items.tsx index e393be83..876936cf 100644 --- a/apps/editor/components/ui/item-catalog/catalog-items.tsx +++ b/apps/editor/components/ui/item-catalog/catalog-items.tsx @@ -1167,7 +1167,9 @@ export const CATALOG_ITEMS: AssetInput[] = [ scale: [1, 1, 1], offset: [0, 0.21, 0], rotation: [0, 0, 0], - dimensions: [2, 0.4, 0.5], + dimensions: [2, 0.4, 0.5],surface: { + height: 0.36 + } }, { diff --git a/apps/editor/components/ui/sidebar/panels/site-panel/item-tree-node.tsx b/apps/editor/components/ui/sidebar/panels/site-panel/item-tree-node.tsx index efac1328..c40cc113 100644 --- a/apps/editor/components/ui/sidebar/panels/site-panel/item-tree-node.tsx +++ b/apps/editor/components/ui/sidebar/panels/site-panel/item-tree-node.tsx @@ -1,4 +1,4 @@ -import { ItemNode } from "@pascal-app/core"; +import { type AnyNodeId, ItemNode } from "@pascal-app/core"; import { useViewer } from "@pascal-app/viewer"; import Image from "next/image"; import { useState } from "react"; diff --git a/apps/editor/features/community/lib/feedback/actions.ts b/apps/editor/features/community/lib/feedback/actions.ts index d232b0a5..b297e390 100644 --- a/apps/editor/features/community/lib/feedback/actions.ts +++ b/apps/editor/features/community/lib/feedback/actions.ts @@ -14,7 +14,8 @@ export async function submitFeedback( const session = await getSession() const supabase = await createServerSupabaseClient() - const { error } = await supabase.from('feedback').insert({ + // eslint-disable-next-line @typescript-eslint/no-explicit-any + const { error } = await (supabase as any).from('feedback').insert({ id: createId('feedback'), user_id: session?.user?.id ?? null, message: trimmed, diff --git a/packages/core/src/schema/nodes/item.ts b/packages/core/src/schema/nodes/item.ts index 9a879bb3..949b2a91 100644 --- a/packages/core/src/schema/nodes/item.ts +++ b/packages/core/src/schema/nodes/item.ts @@ -31,7 +31,7 @@ export const ItemNode = BaseNode.extend({ position: z.tuple([z.number(), z.number(), z.number()]).default([0, 0, 0]), rotation: z.tuple([z.number(), z.number(), z.number()]).default([0, 0, 0]), side: z.enum(['front', 'back']).optional(), - children: z.array(z.string()).default([]), + children: z.array(objectId('item')).default([]), // Wall attachment properties (only used when asset.attachTo is "wall" or "wall-side") wallId: z.string().optional(), diff --git a/packages/viewer/src/components/renderers/item/item-renderer.tsx b/packages/viewer/src/components/renderers/item/item-renderer.tsx index 92530528..7b3156da 100644 --- a/packages/viewer/src/components/renderers/item/item-renderer.tsx +++ b/packages/viewer/src/components/renderers/item/item-renderer.tsx @@ -45,7 +45,7 @@ export const ItemRenderer = ({ node }: { node: ItemNode }) => { {node.children?.map((childId) => ( - + ))} )