diff --git a/framework/elsa/fit-elsa-react/src/flow/jadeFlowPage.js b/framework/elsa/fit-elsa-react/src/flow/jadeFlowPage.js index 68c452618..f740d5947 100644 --- a/framework/elsa/fit-elsa-react/src/flow/jadeFlowPage.js +++ b/framework/elsa/fit-elsa-react/src/flow/jadeFlowPage.js @@ -8,6 +8,7 @@ import {copyPasteHelper, ElsaCopyHandler, page, shapeDataHelper, sleep, uuid} fr import {SYSTEM_ACTION, VIRTUAL_CONTEXT_NODE} from '@/common/Consts.js'; import {conditionRunner, inactiveNodeRunner, standardRunner} from '@/flow/runners.js'; import {message} from 'antd'; +import {PAGE_OPERATION_MODE} from '@fit-elsa/elsa-core/common/const.js'; const START_NODE = 'startNodeStart'; @@ -33,6 +34,7 @@ export const jadeFlowPage = (div, graph, name, id) => { self.gridColor = '#e1e1e3'; self.disableContextMenu = true; self.moveAble = true; + self.operationMode = PAGE_OPERATION_MODE.DRAG; self.observableStore = ObservableStore(); self.copyPasteHelper = jadeCopyPasteHelper(); const shapeChangeListener = (e) => self.graph.dirtied(null, {action: SYSTEM_ACTION.JADE_NODE_CONFIG_CHANGE, shape: e.shapeId}); diff --git a/framework/elsa/fit-elsa/core/page.js b/framework/elsa/fit-elsa/core/page.js index e6cdb6773..bb9dba441 100644 --- a/framework/elsa/fit-elsa/core/page.js +++ b/framework/elsa/fit-elsa/core/page.js @@ -2370,9 +2370,6 @@ const setMouseActions = (pageVal) => { pageVal.onMouseUp = position => { pageVal.setCursor(); - if (pageVal.operationMode === PAGE_OPERATION_MODE.DRAG) { - return; - } let rect = {}; rect.x = (pageVal.mousedownx < pageVal.mousex ? pageVal.mousedownx : pageVal.mousex); rect.y = (pageVal.mousedowny < pageVal.mousey ? pageVal.mousedowny : pageVal.mousey); @@ -2404,20 +2401,19 @@ const setMouseActions = (pageVal) => { pageVal.invalidateInteraction(position); }; + const shouldParentFocusFirst = (parent) => { + return parent.containerFocusFirst && !parent.hasChildFocused(); + } + /** * 鼠标点击时,得到的最符合条件的shape,没有condition,只要在坐标内,就可以得到 */ pageVal.switchMouseInShape = (x, y, condition) => { - let found; - if (pageVal.operationMode === PAGE_OPERATION_MODE.DRAG) { - found = pageVal; - } else { - found = pageVal.find(x, y, condition ? condition : s => true); - const parent = found.getContainer(); - const isNotFocused = !parent.isFocused && !found.isFocused; - if (parent.containerFocusFirst && isNotFocused && !parent.hasChildFocused()) { - found = parent; - } + let found = pageVal.find(x, y, condition ? condition : s => true); + const parent = found.getContainer(); + const isNotFocused = !parent.isFocused && !found.isFocused; + if (isNotFocused && shouldParentFocusFirst(parent)) { + found = parent; } if (pageVal.mouseInShape !== found) { const pre = pageVal.mouseInShape; @@ -2527,10 +2523,6 @@ const setKeyActions = (pageVal) => { pageVal.shiftKeyPressed = false; pageVal.invalidateInteraction(); pageVal.isKeyDown = false; - if (e.code === 'Space' && pageVal.moveAble && pageVal.canvasMoveAble) { - pageVal.operationMode = PAGE_OPERATION_MODE.SELECTION; - return false; - } const focused = pageVal.getFocusedShapes(); const isDirectionKey = e.key.indexOf('Left') >= 0 || e.key.indexOf('Right') >= 0 || @@ -2563,10 +2555,6 @@ const setKeyActions = (pageVal) => { if (document.activeElement !== document.body) { return true; } - if (e.code === 'Space' && pageVal.moveAble && pageVal.canvasMoveAble) { - pageVal.operationMode = PAGE_OPERATION_MODE.DRAG; - return false; - } let focused = pageVal.getFocusedShapes(); pageVal.ctrlKeyPressed = e.ctrlKey || e.metaKey;