|
@@ -10,95 +10,6 @@
|
|
|
<furnitureIcon :icon="localItem.type" :width="localItem.width" :height="localItem.length" />
|
|
|
</div>
|
|
|
</div>
|
|
|
-
|
|
|
- <div
|
|
|
- v-if="false"
|
|
|
- class="property-panel"
|
|
|
- :style="{ left: `${panelPosition.left}px`, top: `${panelPosition.top}px` }"
|
|
|
- @mousedown.stop
|
|
|
- >
|
|
|
- <div class="panel-header" @mousedown.prevent="startPanelDrag">
|
|
|
- <div class="title">{{ localItem.name }} 属性</div>
|
|
|
- <div class="close" @click="showPanel = false">×</div>
|
|
|
- <div class="capsule" @mousedown.prevent="startPanelDrag"></div>
|
|
|
- </div>
|
|
|
-
|
|
|
- <div class="panel-item">
|
|
|
- <label>家具尺寸:</label>
|
|
|
- <a-space>
|
|
|
- <a-input-number
|
|
|
- v-model:value="localItem.width"
|
|
|
- :min="10"
|
|
|
- size="small"
|
|
|
- @change="onSizeChange"
|
|
|
- />
|
|
|
- <a-input-number
|
|
|
- v-model:value="localItem.length"
|
|
|
- :min="10"
|
|
|
- size="small"
|
|
|
- @change="onSizeChange"
|
|
|
- />
|
|
|
- </a-space>
|
|
|
- </div>
|
|
|
-
|
|
|
- <div class="panel-item">
|
|
|
- <label>家具旋转:</label>
|
|
|
- <a-select v-model:value="localItem.rotate" size="small" @change="onRotateChange">
|
|
|
- <a-select-option :value="0">0°</a-select-option>
|
|
|
- <a-select-option :value="90">90°</a-select-option>
|
|
|
- <a-select-option :value="180">180°</a-select-option>
|
|
|
- <a-select-option :value="270">270°</a-select-option>
|
|
|
- </a-select>
|
|
|
- </div>
|
|
|
-
|
|
|
- <div class="panel-item">
|
|
|
- <label>位置微调:</label>
|
|
|
- <a-space>
|
|
|
- <ArrowLeftOutlined @click="nudge('left')" />
|
|
|
- <ArrowUpOutlined @click="nudge('up')" />
|
|
|
- <ArrowDownOutlined @click="nudge('down')" />
|
|
|
- <ArrowRightOutlined @click="nudge('right')" />
|
|
|
- <a-input-number v-model:value="nudgeStep" :min="1" size="small" style="width: 60px" />
|
|
|
- </a-space>
|
|
|
- </div>
|
|
|
-
|
|
|
- <div class="panel-item">
|
|
|
- <label>left/top:</label>
|
|
|
- <a-space>
|
|
|
- <a-input-number
|
|
|
- v-model:value="localItem.left"
|
|
|
- @change="updateByGeoCoords"
|
|
|
- disabled
|
|
|
- size="small"
|
|
|
- />
|
|
|
- <a-input-number
|
|
|
- v-model:value="localItem.top"
|
|
|
- @change="updateByGeoCoords"
|
|
|
- disabled
|
|
|
- size="small"
|
|
|
- />
|
|
|
- </a-space>
|
|
|
- </div>
|
|
|
-
|
|
|
- <div class="panel-item">
|
|
|
- <label>x/y:</label>
|
|
|
- <a-space>
|
|
|
- <a-input-number v-model:value="localItem.x" @change="updateByGeoCoords" size="small" />
|
|
|
- <a-input-number v-model:value="localItem.y" @change="updateByGeoCoords" size="small" />
|
|
|
- </a-space>
|
|
|
- </div>
|
|
|
-
|
|
|
- <div class="panel-item">
|
|
|
- <label>操作:</label>
|
|
|
- <a-space>
|
|
|
- <a-popconfirm title="确定要删除该家具吗?" @confirm="emit('delete', localItem.nanoid!)">
|
|
|
- <a-button danger size="small">删除</a-button>
|
|
|
- </a-popconfirm>
|
|
|
- </a-space>
|
|
|
- </div>
|
|
|
-
|
|
|
- <pre>{{ localItem }}</pre>
|
|
|
- </div>
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
@@ -106,13 +17,6 @@
|
|
|
import { reactive, watch, ref, computed, onMounted, nextTick, type CSSProperties } from 'vue'
|
|
|
import type { FurnitureItem } from '@/types/radar'
|
|
|
import furnitureIcon from '../furnitureIcon/index.vue'
|
|
|
-// import type { FurnitureIconType } from '@/types/furniture'
|
|
|
-import {
|
|
|
- ArrowLeftOutlined,
|
|
|
- ArrowUpOutlined,
|
|
|
- ArrowDownOutlined,
|
|
|
- ArrowRightOutlined,
|
|
|
-} from '@ant-design/icons-vue'
|
|
|
import type { FurnitureType } from '@/api/room/types'
|
|
|
|
|
|
defineOptions({ name: 'EditableFurniture' })
|
|
@@ -138,7 +42,7 @@ const emit = defineEmits<{
|
|
|
}>()
|
|
|
|
|
|
const showPanel = ref(false)
|
|
|
-const nudgeStep = ref(5)
|
|
|
+// const nudgeStep = ref(5)
|
|
|
// const showDebug = ref(true) // 调试模式
|
|
|
|
|
|
// 坐标转换函数
|
|
@@ -344,24 +248,24 @@ onMounted(() => {
|
|
|
})
|
|
|
|
|
|
// 通过地理坐标更新
|
|
|
-const updateByGeoCoords = () => {
|
|
|
- updatePixelPosition()
|
|
|
- emit('update', { ...localItem })
|
|
|
-}
|
|
|
+// const updateByGeoCoords = () => {
|
|
|
+// updatePixelPosition()
|
|
|
+// emit('update', { ...localItem })
|
|
|
+// }
|
|
|
|
|
|
// 尺寸变化处理
|
|
|
-const onSizeChange = () => {
|
|
|
- updatePixelPosition()
|
|
|
- setPanelInitialPosition()
|
|
|
- emit('update', { ...localItem })
|
|
|
-}
|
|
|
+// const onSizeChange = () => {
|
|
|
+// updatePixelPosition()
|
|
|
+// setPanelInitialPosition()
|
|
|
+// emit('update', { ...localItem })
|
|
|
+// }
|
|
|
|
|
|
// 旋转变化处理
|
|
|
-const onRotateChange = () => {
|
|
|
- updatePixelPosition()
|
|
|
- setPanelInitialPosition()
|
|
|
- emit('update', { ...localItem })
|
|
|
-}
|
|
|
+// const onRotateChange = () => {
|
|
|
+// updatePixelPosition()
|
|
|
+// setPanelInitialPosition()
|
|
|
+// emit('update', { ...localItem })
|
|
|
+// }
|
|
|
|
|
|
// 拖拽家具
|
|
|
const startDrag = (e: MouseEvent) => {
|
|
@@ -394,49 +298,49 @@ const startDrag = (e: MouseEvent) => {
|
|
|
}
|
|
|
|
|
|
// 面板拖拽
|
|
|
-const startPanelDrag = (e: MouseEvent) => {
|
|
|
- e.preventDefault()
|
|
|
- e.stopPropagation()
|
|
|
+// const startPanelDrag = (e: MouseEvent) => {
|
|
|
+// e.preventDefault()
|
|
|
+// e.stopPropagation()
|
|
|
|
|
|
- const startX = e.clientX
|
|
|
- const startY = e.clientY
|
|
|
- const initLeft = panelPosition.left
|
|
|
- const initTop = panelPosition.top
|
|
|
+// const startX = e.clientX
|
|
|
+// const startY = e.clientY
|
|
|
+// const initLeft = panelPosition.left
|
|
|
+// const initTop = panelPosition.top
|
|
|
|
|
|
- const onMove = (ev: MouseEvent) => {
|
|
|
- panelPosition.left = initLeft + (ev.clientX - startX)
|
|
|
- panelPosition.top = initTop + (ev.clientY - startY)
|
|
|
- }
|
|
|
+// const onMove = (ev: MouseEvent) => {
|
|
|
+// panelPosition.left = initLeft + (ev.clientX - startX)
|
|
|
+// panelPosition.top = initTop + (ev.clientY - startY)
|
|
|
+// }
|
|
|
|
|
|
- const onUp = () => {
|
|
|
- window.removeEventListener('mousemove', onMove)
|
|
|
- window.removeEventListener('mouseup', onUp)
|
|
|
- }
|
|
|
+// const onUp = () => {
|
|
|
+// window.removeEventListener('mousemove', onMove)
|
|
|
+// window.removeEventListener('mouseup', onUp)
|
|
|
+// }
|
|
|
|
|
|
- window.addEventListener('mousemove', onMove)
|
|
|
- window.addEventListener('mouseup', onUp)
|
|
|
-}
|
|
|
+// window.addEventListener('mousemove', onMove)
|
|
|
+// window.addEventListener('mouseup', onUp)
|
|
|
+// }
|
|
|
|
|
|
// 微调功能
|
|
|
-const nudge = (direction: 'left' | 'right' | 'up' | 'down') => {
|
|
|
- const step = nudgeStep.value
|
|
|
- switch (direction) {
|
|
|
- case 'left':
|
|
|
- pixelPosition.left -= step
|
|
|
- break
|
|
|
- case 'right':
|
|
|
- pixelPosition.left += step
|
|
|
- break
|
|
|
- case 'up':
|
|
|
- pixelPosition.top -= step
|
|
|
- break
|
|
|
- case 'down':
|
|
|
- pixelPosition.top += step
|
|
|
- break
|
|
|
- }
|
|
|
- updateGeoPosition()
|
|
|
- emit('update', { ...localItem })
|
|
|
-}
|
|
|
+// const nudge = (direction: 'left' | 'right' | 'up' | 'down') => {
|
|
|
+// const step = nudgeStep.value
|
|
|
+// switch (direction) {
|
|
|
+// case 'left':
|
|
|
+// pixelPosition.left -= step
|
|
|
+// break
|
|
|
+// case 'right':
|
|
|
+// pixelPosition.left += step
|
|
|
+// break
|
|
|
+// case 'up':
|
|
|
+// pixelPosition.top -= step
|
|
|
+// break
|
|
|
+// case 'down':
|
|
|
+// pixelPosition.top += step
|
|
|
+// break
|
|
|
+// }
|
|
|
+// updateGeoPosition()
|
|
|
+// emit('update', { ...localItem })
|
|
|
+// }
|
|
|
</script>
|
|
|
|
|
|
<style scoped lang="less">
|