|
@@ -395,7 +395,7 @@ interface CanvaseItem {
|
|
|
name: string // 名称
|
|
|
type: string // 类型,图标icon
|
|
|
width: number // 家具宽度
|
|
|
- height: number // 家具长度
|
|
|
+ height?: number // 家具长度
|
|
|
length?: number // 家具长度
|
|
|
top: number // 距离检测范围上方位置 cm
|
|
|
left: number // 距离检测范围左边位置 cm
|
|
@@ -429,7 +429,7 @@ const addHandler = (icon: FurnitureIconType) => {
|
|
|
|
|
|
const newItem: FurnitureItem = {
|
|
|
name: furnitureIconNameMap[icon],
|
|
|
- type: icon,
|
|
|
+ type: icon as FurnitureType,
|
|
|
width: originWidth,
|
|
|
length: originHeight,
|
|
|
top: 0,
|
|
@@ -437,8 +437,6 @@ const addHandler = (icon: FurnitureIconType) => {
|
|
|
rotate: 0,
|
|
|
x: 0,
|
|
|
y: 0,
|
|
|
- // x: originOffsetX,
|
|
|
- // y: originOffsetY,
|
|
|
nanoid: nanoid(),
|
|
|
}
|
|
|
|
|
@@ -488,7 +486,7 @@ useDropZone(contentEl, {
|
|
|
const x = event.clientX - rect.left
|
|
|
const y = event.clientY - rect.top
|
|
|
// 中心点对齐计算
|
|
|
- currentDragItem.value.top = y - currentDragItem.value.height / 2
|
|
|
+ currentDragItem.value.top = y - currentDragItem.value.height! / 2
|
|
|
currentDragItem.value.left = x - currentDragItem.value.width / 2
|
|
|
// 添加边界检查
|
|
|
// const maxX = contentEl.value.offsetWidth - currentDragItem.value.width
|