Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions framework/elsa/fit-elsa-react/src/flow/jadeFlowPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand All @@ -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});
Expand Down
30 changes: 9 additions & 21 deletions framework/elsa/fit-elsa/core/page.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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 ||
Expand Down Expand Up @@ -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;
Expand Down