From c3149423d1a93fd0aa4729c60bda2f917beef6c3 Mon Sep 17 00:00:00 2001 From: "zhu.yawen" Date: Mon, 6 Nov 2023 09:12:15 +0800 Subject: [PATCH] =?UTF-8?q?fix:=E4=BF=AE=E5=A4=8D=E9=A1=B5=E9=9D=A2?= =?UTF-8?q?=E7=BC=A9=E6=94=BE=E5=AF=BC=E8=87=B4=E7=9A=84=E5=B0=8F=E5=9C=B0?= =?UTF-8?q?=E5=9B=BEbug;=E4=BF=AE=E5=A4=8D=E9=BC=A0=E6=A0=87=E6=8B=96?= =?UTF-8?q?=E6=8B=BD=E4=BD=8D=E7=BD=AE=E5=81=8F=E7=A7=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BigScreenDesign/MouseSelect/index.vue | 37 +++++++++++---- .../BigScreenDesign/RulerTool/SketchRuler.vue | 47 ++----------------- .../packages/BigScreenDesign/index.vue | 1 - 3 files changed, 33 insertions(+), 52 deletions(-) diff --git a/data-room-ui/packages/BigScreenDesign/MouseSelect/index.vue b/data-room-ui/packages/BigScreenDesign/MouseSelect/index.vue index 02267a22..935bdabd 100644 --- a/data-room-ui/packages/BigScreenDesign/MouseSelect/index.vue +++ b/data-room-ui/packages/BigScreenDesign/MouseSelect/index.vue @@ -51,8 +51,10 @@ export default { }), getSelectionBoxStyle () { // 计算虚线框的样式 - const left = Math.min(this.startX, this.endX) + 'px' - const top = Math.min(this.startY, this.endY) + 'px' + let left = Math.min(this.startX, this.endX) + 'px' + let top = Math.min(this.startY, this.endY) + 'px' + const left1 = Math.min(this.startX, this.endX) + 50 * this.scale + 'px' + const top1 = Math.min(this.startY, this.endY) + 50 * this.scale + 'px' const width = Math.abs(this.endX - this.startX) + 'px' const height = Math.abs(this.endY - this.startY) + 'px' if (!this.isSelecting) { @@ -79,6 +81,7 @@ export default { ] ), handleMouseDown (event) { + // 点击在底部背景上 if (event.button === 0) { time = new Date() // 避免和shift + 点击多选组件冲突 @@ -86,11 +89,22 @@ export default { return } this.isSelectDown = true - - this.startX = (event.x - this.offsetX) / this.scale + 50 - this.startY = (event.y - this.offsetY) / this.scale + 50 - this.endX = (event.x - this.offsetX) / this.scale + 50 - this.endY = (event.y - this.offsetY) / this.scale + 50 + // 点击在底部背景上 + if (event.target.className.indexOf('mouse-select-wrap') !== -1) { + this.startX = event.offsetX + this.endX = event.offsetX + this.startY = event.offsetY + this.endY = event.offsetY + } else if (event.target.className.indexOf('design-drag-wrap') !== -1) { + this.startX = event.offsetX + 50 + this.endX = event.offsetX + 50 + this.startY = event.offsetY + 50 + this.endY = event.offsetY + 50 + } + // this.startX = (event.x - this.offsetX + 50) / this.scale + // this.startY = (event.y - this.offsetY + 50) / this.scale + // this.endX = (event.x - this.offsetX + 50) / this.scale + // this.endY = (event.y - this.offsetY + 50) / this.scale } }, handleMouseMove (event) { @@ -102,8 +116,13 @@ export default { this.isSelecting = true } if (this.isSelecting) { - this.endX = (event.x - this.offsetX) / this.scale + 50 - this.endY = (event.y - this.offsetY) / this.scale + 50 + if (event.target.className.indexOf('mouse-select-wrap') !== -1) { + this.endX = event.offsetX + this.endY = event.offsetY + } else if (event.target.className.indexOf('design-drag-wrap') !== -1) { + this.startX = event.offsetX + 50 + this.endY = event.offsetY + 50 + } } }, handleMouseUp (event) { diff --git a/data-room-ui/packages/BigScreenDesign/RulerTool/SketchRuler.vue b/data-room-ui/packages/BigScreenDesign/RulerTool/SketchRuler.vue index d5856302..6544fee0 100644 --- a/data-room-ui/packages/BigScreenDesign/RulerTool/SketchRuler.vue +++ b/data-room-ui/packages/BigScreenDesign/RulerTool/SketchRuler.vue @@ -214,6 +214,10 @@ export default { scrollLeft = screenElement.scrollLeft scrollTop = screenElement.scrollTop maxContainer.addEventListener('mousemove', function (event) { + // 在鼠标移动过程中判断出鼠标左键未点击,则停止拖拽 + if (event.buttons !== 1) { + that.isDrag = false + } if (that.isDrag) { event.preventDefault() // 鼠标移动距离 @@ -427,52 +431,11 @@ export default { .screen-container { position: absolute; + overflow:hidden; width: 6000px; height: 6000px; } -.minimap{ - position: fixed; - bottom: 15px; - right: 15px; - border: 1px solid #f6f7fb; - z-index:10000; - /*cursor: move;*/ -} -.minimap .mapHeader{ - background-color:#303640; - padding: 0 10px; - display: flex; - justify-content: space-between; - height: 20px; - width: 150px; - font-size: 12px; - border-bottom: 1px solid #fff; - color: #ffffff; - cursor: pointer; - span { - user-select: none; - } -} - -.minimap .selectWin{ - background-color: #232832; - height: 150px; - width: 150px; - position: relative; -} - -.minimap .selectionWin{ - position: absolute; - left: 0px; - top: 0px; - width: 30px; - height: 30px; - background-color: white; - opacity: 0.5; - cursor: move; -} - .scale-value { position: absolute; left: 0; diff --git a/data-room-ui/packages/BigScreenDesign/index.vue b/data-room-ui/packages/BigScreenDesign/index.vue index 1533beef..2b46c39d 100644 --- a/data-room-ui/packages/BigScreenDesign/index.vue +++ b/data-room-ui/packages/BigScreenDesign/index.vue @@ -55,7 +55,6 @@ class="selectionWin" /> -