@@ -2370,9 +2370,6 @@ const setMouseActions = (pageVal) => {
23702370
23712371 pageVal . onMouseUp = position => {
23722372 pageVal . setCursor ( ) ;
2373- if ( pageVal . operationMode === PAGE_OPERATION_MODE . DRAG ) {
2374- return ;
2375- }
23762373 let rect = { } ;
23772374 rect . x = ( pageVal . mousedownx < pageVal . mousex ? pageVal . mousedownx : pageVal . mousex ) ;
23782375 rect . y = ( pageVal . mousedowny < pageVal . mousey ? pageVal . mousedowny : pageVal . mousey ) ;
@@ -2404,20 +2401,19 @@ const setMouseActions = (pageVal) => {
24042401 pageVal . invalidateInteraction ( position ) ;
24052402 } ;
24062403
2404+ const shouldParentFocusFirst = ( parent ) => {
2405+ return parent . containerFocusFirst && ! parent . hasChildFocused ( ) ;
2406+ }
2407+
24072408 /**
24082409 * 鼠标点击时,得到的最符合条件的shape,没有condition,只要在坐标内,就可以得到
24092410 */
24102411 pageVal . switchMouseInShape = ( x , y , condition ) => {
2411- let found ;
2412- if ( pageVal . operationMode === PAGE_OPERATION_MODE . DRAG ) {
2413- found = pageVal ;
2414- } else {
2415- found = pageVal . find ( x , y , condition ? condition : s => true ) ;
2416- const parent = found . getContainer ( ) ;
2417- const isNotFocused = ! parent . isFocused && ! found . isFocused ;
2418- if ( parent . containerFocusFirst && isNotFocused && ! parent . hasChildFocused ( ) ) {
2419- found = parent ;
2420- }
2412+ let found = pageVal . find ( x , y , condition ? condition : s => true ) ;
2413+ const parent = found . getContainer ( ) ;
2414+ const isNotFocused = ! parent . isFocused && ! found . isFocused ;
2415+ if ( isNotFocused && shouldParentFocusFirst ( parent ) ) {
2416+ found = parent ;
24212417 }
24222418 if ( pageVal . mouseInShape !== found ) {
24232419 const pre = pageVal . mouseInShape ;
@@ -2527,10 +2523,6 @@ const setKeyActions = (pageVal) => {
25272523 pageVal . shiftKeyPressed = false ;
25282524 pageVal . invalidateInteraction ( ) ;
25292525 pageVal . isKeyDown = false ;
2530- if ( e . code === 'Space' && pageVal . moveAble && pageVal . canvasMoveAble ) {
2531- pageVal . operationMode = PAGE_OPERATION_MODE . SELECTION ;
2532- return false ;
2533- }
25342526 const focused = pageVal . getFocusedShapes ( ) ;
25352527 const isDirectionKey = e . key . indexOf ( 'Left' ) >= 0 ||
25362528 e . key . indexOf ( 'Right' ) >= 0 ||
@@ -2563,10 +2555,6 @@ const setKeyActions = (pageVal) => {
25632555 if ( document . activeElement !== document . body ) {
25642556 return true ;
25652557 }
2566- if ( e . code === 'Space' && pageVal . moveAble && pageVal . canvasMoveAble ) {
2567- pageVal . operationMode = PAGE_OPERATION_MODE . DRAG ;
2568- return false ;
2569- }
25702558
25712559 let focused = pageVal . getFocusedShapes ( ) ;
25722560 pageVal . ctrlKeyPressed = e . ctrlKey || e . metaKey ;
0 commit comments