端到端功能 节点展开与关闭相关代码提交

This commit is contained in:
qinoy 2023-06-08 13:52:50 +08:00
parent 5571bba060
commit fc8e0747ca
4 changed files with 71 additions and 26 deletions

View File

@ -274,6 +274,8 @@ public class GraphNodeExpandHandle {
*/
private void handleEndToEndGraphNodeExcluedExpandNode(){
JSONObject elements = endToEndProcessDefine.getJSONObject("elements");
JSONObject processProperties = endToEndProcessDefine.getJSONObject("processProperties");
String direction = processProperties.getString("direction");
// 范围标注框 大小 位置
JSONObject scopeShapeProps = scopeLimitationShape.getJSONObject("props");
double scopeShapeX = scopeShapeProps.getDoubleValue("x");
@ -285,11 +287,23 @@ public class GraphNodeExpandHandle {
JSONObject ele = elements.getJSONObject(key);
if ("linker".equals(ele.getString("name"))) continue; // 连线先不处理
JSONObject props = ele.getJSONObject("props");
if (props.getDoubleValue("x") > scopeShapeX) { // 当前元素在待展开节点的右侧
props.put("x", props.getDoubleValue("x") + scopeShapeW - SubProcessConst.SUB_PROCESS_SHAPE_W);
}
if (props.getDoubleValue("y") > scopeShapeY) { // 当前元素在待展开节点的下侧
props.put("y", props.getDoubleValue("y") + scopeShapeH - SubProcessConst.SUB_PROCESS_SHAPE_H);
if (ele.getString("id").equals(scopeLimitationShape.getString("id"))) continue;
if ("vertically".equals(direction)){
if (props.getDoubleValue("x") > scopeShapeX) { // 当前元素在待展开节点的右侧
props.put("x", props.getDoubleValue("x") + scopeShapeW - SubProcessConst.SUB_PROCESS_SHAPE_W);
}
if (props.getDoubleValue("y") > scopeShapeY || props.getDoubleValue("y") == scopeShapeY) { // 当前元素在待展开节点的下侧
props.put("y", props.getDoubleValue("y") + scopeShapeH - SubProcessConst.SUB_PROCESS_SHAPE_H);
}
}else {
if (props.getDoubleValue("x") > scopeShapeX) { // 当前元素在待展开节点的右侧
props.put("x", props.getDoubleValue("x") + scopeShapeW - SubProcessConst.SUB_PROCESS_SHAPE_W);
}else if (props.getDoubleValue("x") == scopeShapeX && props.getDoubleValue("y") > scopeShapeY) { // 当前元素与待展开节点在一列上 且在下侧
props.put("x", props.getDoubleValue("x") + scopeShapeW - SubProcessConst.SUB_PROCESS_SHAPE_W);
}
if (props.getDoubleValue("y") > scopeShapeY) { // 当前元素在待展开节点的下侧
props.put("y", props.getDoubleValue("y") + scopeShapeH - SubProcessConst.SUB_PROCESS_SHAPE_H);
}
}
addEndToEndGraphElements(ele);

View File

@ -1163,27 +1163,29 @@ var Designer = {
if (g.x == 0 && g.y == 0) {
return
}
// 端到端功能 如果移动的元素是子流程节点展开后 范围框中的元素 则进行移动范围限制校验
let rang = window.subProcess.scopeRang;
let movingEle = window.subProcess.movingEle;
if (movingEle != null && rang != null){
let flag = false;
for (let k = 0; k < u.length; k++) {
if (u[k].name == "linker") continue;
if (u[k].id == movingEle.id) flag = true;
}
if (flag){
let movingEleBound = {
x: movingEle.props.x,
y: movingEle.props.y,
w: movingEle.props.w,
h: movingEle.props.h
if (methodId == 'process.subprocess') { // 如果当前打开的模型不是端到端总图 那么整个js也没有执行的必要
// 端到端功能 如果移动的元素是子流程节点展开后 范围框中的元素 则进行移动范围限制校验
let rang = window.subProcess.scopeRang;
let movingEle = window.subProcess.movingEle;
if (movingEle != null && rang != null){
let flag = false;
for (let k = 0; k < u.length; k++) {
if (u[k].name == "linker") continue;
if (u[k].id == movingEle.id) flag = true;
}
if (movingEleBound.x + g.x <= rang.x1 || movingEleBound.x + movingEleBound.w + g.x >= rang.x2 || movingEleBound.y + g.y <= rang.y1 || movingEleBound.y + movingEleBound.h + g.y >= rang.y2){
$.simpleAlert("子流程内部节点只能在范围标识框内部移动", "warning");
d.unbind("mousemove.drag");
c.unbind("mousedown.drag");
return;
if (flag){
let movingEleBound = {
x: movingEle.props.x,
y: movingEle.props.y,
w: movingEle.props.w,
h: movingEle.props.h
}
if (movingEleBound.x + g.x <= rang.x1 || movingEleBound.x + movingEleBound.w + g.x >= rang.x2 || movingEleBound.y + g.y <= rang.y1 || movingEleBound.y + movingEleBound.h + g.y >= rang.y2){
$.simpleAlert("子流程内部节点只能在范围标识框内部移动", "warning");
d.unbind("mousemove.drag");
c.unbind("mousedown.drag");
return;
}
}
}
}

View File

@ -458,6 +458,10 @@ var Designer = {
Model.update(M)
}
}
// 如果当前拖拽到画布的图形是子流程 则渲染节点展开图标
if (g.name == 'subProcess') {
window.subProcess.shapeOpenIconRender(g);
}
Utils.unselect();
Utils.selectShape(g.id);
MessageSource.commit();
@ -928,7 +932,6 @@ var Designer = {
}
},
init: function () {
debugger;
this.initialize.initLayout();
this.initialize.initModel();
this.initialize.initCanvas();
@ -1177,6 +1180,32 @@ var Designer = {
if (g.x == 0 && g.y == 0) {
return
}
if (methodId == 'process.subprocess') { // 如果当前打开的模型不是端到端总图 那么整个js也没有执行的必要
// 端到端功能 如果移动的元素是子流程节点展开后 范围框中的元素 则进行移动范围限制校验
let rang = window.subProcess.scopeRang;
let movingEle = window.subProcess.movingEle;
if (movingEle != null && rang != null){
let flag = false;
for (let k = 0; k < u.length; k++) {
if (u[k].name == "linker") continue;
if (u[k].id == movingEle.id) flag = true;
}
if (flag){
let movingEleBound = {
x: movingEle.props.x,
y: movingEle.props.y,
w: movingEle.props.w,
h: movingEle.props.h
}
if (movingEleBound.x + g.x <= rang.x1 || movingEleBound.x + movingEleBound.w + g.x >= rang.x2 || movingEleBound.y + g.y <= rang.y1 || movingEleBound.y + movingEleBound.h + g.y >= rang.y2){
$.simpleAlert("子流程内部节点只能在范围标识框内部移动", "warning");
d.unbind("mousemove.drag");
c.unbind("mousedown.drag");
return;
}
}
}
}
Designer.op.moveShape(u, g);
x = f;
$(document).unbind("mouseup.drop").bind("mouseup.drop",