粘贴不显示问题

This commit is contained in:
yyy 2025-02-24 10:27:20 +08:00
parent 982584acc7
commit 17dd7260fc

View File

@ -229,7 +229,7 @@
> >
<VueDragResizeRotate <VueDragResizeRotate
v-for="(item, index) in state.allMapPointInfo" v-for="(item, index) in state.allMapPointInfo"
:key="item.locationX" :key="index"
:parent="true" :parent="true"
:x="Number(item.locationX) - Number(item.locationWide) / 2" :x="Number(item.locationX) - Number(item.locationWide) / 2"
:y="Number(item.locationY) - Number(item.locationDeep) / 2" :y="Number(item.locationY) - Number(item.locationDeep) / 2"
@ -1151,31 +1151,11 @@ const toolbarClick = (item) => {
break break
case 'copy': case 'copy':
// //
let copyMapItem = state.allMapPointInfo[state.currentItemIndex] replicationNode()
state.copyMapItem = {
positionMapId: copyMapItem.positionMapId,
locationX: copyMapItem.locationX,
locationY: copyMapItem.locationY,
type: copyMapItem.type,
dataJson: copyMapItem.dataJson || '',
dataObj: copyMapItem.dataObj || {},
dataList: copyMapItem.dataList || [],
locationDeep: copyMapItem.locationDeep,
locationWide: copyMapItem.locationWide,
draggable: copyMapItem.draggable,
resizable: copyMapItem.resizable,
rotatable: copyMapItem.rotatable,
lockAspectRatio: copyMapItem.lockAspectRatio
}
message.success('复制成功')
break break
case 'paste': case 'paste':
// //
let copyObj = JSON.parse(JSON.stringify(state.copyMapItem)) pasteNode()
copyObj.locationX = Number(copyObj.locationX) + 50
copyObj.locationY = Number(copyObj.locationY) + 50
state.allMapPointInfo.push(copyObj)
addEditHistory()
break break
case 'delete': case 'delete':
// //
@ -1303,6 +1283,43 @@ const toolbarClick = (item) => {
} }
} }
//
const replicationNode = () => {
let copyMapItem = state.allMapPointInfo[state.currentItemIndex]
let locationX = Number(copyMapItem.locationX) + 20
let locationY = Number(copyMapItem.locationY) + 20
let actualPoint = disposeEventPoint(locationX, locationY)
state.copyMapItem = {
positionMapId: copyMapItem.positionMapId,
locationX: locationX,
locationY: locationY,
actualLocationX: actualPoint.actualLocationX,
actualLocationY: actualPoint.actualLocationY,
type: copyMapItem.type,
dataJson: copyMapItem.dataJson || '',
dataObj: copyMapItem.dataObj || {},
dataList: copyMapItem.dataList || [],
locationDeep: copyMapItem.locationDeep,
locationWide: copyMapItem.locationWide,
draggable: copyMapItem.draggable,
resizable: copyMapItem.resizable,
rotatable: copyMapItem.rotatable,
lockAspectRatio: copyMapItem.lockAspectRatio,
layerSelectionShow: copyMapItem.layerSelectionShow,
mapImageUrl: copyMapItem.mapImageUrl,
areaId: copyMapItem.areaId
}
message.success('复制成功')
}
//
const pasteNode = () => {
let copyObj = JSON.parse(JSON.stringify(state.copyMapItem))
state.allMapPointInfo.push(copyObj)
message.success('粘贴成功')
addEditHistory()
}
// //
const moveFormSubmit = () => { const moveFormSubmit = () => {
state.allMapPointInfo[state.currentItemIndex].locationX = Number(state.moveForm.locationX) state.allMapPointInfo[state.currentItemIndex].locationX = Number(state.moveForm.locationX)
@ -1318,6 +1335,7 @@ const rotationFormSubmit = () => {
// //
// //
const startFromPoint = (index, event) => { const startFromPoint = (index, event) => {
if (toolbarSwitchType.value === 'clickDrawRoute') {
let list = state.allMapPointInfo let list = state.allMapPointInfo
const point = list[index] const point = list[index]
if (point.id) { if (point.id) {
@ -1335,6 +1353,7 @@ const startFromPoint = (index, event) => {
state.currentDrawY = 0 state.currentDrawY = 0
} }
} }
}
// //
const startDrawSelection = (event) => { const startDrawSelection = (event) => {
if ( if (
@ -1410,7 +1429,11 @@ const endDrawSelection = (event) => {
// //
const endPointIndex = findClosestPoint(state.currentDrawX, state.currentDrawY) const endPointIndex = findClosestPoint(state.currentDrawX, state.currentDrawY)
if (!endPointIndex.id) { if (endPointIndex !== null && endPointIndex !== state.startDrawPointIndex) {
let list = state.allMapPointInfo
const endPoint = list[endPointIndex]
if (!endPoint.id) {
message.warning('选择的节点未保存') message.warning('选择的节点未保存')
// //
state.startDrawPointIndex = -1 // state.startDrawPointIndex = -1 //
@ -1421,9 +1444,6 @@ const endDrawSelection = (event) => {
return return
} }
if (endPointIndex !== null && endPointIndex !== state.startDrawPointIndex) {
let list = state.allMapPointInfo
const endPoint = list[endPointIndex]
const newLine = { const newLine = {
startPointX: state.startDrawPoint.locationX, startPointX: state.startDrawPoint.locationX,
startPointY: state.startDrawPoint.locationY, startPointY: state.startDrawPoint.locationY,
@ -2068,42 +2088,25 @@ window.document.oncontextmenu = function () {
const handleKeyDown = (event) => { const handleKeyDown = (event) => {
if (event.ctrlKey) { if (event.ctrlKey) {
if (event.key === 'c') { if (event.key === 'c') {
//
if (state.currentItemIndex === -1) { if (state.currentItemIndex === -1) {
message.warning('请先选择要操作的对象') message.warning('请先选择要操作的对象')
return return
} }
let copyMapItem = state.allMapPointInfo[state.currentItemIndex] replicationNode()
state.copyMapItem = {
positionMapId: copyMapItem.positionMapId,
locationX: copyMapItem.locationX,
locationY: copyMapItem.locationY,
type: copyMapItem.type,
dataJson: copyMapItem.dataJson || '',
dataObj: copyMapItem.dataObj || {},
dataList: copyMapItem.dataList || [],
locationDeep: copyMapItem.locationDeep,
locationWide: copyMapItem.locationWide,
draggable: copyMapItem.draggable,
resizable: copyMapItem.resizable,
rotatable: copyMapItem.rotatable,
lockAspectRatio: copyMapItem.lockAspectRatio
}
message.success('复制成功')
} else if (event.key === 'v') { } else if (event.key === 'v') {
// //
if (!state.copyMapItem) { if (!state.copyMapItem) {
message.warning('请先复制对象') message.warning('请先复制对象')
return return
} }
// pasteNode()
let copyObj = JSON.parse(JSON.stringify(state.copyMapItem))
copyObj.locationX = Number(copyObj.locationX) + 50
copyObj.locationY = Number(copyObj.locationY) + 50
state.allMapPointInfo.push(copyObj)
addEditHistory()
} else if (event.key === 'z') { } else if (event.key === 'z') {
// //
backPreviousStep() backPreviousStep()
} else if (event.key === 'y') {
//
backNextStep()
} }
} }
} }
@ -2120,13 +2123,13 @@ onUnmounted(() => {
<style lang="scss" scoped> <style lang="scss" scoped>
.edit-map-page { .edit-map-page {
margin-bottom: 20px;
}
.map-container { .map-container {
position: relative; position: relative;
width: 100%; width: 100%;
overflow: auto; overflow: auto;
// height: 85vh;
height: calc(100vh - 140px);
.map-bg { .map-bg {
background-size: contain; background-size: contain;
background-repeat: no-repeat; background-repeat: no-repeat;
@ -2292,4 +2295,5 @@ onUnmounted(() => {
.right-tool-active { .right-tool-active {
background: #ebf1ff !important; background: #ebf1ff !important;
} }
}
</style> </style>