From eec9c89ff67fabf3ead928ce544cffd7ef8db6bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=92=AC=E8=BD=AE=E7=8C=AB?= <10928033@qq.com> Date: Tue, 18 May 2021 23:05:14 +0800 Subject: [PATCH] =?UTF-8?q?=E9=87=8D=E5=86=99=E7=BB=84=E4=BB=B6=E7=A7=BB?= =?UTF-8?q?=E5=8A=A8=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/CircuitEdit.vue | 88 ++++++++++++++++++++++++--------------- 1 file changed, 54 insertions(+), 34 deletions(-) diff --git a/src/views/CircuitEdit.vue b/src/views/CircuitEdit.vue index dba0c72..f95b5f1 100644 --- a/src/views/CircuitEdit.vue +++ b/src/views/CircuitEdit.vue @@ -54,7 +54,7 @@ v-for="(item,index) in svgLists" :key="item" :id=item.id - @mousedown="MousedownSvg(item.id,index)" + @mousedown="MousedownSvg(item.id,index,item.svgPositionX,item.svgPositionY,$event)" :title=item.title :transform="'translate('+(item.svgPositionX)+','+(item.svgPositionY)+')' +'rotate('+item.angle+')' +'scale('+item.height+')'"> 0) { svgPositionY = exitsAdsorbY[0].svgPositionY; } - _this.svgLists[_this.moveSvg.Index].svgPositionX = svgPositionX; - _this.svgLists[_this.moveSvg.Index].svgPositionY = svgPositionY; + _this.svgLists[_this.selectSvg.Index].svgPositionX = svgPositionX; + _this.svgLists[_this.selectSvg.Index].svgPositionY = svgPositionY; //从所有的x坐标列表中查当前坐标是否存在 let exitsNowX = anyPositionList.filter(function (list) { return list.svgPositionX === svgPositionX @@ -237,15 +252,19 @@ export default { //console.log('点击了画布'); }, - MousedownSvg (id, index) { - global.CurrentlySelectedToolBarType = ''; - global.CurrentlySelectedToolBarTitle = ''; - this.CurrentlySelectedToolBar.Type = ''; - this.CurrentlySelectedToolBar.Title = ''; + MousedownSvg (id, index,pointX,pointY, e) { + this.CurrentlySelectedToolBar.Type = global.CurrentlySelectedToolBarType = ''; + this.CurrentlySelectedToolBar.Title = global.CurrentlySelectedToolBarTitle = ''; //从数组里面根据index找到当前元素 - this.moveSvg.ID = id; - this.moveSvg.Index = index; + this.selectSvg.ID = id; + this.selectSvg.Index = index; + this.selectSvg.mouseStatus = 1; + this.selectSvg.mPositionX = e.clientX; + this.selectSvg.mPositionY = e.clientY; + this.selectSvg.pointX = pointX; + this.selectSvg.pointY = pointY; this.selectSvgInfo = this.svgLists[index]; + //获取所有g标签 将当前标签追加选中样式 let gAnyList = document.querySelectorAll('g'); gAnyList.forEach(g => { @@ -259,7 +278,8 @@ export default { if (this.CurrentlySelectedToolBar.Title != '' || this.CurrentlySelectedToolBar.Type != '') { return; } - this.moveSvg.ID = ''; + // this.selectSvg.ID = ''; + this.selectSvg.mouseStatus = 0; }, MouseWheel (e) { //获取当前选中组件