@@ -18,6 +18,7 @@ export class SelectionSelect {
1818 private disabled = true
1919 private isWholeNode = true
2020 private isWholeEdge = true
21+ private originStatusSaved = false
2122 exclusiveMode = false // 框选独占模式:true 表示只能进行框选操作,false 表示可以同时进行其他画布操作
2223 // 用于区分选区和点击事件
2324 private mouseDownInfo : {
@@ -97,7 +98,6 @@ export class SelectionSelect {
9798
9899 private addEventListeners ( ) {
99100 if ( ! this . container ) return
100-
101101 if ( this . exclusiveMode ) {
102102 // 独占模式:监听 container 的 mousedown 事件
103103 this . container . style . pointerEvents = 'auto'
@@ -143,9 +143,12 @@ export class SelectionSelect {
143143 y : e . clientY ,
144144 time : Date . now ( ) ,
145145 }
146-
147146 // 记录原始设置并临时禁止画布移动
148- this . originalStopMoveGraph = this . lf . getEditConfig ( ) . stopMoveGraph !
147+ if ( ! this . originStatusSaved ) {
148+ // 为了防止在开启框选时用户多次点击画布导致缓存的stopMoveGraph变化,所以只在第一次点击时记录原始的stopMoveGraph issue #2263
149+ this . originalStopMoveGraph = this . lf . getEditConfig ( ) . stopMoveGraph !
150+ this . originStatusSaved = true
151+ }
149152 this . lf . updateEditConfig ( {
150153 stopMoveGraph : true ,
151154 } )
@@ -249,6 +252,11 @@ export class SelectionSelect {
249252 }
250253 }
251254 private drawOff = ( e : MouseEvent ) => {
255+ // 恢复原始的 stopMoveGraph 设置
256+ this . lf . updateEditConfig ( {
257+ stopMoveGraph : this . originalStopMoveGraph ,
258+ } )
259+ this . originStatusSaved = false
252260 // 处理鼠标抬起事件
253261 // 首先判断是否是点击,如果是,则清空框选
254262 if ( this . mouseDownInfo ) {
@@ -271,11 +279,6 @@ export class SelectionSelect {
271279 document . removeEventListener ( 'mouseup' , this . drawOff )
272280 }
273281
274- // 恢复原始的 stopMoveGraph 设置
275- this . lf . updateEditConfig ( {
276- stopMoveGraph : this . originalStopMoveGraph ,
277- } )
278-
279282 if ( curStartPoint && curEndPoint ) {
280283 const { x, y } = curStartPoint
281284 const { x : x1 , y : y1 } = curEndPoint
0 commit comments