Merge pull request #296 from sudhir9297/wed-6-may-bug-fix

fix: Improve item surface placement, floorplan resizing, and placement preview stability
This commit is contained in:
Wassim SAMAD
2026-05-07 13:09:20 -04:00
committed by GitHub
15 changed files with 1682 additions and 280 deletions
+6 -1
View File
@@ -55,7 +55,12 @@ export type {
TemperatureControl,
ToggleControl,
} from './nodes/item'
export { getScaledDimensions, ItemNode } from './nodes/item'
export {
getScaledDimensions,
ItemNode,
isLowProfileItemSurface,
LOW_PROFILE_ITEM_SURFACE_MAX_HEIGHT,
} from './nodes/item'
export { LevelNode } from './nodes/level'
export type { RoofSurfaceMaterialRole, RoofSurfaceMaterialSpec } from './nodes/roof'
export { getEffectiveRoofSurfaceMaterial, RoofNode } from './nodes/roof'
+14
View File
@@ -135,6 +135,20 @@ export const ItemNode = BaseNode.extend({
export type ItemNode = z.infer<typeof ItemNode>
export const LOW_PROFILE_ITEM_SURFACE_MAX_HEIGHT = 0.1
/**
* Low, floor-resting items like rugs and parking mats can receive items visually,
* but should not become item parents or block normal floor placement.
*/
export function isLowProfileItemSurface(item: ItemNode): boolean {
if (item.asset.attachTo) return false
const surfaceHeight = item.asset.surface
? item.asset.surface.height * item.scale[1]
: getScaledDimensions(item)[1]
return surfaceHeight <= LOW_PROFILE_ITEM_SURFACE_MAX_HEIGHT
}
/**
* Returns the effective world-space dimensions of an item after applying its scale.
* Use this everywhere item.asset.dimensions is used for spatial calculations.