|
@@ -9,7 +9,7 @@
|
|
v-if="isEditDraggable"
|
|
v-if="isEditDraggable"
|
|
v-model:is-edit="isEditDraggable"
|
|
v-model:is-edit="isEditDraggable"
|
|
:style="{ marginTop: '30px' }"
|
|
:style="{ marginTop: '30px' }"
|
|
- @add="addHnadler"
|
|
|
|
|
|
+ @add="addHandler"
|
|
></furnitureCard>
|
|
></furnitureCard>
|
|
|
|
|
|
<div class="viewer">
|
|
<div class="viewer">
|
|
@@ -40,7 +40,20 @@
|
|
</a-space>
|
|
</a-space>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
- <div v-if="!areaAvailable" class="viewer-content">
|
|
|
|
|
|
+
|
|
|
|
+ <RadarEditor
|
|
|
|
+ v-if="!areaAvailable"
|
|
|
|
+ ref="radarEditorRef"
|
|
|
|
+ :coordinates="props.ranges"
|
|
|
|
+ :angle="props.angle"
|
|
|
|
+ :furnitureItems="furnitureItems"
|
|
|
|
+ @update:furnitureItems="mapCanvasList = $event"
|
|
|
|
+ />
|
|
|
|
+ {{ props.angle }}
|
|
|
|
+ <div>furnitureItems{{ furnitureItems }} </div>
|
|
|
|
+ <div>mapCanvasList{{ mapCanvasList }} </div>
|
|
|
|
+
|
|
|
|
+ <!-- <div v-if="!areaAvailable" class="viewer-content">
|
|
<div
|
|
<div
|
|
ref="contentEl"
|
|
ref="contentEl"
|
|
class="mapBox"
|
|
class="mapBox"
|
|
@@ -163,7 +176,7 @@
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
- </div>
|
|
|
|
|
|
+ </div> -->
|
|
</div>
|
|
</div>
|
|
|
|
|
|
<div class="viewer">
|
|
<div class="viewer">
|
|
@@ -362,18 +375,20 @@ import { useDropZone } from '@vueuse/core'
|
|
import { furnitureIconNameMap, furnitureIconSizeMap } from '@/const/furniture'
|
|
import { furnitureIconNameMap, furnitureIconSizeMap } from '@/const/furniture'
|
|
import type { FurnitureIconType } from '@/types/furniture'
|
|
import type { FurnitureIconType } from '@/types/furniture'
|
|
import furnitureCard from '../furnitureCard/index.vue'
|
|
import furnitureCard from '../furnitureCard/index.vue'
|
|
|
|
+import RadarEditor from '@/components/RadarEditor/index.vue'
|
|
import {
|
|
import {
|
|
- RedoOutlined,
|
|
|
|
- UndoOutlined,
|
|
|
|
- ArrowUpOutlined,
|
|
|
|
- ArrowDownOutlined,
|
|
|
|
- ArrowLeftOutlined,
|
|
|
|
- ArrowRightOutlined,
|
|
|
|
|
|
+ // RedoOutlined,
|
|
|
|
+ // UndoOutlined,
|
|
|
|
+ // ArrowUpOutlined,
|
|
|
|
+ // ArrowDownOutlined,
|
|
|
|
+ // ArrowLeftOutlined,
|
|
|
|
+ // ArrowRightOutlined,
|
|
DeleteOutlined,
|
|
DeleteOutlined,
|
|
- QuestionCircleOutlined,
|
|
|
|
|
|
+ // QuestionCircleOutlined,
|
|
CloseOutlined,
|
|
CloseOutlined,
|
|
} from '@ant-design/icons-vue'
|
|
} from '@ant-design/icons-vue'
|
|
import { getOriginPosition } from '@/utils'
|
|
import { getOriginPosition } from '@/utils'
|
|
|
|
+import type { FurnitureItem } from '@/types/radar'
|
|
|
|
|
|
defineOptions({
|
|
defineOptions({
|
|
name: 'deviceAreaConfig',
|
|
name: 'deviceAreaConfig',
|
|
@@ -384,7 +399,8 @@ type Props = {
|
|
// x,y的范围,用于初始化画布的大小
|
|
// x,y的范围,用于初始化画布的大小
|
|
length: number
|
|
length: number
|
|
width: number
|
|
width: number
|
|
- ranges: number[] // 区域范围
|
|
|
|
|
|
+ ranges: [number, number, number, number] // 区域范围
|
|
|
|
+ angle: number // 设备角度,用于初始化画布的旋转角度
|
|
online?: SwitchType // 设备在线状态,用于判断是否可以保存配置
|
|
online?: SwitchType // 设备在线状态,用于判断是否可以保存配置
|
|
}
|
|
}
|
|
const emit = defineEmits<{
|
|
const emit = defineEmits<{
|
|
@@ -394,7 +410,7 @@ const props = withDefaults(defineProps<Props>(), {
|
|
devId: '',
|
|
devId: '',
|
|
length: 0, // 区域宽度
|
|
length: 0, // 区域宽度
|
|
width: 0, // 区域高度
|
|
width: 0, // 区域高度
|
|
- ranges: () => [], // 区域范围
|
|
|
|
|
|
+ ranges: () => [Infinity, Infinity, Infinity, Infinity], // 区域范围
|
|
online: 0,
|
|
online: 0,
|
|
})
|
|
})
|
|
|
|
|
|
@@ -460,6 +476,7 @@ const fetchRoomLayout = async () => {
|
|
rotate: item.rotate || 0,
|
|
rotate: item.rotate || 0,
|
|
x: item.x || 0,
|
|
x: item.x || 0,
|
|
y: item.y || 0,
|
|
y: item.y || 0,
|
|
|
|
+ nanoid: nanoid(),
|
|
}
|
|
}
|
|
})
|
|
})
|
|
}
|
|
}
|
|
@@ -516,6 +533,7 @@ interface CanvaseItem {
|
|
type: string // 类型,图标icon
|
|
type: string // 类型,图标icon
|
|
width: number // 家具宽度
|
|
width: number // 家具宽度
|
|
height: number // 家具长度
|
|
height: number // 家具长度
|
|
|
|
+ length?: number // 家具长度
|
|
top: number // 距离检测范围上方位置 cm
|
|
top: number // 距离检测范围上方位置 cm
|
|
left: number // 距离检测范围左边位置 cm
|
|
left: number // 距离检测范围左边位置 cm
|
|
rotate: number // 旋转角度: 0°,90°,180°,270°
|
|
rotate: number // 旋转角度: 0°,90°,180°,270°
|
|
@@ -526,13 +544,15 @@ interface CanvaseItem {
|
|
isDragging?: boolean // 是否拖拽 本地使用
|
|
isDragging?: boolean // 是否拖拽 本地使用
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+const radarEditorRef = ref<InstanceType<typeof RadarEditor>>()
|
|
|
|
+
|
|
// 画布上的家具列表
|
|
// 画布上的家具列表
|
|
const mapCanvasList = ref<CanvaseItem[]>([])
|
|
const mapCanvasList = ref<CanvaseItem[]>([])
|
|
const isEditDraggable = ref(false)
|
|
const isEditDraggable = ref(false)
|
|
// 家具列表添加
|
|
// 家具列表添加
|
|
-const addHnadler = (icon: FurnitureIconType) => {
|
|
|
|
- console.log('addHnadler', icon)
|
|
|
|
- // 检查画布上是否已经添加过了 icon 为 bed 的家具
|
|
|
|
|
|
+const addHandler = (icon: FurnitureIconType) => {
|
|
|
|
+ console.log('addHandler', icon)
|
|
|
|
+
|
|
if (icon === 'bed') {
|
|
if (icon === 'bed') {
|
|
const isExist = mapCanvasList.value.some((item) => item.type === icon)
|
|
const isExist = mapCanvasList.value.some((item) => item.type === icon)
|
|
if (isExist) {
|
|
if (isExist) {
|
|
@@ -541,27 +561,29 @@ const addHnadler = (icon: FurnitureIconType) => {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- // 家具原始宽高
|
|
|
|
const originWidth = furnitureIconSizeMap[icon].width || 30
|
|
const originWidth = furnitureIconSizeMap[icon].width || 30
|
|
const originHeight = furnitureIconSizeMap[icon].height || 30
|
|
const originHeight = furnitureIconSizeMap[icon].height || 30
|
|
- mapCanvasList.value.push({
|
|
|
|
|
|
+
|
|
|
|
+ const newItem: FurnitureItem = {
|
|
name: furnitureIconNameMap[icon],
|
|
name: furnitureIconNameMap[icon],
|
|
type: icon,
|
|
type: icon,
|
|
width: originWidth,
|
|
width: originWidth,
|
|
- height: originHeight,
|
|
|
|
|
|
+ length: originHeight,
|
|
top: 0,
|
|
top: 0,
|
|
left: 0,
|
|
left: 0,
|
|
rotate: 0,
|
|
rotate: 0,
|
|
- x: originOffsetX,
|
|
|
|
- y: originOffsetY,
|
|
|
|
|
|
+ x: 0,
|
|
|
|
+ y: 0,
|
|
|
|
+ // x: originOffsetX,
|
|
|
|
+ // y: originOffsetY,
|
|
nanoid: nanoid(),
|
|
nanoid: nanoid(),
|
|
- isActice: false,
|
|
|
|
- })
|
|
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ radarEditorRef.value?.addFurniture(newItem)
|
|
message.success('已添加家具')
|
|
message.success('已添加家具')
|
|
|
|
+
|
|
if (icon === 'bed') {
|
|
if (icon === 'bed') {
|
|
- // 同步添加一个子区域
|
|
|
|
blocks.value.unshift({
|
|
blocks.value.unshift({
|
|
- // 本地用
|
|
|
|
id: nanoid(),
|
|
id: nanoid(),
|
|
x: 20,
|
|
x: 20,
|
|
y: 15,
|
|
y: 15,
|
|
@@ -575,7 +597,6 @@ const addHnadler = (icon: FurnitureIconType) => {
|
|
isTracking: false,
|
|
isTracking: false,
|
|
isFalling: false,
|
|
isFalling: false,
|
|
isBed: true,
|
|
isBed: true,
|
|
- // 接口用
|
|
|
|
startXx: -150,
|
|
startXx: -150,
|
|
stopXx: -100,
|
|
stopXx: -100,
|
|
startYy: 180,
|
|
startYy: 180,
|
|
@@ -589,7 +610,6 @@ const addHnadler = (icon: FurnitureIconType) => {
|
|
trackPresence: 0,
|
|
trackPresence: 0,
|
|
excludeFalling: 0,
|
|
excludeFalling: 0,
|
|
})
|
|
})
|
|
- console.log('blocks', blocks.value)
|
|
|
|
message.success('已添加子区域')
|
|
message.success('已添加子区域')
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -617,136 +637,136 @@ useDropZone(contentEl, {
|
|
})
|
|
})
|
|
|
|
|
|
// 家具列表元素开始拖拽
|
|
// 家具列表元素开始拖拽
|
|
-const onDragstartListItem = (event: DragEvent, item: CanvaseItem) => {
|
|
|
|
- console.log('🔥onDragstartListItem', event, item)
|
|
|
|
- currentDragItem.value = item
|
|
|
|
- item.isDragging = true
|
|
|
|
-
|
|
|
|
- // 创建拖拽镜像
|
|
|
|
- const target = event.currentTarget as HTMLElement
|
|
|
|
- const clone = target.cloneNode(true) as HTMLElement
|
|
|
|
- const rect = target.getBoundingClientRect()
|
|
|
|
- // 获取实际渲染样式
|
|
|
|
- const computedStyle = window.getComputedStyle(target)
|
|
|
|
- // 复制所有关键样式
|
|
|
|
- clone.style.cssText = `
|
|
|
|
- position: fixed;
|
|
|
|
- left: -9999px;
|
|
|
|
- opacity: 0.5;
|
|
|
|
- pointer-events: none;
|
|
|
|
- width: ${rect.width}px;
|
|
|
|
- height: ${rect.height}px;
|
|
|
|
- transform: ${computedStyle.transform || `rotate(${item.rotate}deg)`};
|
|
|
|
- transform-origin: ${computedStyle.transformOrigin || 'center center'};
|
|
|
|
- border: ${computedStyle.border};
|
|
|
|
- box-shadow: ${computedStyle.boxShadow};
|
|
|
|
- background: ${computedStyle.background};
|
|
|
|
- `
|
|
|
|
- console.log('克隆元素尺寸:', clone.style.cssText)
|
|
|
|
- document.body.appendChild(clone)
|
|
|
|
- // 计算中心点偏移量
|
|
|
|
- const offsetX = rect.width / 2 // 水平中心偏移
|
|
|
|
- const offsetY = rect.height / 2 // 垂直中心偏移
|
|
|
|
- // 设置拖拽镜像和偏移量
|
|
|
|
- event.dataTransfer?.setDragImage(clone, offsetX, offsetY)
|
|
|
|
- // 隐藏原元素
|
|
|
|
- target.style.opacity = '0'
|
|
|
|
-}
|
|
|
|
|
|
+// const onDragstartListItem = (event: DragEvent, item: CanvaseItem) => {
|
|
|
|
+// console.log('🔥onDragstartListItem', event, item)
|
|
|
|
+// currentDragItem.value = item
|
|
|
|
+// item.isDragging = true
|
|
|
|
+
|
|
|
|
+// // 创建拖拽镜像
|
|
|
|
+// const target = event.currentTarget as HTMLElement
|
|
|
|
+// const clone = target.cloneNode(true) as HTMLElement
|
|
|
|
+// const rect = target.getBoundingClientRect()
|
|
|
|
+// // 获取实际渲染样式
|
|
|
|
+// const computedStyle = window.getComputedStyle(target)
|
|
|
|
+// // 复制所有关键样式
|
|
|
|
+// clone.style.cssText = `
|
|
|
|
+// position: fixed;
|
|
|
|
+// left: -9999px;
|
|
|
|
+// opacity: 0.5;
|
|
|
|
+// pointer-events: none;
|
|
|
|
+// width: ${rect.width}px;
|
|
|
|
+// height: ${rect.height}px;
|
|
|
|
+// transform: ${computedStyle.transform || `rotate(${item.rotate}deg)`};
|
|
|
|
+// transform-origin: ${computedStyle.transformOrigin || 'center center'};
|
|
|
|
+// border: ${computedStyle.border};
|
|
|
|
+// box-shadow: ${computedStyle.boxShadow};
|
|
|
|
+// background: ${computedStyle.background};
|
|
|
|
+// `
|
|
|
|
+// console.log('克隆元素尺寸:', clone.style.cssText)
|
|
|
|
+// document.body.appendChild(clone)
|
|
|
|
+// // 计算中心点偏移量
|
|
|
|
+// const offsetX = rect.width / 2 // 水平中心偏移
|
|
|
|
+// const offsetY = rect.height / 2 // 垂直中心偏移
|
|
|
|
+// // 设置拖拽镜像和偏移量
|
|
|
|
+// event.dataTransfer?.setDragImage(clone, offsetX, offsetY)
|
|
|
|
+// // 隐藏原元素
|
|
|
|
+// target.style.opacity = '0'
|
|
|
|
+// }
|
|
|
|
|
|
// 家具列表元素结束拖拽
|
|
// 家具列表元素结束拖拽
|
|
-const onDragendEndListItem = (event: DragEvent, item: CanvaseItem) => {
|
|
|
|
- item.isDragging = false
|
|
|
|
- if (currentDragItem.value) {
|
|
|
|
- currentDragItem.value.x = originOffsetX
|
|
|
|
- currentDragItem.value.y = originOffsetY
|
|
|
|
- currentDragItem.value.isDragging = false
|
|
|
|
- }
|
|
|
|
- requestAnimationFrame(() => {
|
|
|
|
- item.isActice = true
|
|
|
|
- clickedDragItem.value = item
|
|
|
|
- })
|
|
|
|
- console.log('🔥onDragendEndListItem', event, item, {
|
|
|
|
- x: currentDragItem.value?.x,
|
|
|
|
- y: currentDragItem.value?.y,
|
|
|
|
- })
|
|
|
|
- if (event.currentTarget) {
|
|
|
|
- ;(event.currentTarget as HTMLElement).style.opacity = '1'
|
|
|
|
- }
|
|
|
|
-}
|
|
|
|
|
|
+// const onDragendEndListItem = (event: DragEvent, item: CanvaseItem) => {
|
|
|
|
+// item.isDragging = false
|
|
|
|
+// if (currentDragItem.value) {
|
|
|
|
+// currentDragItem.value.x = originOffsetX
|
|
|
|
+// currentDragItem.value.y = originOffsetY
|
|
|
|
+// currentDragItem.value.isDragging = false
|
|
|
|
+// }
|
|
|
|
+// requestAnimationFrame(() => {
|
|
|
|
+// item.isActice = true
|
|
|
|
+// clickedDragItem.value = item
|
|
|
|
+// })
|
|
|
|
+// console.log('🔥onDragendEndListItem', event, item, {
|
|
|
|
+// x: currentDragItem.value?.x,
|
|
|
|
+// y: currentDragItem.value?.y,
|
|
|
|
+// })
|
|
|
|
+// if (event.currentTarget) {
|
|
|
|
+// ;(event.currentTarget as HTMLElement).style.opacity = '1'
|
|
|
|
+// }
|
|
|
|
+// }
|
|
|
|
|
|
const clickedDragItem = ref<CanvaseItem | null>()
|
|
const clickedDragItem = ref<CanvaseItem | null>()
|
|
-const onClickMapItem = (event: MouseEvent, item: CanvaseItem) => {
|
|
|
|
- if (!isEditDraggable.value || item.type === 'radar' || item.isDragging) return
|
|
|
|
- console.log('onClickMapItem', event, item)
|
|
|
|
- item.isActice = true
|
|
|
|
- clickedDragItem.value = item
|
|
|
|
-}
|
|
|
|
-
|
|
|
|
-const handleMouseDownMapCanvas = () => {
|
|
|
|
- mapCanvasList.value.forEach((item) => {
|
|
|
|
- item.isActice = false
|
|
|
|
- })
|
|
|
|
- clickedDragItem.value = null
|
|
|
|
-}
|
|
|
|
|
|
+// const onClickMapItem = (event: MouseEvent, item: CanvaseItem) => {
|
|
|
|
+// if (!isEditDraggable.value || item.type === 'radar' || item.isDragging) return
|
|
|
|
+// console.log('onClickMapItem', event, item)
|
|
|
|
+// item.isActice = true
|
|
|
|
+// clickedDragItem.value = item
|
|
|
|
+// }
|
|
|
|
+
|
|
|
|
+// const handleMouseDownMapCanvas = () => {
|
|
|
|
+mapCanvasList.value.forEach((item) => {
|
|
|
|
+ item.isActice = false
|
|
|
|
+})
|
|
|
|
+clickedDragItem.value = null
|
|
|
|
+// }
|
|
|
|
|
|
// 家具旋转
|
|
// 家具旋转
|
|
-const rotateFurnitureIcon = (type: number, nanoid: string) => {
|
|
|
|
- console.log('rotateFurnitureIcon', type, nanoid, mapCanvasList.value)
|
|
|
|
- const rotateMap = [0, 90, 180, 270]
|
|
|
|
-
|
|
|
|
- if (nanoid) {
|
|
|
|
- mapCanvasList.value.forEach((item) => {
|
|
|
|
- if (item.nanoid === nanoid) {
|
|
|
|
- // 获取当前角度在rotateMap中的索引
|
|
|
|
- const currentIndex = rotateMap.indexOf(item.rotate)
|
|
|
|
-
|
|
|
|
- if (type === 1) {
|
|
|
|
- // 逆时针(索引递减)
|
|
|
|
- const newIndex = (currentIndex - 1 + rotateMap.length) % rotateMap.length
|
|
|
|
- item.rotate = rotateMap[newIndex]
|
|
|
|
- } else if (type === 2) {
|
|
|
|
- // 顺时针(索引递增)
|
|
|
|
- const newIndex = (currentIndex + 1) % rotateMap.length
|
|
|
|
- item.rotate = rotateMap[newIndex]
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- })
|
|
|
|
- }
|
|
|
|
-}
|
|
|
|
|
|
+// const rotateFurnitureIcon = (type: number, nanoid: string) => {
|
|
|
|
+// console.log('rotateFurnitureIcon', type, nanoid, mapCanvasList.value)
|
|
|
|
+// const rotateMap = [0, 90, 180, 270]
|
|
|
|
+
|
|
|
|
+// if (nanoid) {
|
|
|
|
+// mapCanvasList.value.forEach((item) => {
|
|
|
|
+// if (item.nanoid === nanoid) {
|
|
|
|
+// // 获取当前角度在rotateMap中的索引
|
|
|
|
+// const currentIndex = rotateMap.indexOf(item.rotate)
|
|
|
|
+
|
|
|
|
+// if (type === 1) {
|
|
|
|
+// // 逆时针(索引递减)
|
|
|
|
+// const newIndex = (currentIndex - 1 + rotateMap.length) % rotateMap.length
|
|
|
|
+// item.rotate = rotateMap[newIndex]
|
|
|
|
+// } else if (type === 2) {
|
|
|
|
+// // 顺时针(索引递增)
|
|
|
|
+// const newIndex = (currentIndex + 1) % rotateMap.length
|
|
|
|
+// item.rotate = rotateMap[newIndex]
|
|
|
|
+// }
|
|
|
|
+// }
|
|
|
|
+// })
|
|
|
|
+// }
|
|
|
|
+// }
|
|
|
|
|
|
// 微调距离
|
|
// 微调距离
|
|
-const distance = ref(5)
|
|
|
|
|
|
+// const distance = ref(5)
|
|
// 家具位置微调
|
|
// 家具位置微调
|
|
-const positonFurnitureIcon = (type: string, nanoid: string, distance: number) => {
|
|
|
|
- console.log('positonFurnitureIcon', type, nanoid, mapCanvasList.value)
|
|
|
|
- if (nanoid) {
|
|
|
|
- mapCanvasList.value.forEach((item) => {
|
|
|
|
- if (item.nanoid === nanoid) {
|
|
|
|
- if (type === 'up') {
|
|
|
|
- item.top -= distance
|
|
|
|
- }
|
|
|
|
- if (type === 'down') {
|
|
|
|
- item.top += distance
|
|
|
|
- }
|
|
|
|
- if (type === 'left') {
|
|
|
|
- item.left -= distance
|
|
|
|
- }
|
|
|
|
- if (type === 'right') {
|
|
|
|
- item.left += distance
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- })
|
|
|
|
- }
|
|
|
|
-}
|
|
|
|
|
|
+// const positonFurnitureIcon = (type: string, nanoid: string, distance: number) => {
|
|
|
|
+// console.log('positonFurnitureIcon', type, nanoid, mapCanvasList.value)
|
|
|
|
+// if (nanoid) {
|
|
|
|
+// mapCanvasList.value.forEach((item) => {
|
|
|
|
+// if (item.nanoid === nanoid) {
|
|
|
|
+// if (type === 'up') {
|
|
|
|
+// item.top -= distance
|
|
|
|
+// }
|
|
|
|
+// if (type === 'down') {
|
|
|
|
+// item.top += distance
|
|
|
|
+// }
|
|
|
|
+// if (type === 'left') {
|
|
|
|
+// item.left -= distance
|
|
|
|
+// }
|
|
|
|
+// if (type === 'right') {
|
|
|
|
+// item.left += distance
|
|
|
|
+// }
|
|
|
|
+// }
|
|
|
|
+// })
|
|
|
|
+// }
|
|
|
|
+// }
|
|
|
|
|
|
// 删除家具
|
|
// 删除家具
|
|
-const deleteFurnitureIcon = (nanoid: string) => {
|
|
|
|
- console.log('deleteFurnitureIcon', clickedDragItem.value)
|
|
|
|
- if (nanoid) {
|
|
|
|
- mapCanvasList.value = mapCanvasList.value.filter((item) => item.nanoid !== nanoid)
|
|
|
|
- clickedDragItem.value = null
|
|
|
|
- }
|
|
|
|
-}
|
|
|
|
|
|
+// const deleteFurnitureIcon = (nanoid: string) => {
|
|
|
|
+// console.log('deleteFurnitureIcon', clickedDragItem.value)
|
|
|
|
+// if (nanoid) {
|
|
|
|
+// mapCanvasList.value = mapCanvasList.value.filter((item) => item.nanoid !== nanoid)
|
|
|
|
+// clickedDragItem.value = null
|
|
|
|
+// }
|
|
|
|
+// }
|
|
|
|
|
|
// 关闭子区域属性
|
|
// 关闭子区域属性
|
|
const closeSubregionAttr = () => {
|
|
const closeSubregionAttr = () => {
|
|
@@ -757,13 +777,13 @@ const closeSubregionAttr = () => {
|
|
}
|
|
}
|
|
|
|
|
|
// 删除家具床
|
|
// 删除家具床
|
|
-const deleteFurnitureBed = (nanoid: string) => {
|
|
|
|
- console.log('deleteFurnitureBed', nanoid)
|
|
|
|
- // 先从家具画布移除床
|
|
|
|
- deleteFurnitureIcon(nanoid)
|
|
|
|
- // 再从子区域画布删除对应的子区域
|
|
|
|
- blocks.value.shift()
|
|
|
|
-}
|
|
|
|
|
|
+// const deleteFurnitureBed = (nanoid: string) => {
|
|
|
|
+// console.log('deleteFurnitureBed', nanoid)
|
|
|
|
+// // 先从家具画布移除床
|
|
|
|
+// deleteFurnitureIcon(nanoid)
|
|
|
|
+// // 再从子区域画布删除对应的子区域
|
|
|
|
+// blocks.value.shift()
|
|
|
|
+// }
|
|
|
|
|
|
// 新增区块类型
|
|
// 新增区块类型
|
|
interface BlockItem {
|
|
interface BlockItem {
|
|
@@ -957,30 +977,30 @@ const { originX, originY, originOffsetX, originOffsetY, radarX, radarY } = getOr
|
|
const initRadarIcon = () => {
|
|
const initRadarIcon = () => {
|
|
console.log('initRadarIcon', mapCanvasList.value, furnitureItems.value)
|
|
console.log('initRadarIcon', mapCanvasList.value, furnitureItems.value)
|
|
// 在家具地图添加雷达图标
|
|
// 在家具地图添加雷达图标
|
|
- mapCanvasList.value.push({
|
|
|
|
- name: '雷达',
|
|
|
|
- type: 'radar',
|
|
|
|
- width: furnitureIconSizeMap['radar'].width,
|
|
|
|
- height: furnitureIconSizeMap['radar'].height,
|
|
|
|
- top: radarY,
|
|
|
|
- left: radarX,
|
|
|
|
- x: originOffsetX,
|
|
|
|
- y: originOffsetY,
|
|
|
|
- rotate: 0,
|
|
|
|
- nanoid: nanoid(),
|
|
|
|
- })
|
|
|
|
|
|
+ // mapCanvasList.value.push({
|
|
|
|
+ // name: '雷达',
|
|
|
|
+ // type: 'radar',
|
|
|
|
+ // width: furnitureIconSizeMap['radar'].width,
|
|
|
|
+ // height: furnitureIconSizeMap['radar'].height,
|
|
|
|
+ // top: radarY,
|
|
|
|
+ // left: radarX,
|
|
|
|
+ // x: originOffsetX,
|
|
|
|
+ // y: originOffsetY,
|
|
|
|
+ // rotate: 0,
|
|
|
|
+ // nanoid: nanoid(),
|
|
|
|
+ // })
|
|
// 在屏蔽子区域添加雷达图标
|
|
// 在屏蔽子区域添加雷达图标
|
|
- furnitureItems.value.push({
|
|
|
|
- name: '雷达',
|
|
|
|
- type: 'radar',
|
|
|
|
- width: furnitureIconSizeMap['radar'].width,
|
|
|
|
- length: furnitureIconSizeMap['radar'].height,
|
|
|
|
- top: radarY,
|
|
|
|
- left: radarX,
|
|
|
|
- x: originOffsetX,
|
|
|
|
- y: originOffsetY,
|
|
|
|
- rotate: 0,
|
|
|
|
- })
|
|
|
|
|
|
+ // furnitureItems.value.push({
|
|
|
|
+ // name: '雷达',
|
|
|
|
+ // type: 'radar',
|
|
|
|
+ // width: furnitureIconSizeMap['radar'].width,
|
|
|
|
+ // length: furnitureIconSizeMap['radar'].height,
|
|
|
|
+ // top: radarY,
|
|
|
|
+ // left: radarX,
|
|
|
|
+ // x: originOffsetX,
|
|
|
|
+ // y: originOffsetY,
|
|
|
|
+ // rotate: 0,
|
|
|
|
+ // })
|
|
}
|
|
}
|
|
|
|
|
|
// 保存所有配置
|
|
// 保存所有配置
|
|
@@ -1014,7 +1034,7 @@ const saveAllConfig = () => {
|
|
name: item.name,
|
|
name: item.name,
|
|
type: item.type as FurnitureType,
|
|
type: item.type as FurnitureType,
|
|
width: item.width,
|
|
width: item.width,
|
|
- length: item.height,
|
|
|
|
|
|
+ length: item.height || item.length,
|
|
top: item.top,
|
|
top: item.top,
|
|
left: item.left,
|
|
left: item.left,
|
|
rotate: item.rotate as 0 | 90 | 180 | 270,
|
|
rotate: item.rotate as 0 | 90 | 180 | 270,
|
|
@@ -1125,7 +1145,6 @@ const deleteBlockArea = (id: string) => {
|
|
padding: 10px;
|
|
padding: 10px;
|
|
min-width: 500px;
|
|
min-width: 500px;
|
|
flex-shrink: 0;
|
|
flex-shrink: 0;
|
|
- // margin-top: 10px;
|
|
|
|
|
|
|
|
&-header {
|
|
&-header {
|
|
display: flex;
|
|
display: flex;
|