feat: sync surface polygon editing
This commit is contained in:
@@ -1,8 +1,10 @@
|
||||
import type { CeilingNode } from '@pascal-app/core'
|
||||
import { type AnyNode, type CeilingNode, resolveLevelId } from '@pascal-app/core'
|
||||
import { resolveCeilingPlanPointSnap } from '@pascal-app/editor'
|
||||
import {
|
||||
createPolygonAddVertexAffordance,
|
||||
createPolygonMoveEdgeAffordance,
|
||||
createPolygonVertexAffordance,
|
||||
type PolygonAffordanceSnapContext,
|
||||
} from '../shared/polygon-vertex-affordance'
|
||||
|
||||
/**
|
||||
@@ -11,6 +13,35 @@ import {
|
||||
* optional `holeIndex`. See `slab/floorplan-affordances.ts` for the
|
||||
* full contract.
|
||||
*/
|
||||
export const ceilingMoveVertexAffordance = createPolygonVertexAffordance<CeilingNode>('ceiling')
|
||||
export const ceilingAddVertexAffordance = createPolygonAddVertexAffordance<CeilingNode>('ceiling')
|
||||
export const ceilingMoveEdgeAffordance = createPolygonMoveEdgeAffordance<CeilingNode>('ceiling')
|
||||
const ceilingSnapOptions = {
|
||||
resolvePlanPoint({
|
||||
node,
|
||||
nodes,
|
||||
rawPoint,
|
||||
fallbackPoint,
|
||||
modifiers,
|
||||
}: PolygonAffordanceSnapContext<CeilingNode>) {
|
||||
const sceneNodes = nodes as Record<string, AnyNode>
|
||||
return resolveCeilingPlanPointSnap({
|
||||
rawPoint,
|
||||
fallbackPoint,
|
||||
levelId: resolveLevelId(node, sceneNodes),
|
||||
excludeId: node.id,
|
||||
nodes: sceneNodes,
|
||||
altKey: modifiers.altKey,
|
||||
}).point
|
||||
},
|
||||
}
|
||||
|
||||
export const ceilingMoveVertexAffordance = createPolygonVertexAffordance<CeilingNode>(
|
||||
'ceiling',
|
||||
ceilingSnapOptions,
|
||||
)
|
||||
export const ceilingAddVertexAffordance = createPolygonAddVertexAffordance<CeilingNode>(
|
||||
'ceiling',
|
||||
ceilingSnapOptions,
|
||||
)
|
||||
export const ceilingMoveEdgeAffordance = createPolygonMoveEdgeAffordance<CeilingNode>(
|
||||
'ceiling',
|
||||
ceilingSnapOptions,
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user