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) { //获取当前选中组件