粘贴不显示问题
This commit is contained in:
parent
982584acc7
commit
17dd7260fc
@ -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>
|
||||||
|
Loading…
Reference in New Issue
Block a user