41
41
<div class =" tools" >
42
42
<el-button plain icon =" el-icon-aim" @click.stop =" leftTopPosition" ></el-button >
43
43
</div >
44
- <div class =" thread-body" @mousedown =" startMovingCanvas" @mousemove =" onMovingCanvas" @click =" updateActiveThread" @mouseup =" stopMovingLine" >
44
+ <div class =" thread-body"
45
+ @mousedown =" startMovingCanvas"
46
+ @mousemove =" onMovingCanvas"
47
+ @click =" updateActiveThread"
48
+ @mouseup =" stopMovingLine" >
49
+ <div class =" scrollbar-right" ></div >
50
+ <div class =" scrollbar-bottom" ></div >
45
51
<state-wrap
46
52
v-for =" (stateItem, index) in thread.stateAry"
47
53
:key =" index"
52
58
:activeStates =" activeStates"
53
59
:showDeleteStateMenu =" showDeleteStateMenu"
54
60
:showLineContextMenu =" showLineContextMenu"
61
+ :startMovingLine =" moveLineData.startMovingLine"
55
62
@updateStateData =" updateStateData"
56
63
@updateTempLineData =" updateTempLineData"
57
64
@updateMoveData =" updateMoveData"
58
65
@updateActiveState =" updateActiveState"
59
66
@stopMoving =" stopMoving"
60
67
@hideMenus =" hideMenus"
68
+ @stopMovingLine =" stopMovingLine"
61
69
/>
62
70
</div >
63
71
</foreignObject >
@@ -170,6 +178,7 @@ export default {
170
178
moveVerticalImg: " ./static/imgs/move-vertical.png" ,
171
179
resizableImg: " ./static/imgs/resizable.png" ,
172
180
moveLineData: {
181
+ startMovingLine: false ,
173
182
startPoint: {
174
183
y: 0 ,
175
184
},
@@ -194,23 +203,20 @@ export default {
194
203
}
195
204
return false ;
196
205
},
197
- // 判断在当前线程框内鼠标移动的情况,若当前鼠标正在移动画布,绘制连线,改变状态,配置连线和线程框的尺寸时 ,不触发高亮线程框的事件
206
+ // 判断在当前线程框内鼠标移动的情况,若当前鼠标正在移动画布,绘制连线,改变状态和线程框的尺寸时 ,不触发高亮线程框的事件
198
207
hasNotMovedInThread () {
199
208
if (stateManage .hasDrawedLine ) {
200
209
stateManage .hasDrawedLine = false ;
201
210
return false ;
202
- } else if (this . showVirtualBox ) {
203
- this . showVirtualBox = false ;
211
+ } else if (stateManage . hasResizedThread ) {
212
+ stateManage . hasResizedThread = false ;
204
213
return false ;
205
214
} else if (stateManage .hasResizedState ) {
206
215
stateManage .hasResizedState = false ;
207
216
return false ;
208
217
} else if (stateManage .hasMovedCanvas ) {
209
218
stateManage .hasMovedCanvas = false ;
210
219
return false ;
211
- } else if (stateManage .hasMovedLine ) {
212
- stateManage .hasMovedLine = false ;
213
- return false ;
214
220
}
215
221
return true ;
216
222
},
@@ -219,6 +225,7 @@ export default {
219
225
this .$emit (" updateActiveThread" , this .threadIndex );
220
226
}
221
227
},
228
+ // 获取当前状态图内最靠左的状态,以供状态图向左上角对齐使用
222
229
getLeftMostState () {
223
230
let stateAry = store .stateData .threadAry [this .threadIndex ].stateAry ;
224
231
let smallestStateX = 1000000 ;
@@ -232,6 +239,7 @@ export default {
232
239
let leftMostState = store .getState (this .threadIndex , smallestStateXId);
233
240
return leftMostState;
234
241
},
242
+ // 获取当前状态图内最靠上的状态,以供状态图向左上角对齐使用
235
243
getUpMostState () {
236
244
let stateAry = store .stateData .threadAry [this .threadIndex ].stateAry ;
237
245
let smallestStateY = 1000000 ;
@@ -474,13 +482,13 @@ export default {
474
482
updateMoveLineData (data ) {
475
483
if (data .startMovingLine ) {
476
484
this ._isMovingLine = true ;
477
- this ._isResizingState = false ;
478
485
}
479
486
Object .keys (data).forEach ((key ) => {
480
487
this .moveLineData [key] = data[key];
481
488
});
482
489
},
483
490
stopMovingLine () {
491
+ this .moveLineData .startMovingLine = false ;
484
492
this ._isMovingLine = false ;
485
493
this ._movingVerticalOffset = null ;
486
494
store .updatePresentData (this .threadIndex );
@@ -491,8 +499,7 @@ export default {
491
499
return false ;
492
500
}
493
501
stateManage .movingCanvas = false ;
494
- stateManage .hasMovedLine = true ;
495
- if (this .moveData .operate === " resize-state" ) {
502
+ if (this .moveLineData .startMovingLine !== true ) {
496
503
this .updateMoveData ({
497
504
endPoint: {
498
505
x: e .pageX ,
@@ -509,12 +516,9 @@ export default {
509
516
let moveData = this .moveData ;
510
517
let moveLineData = this .moveLineData ;
511
518
if (this ._isResizingState ) {
512
- this ._isMovingLine = false ;
513
519
stateManage .hasResizedState = true ;
514
520
this .resizingState (moveData);
515
521
} else if (this ._isMovingLine ) {
516
- this ._isResizingState = false ;
517
- stateManage .hasMovedLine = true ;
518
522
this .movingLine (moveLineData);
519
523
}
520
524
},
@@ -1050,6 +1054,11 @@ export default {
1050
1054
},
1051
1055
drop (e ) {
1052
1056
// TODO:需要处理不允许用户跨线程拖拽状态块的问题
1057
+ if (this .moveLineData .startMovingLine ) {
1058
+ this .stopMovingLine ();
1059
+ this .moveLineData .startMovingLine = false ;
1060
+ return false ;
1061
+ }
1053
1062
if (e .dataTransfer .getData (" operate" ) === " addState" ) {
1054
1063
store .updateUndoData (this .threadIndex );
1055
1064
this .addStateToThread (e);
@@ -1230,6 +1239,7 @@ export default {
1230
1239
1231
1240
startResize (e ) {
1232
1241
this .showVirtualBox = true ;
1242
+ stateManage .hasResizedThread = true ;
1233
1243
stateManage .movingCanvas = false ;
1234
1244
EventObj .$emit (" operateChange" , {
1235
1245
operate: " resize-thread" ,
@@ -1439,6 +1449,9 @@ export default {
1439
1449
</script >
1440
1450
1441
1451
<style lang="less" scoped>
1452
+ * {
1453
+ user-select : none ;
1454
+ }
1442
1455
div .thread {
1443
1456
position : relative ;
1444
1457
display : inline-block ;
@@ -1535,6 +1548,23 @@ h4.title {
1535
1548
height : calc (100% - 35px );
1536
1549
/* border: 1px solid #baed00; */
1537
1550
}
1551
+ /* *TODO: 后续需要实现状态图内的滚动条功能 */
1552
+ .scrollbar-right {
1553
+ height : 166px ;
1554
+ width : 13px ;
1555
+ border-radius : 13px ;
1556
+ background : rgba (224 , 224 , 224 , 0.37 );
1557
+ position : absolute ;
1558
+ right : 3px ;
1559
+ }
1560
+ .scrollbar-bottom {
1561
+ height : 13px ;
1562
+ width : 312px ;
1563
+ border-radius : 13px ;
1564
+ background : rgba (224 , 224 , 224 , 0.37 );
1565
+ position : absolute ;
1566
+ bottom : 3px ;
1567
+ }
1538
1568
.resize-icon {
1539
1569
position : absolute ;
1540
1570
bottom : 0 ;
0 commit comments