端到端功能 节点展开 范围标识框限制内部元素活动范围 相关代码提交
This commit is contained in:
parent
acd3a86f5d
commit
3c9f5a8a84
@ -1163,6 +1163,30 @@ var Designer = {
|
|||||||
if (g.x == 0 && g.y == 0) {
|
if (g.x == 0 && g.y == 0) {
|
||||||
return
|
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 (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);
|
Designer.op.moveShape(u, g);
|
||||||
x = f;
|
x = f;
|
||||||
$(document).unbind("mouseup.drop").bind("mouseup.drop",
|
$(document).unbind("mouseup.drop").bind("mouseup.drop",
|
||||||
|
|||||||
@ -25,7 +25,9 @@ class SubProcess {
|
|||||||
this.Model = Model;
|
this.Model = Model;
|
||||||
this.repositoryId = ruuid;
|
this.repositoryId = ruuid;
|
||||||
this.sid = sid;
|
this.sid = sid;
|
||||||
this.scopeEle = {};
|
this.scopeEle = {}; // 范围框元素以及其内部元素
|
||||||
|
this.movingEle = null; // 范围框内移动中的元素
|
||||||
|
this.scopeRang = null; // 范围限制框左右两边以及上下两边的坐标 x1 x2 y1 y2
|
||||||
}
|
}
|
||||||
|
|
||||||
init(){
|
init(){
|
||||||
@ -80,6 +82,7 @@ class SubProcess {
|
|||||||
h: j.shape.props.h
|
h: j.shape.props.h
|
||||||
};
|
};
|
||||||
let e = Utils.getShapesByRange(range);
|
let e = Utils.getShapesByRange(range);
|
||||||
|
// 将当前范围选择框元素以及范围内的元素 存储到subProcess中 方便后续 范围框内的元素移动时做范围框限制
|
||||||
window.subProcess.scopeEle[j.shape.id] = e;
|
window.subProcess.scopeEle[j.shape.id] = e;
|
||||||
$('#'+j.shape.id).off("mousedown").on("mousedown", function (f) {
|
$('#'+j.shape.id).off("mousedown").on("mousedown", function (f) {
|
||||||
Utils.unselect();
|
Utils.unselect();
|
||||||
@ -90,14 +93,30 @@ class SubProcess {
|
|||||||
// console.log('范围标注框的图形是否存了下来', window.subProcess.scopeEle);
|
// console.log('范围标注框的图形是否存了下来', window.subProcess.scopeEle);
|
||||||
let scopeEle = window.subProcess.scopeEle;
|
let scopeEle = window.subProcess.scopeEle;
|
||||||
for (const scopeShapeId in scopeEle) {
|
for (const scopeShapeId in scopeEle) {
|
||||||
let eles = scopeEle[scopeShapeId];
|
let inRangeEles = scopeEle[scopeShapeId];
|
||||||
if (eles.indexOf(j.shape.id) != -1){
|
if (inRangeEles.indexOf(j.shape.id) != -1){
|
||||||
console.log("范围选择框内的元素发生移动")
|
let currentScopeEle = Model.getShapeById(scopeShapeId); // 获取当前范围选择框
|
||||||
// 移动的范围
|
let bound = {
|
||||||
|
x: currentScopeEle.props.x,
|
||||||
|
y: currentScopeEle.props.y,
|
||||||
|
w: currentScopeEle.props.w,
|
||||||
|
h: currentScopeEle.props.h
|
||||||
|
};
|
||||||
|
let rang = {
|
||||||
|
x1: bound.x,
|
||||||
|
y1: bound.y,
|
||||||
|
x2: bound.x + bound.w,
|
||||||
|
y2: bound.y + bound.h
|
||||||
|
};
|
||||||
|
|
||||||
|
window.subProcess.scopeRang = rang;
|
||||||
|
window.subProcess.movingEle = Model.getShapeById(j.shape.id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}else {
|
||||||
|
window.subProcess.movingEle = null;
|
||||||
|
window.subProcess.scopeRang = null;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -132,6 +151,8 @@ class SubProcess {
|
|||||||
Designer.open(definition); // 节点重新渲染
|
Designer.open(definition); // 节点重新渲染
|
||||||
// 针对范围标识框渲染 节点关闭按钮
|
// 针对范围标识框渲染 节点关闭按钮
|
||||||
window.subProcess.shapeIconRender();
|
window.subProcess.shapeIconRender();
|
||||||
|
// 提示用户文件已修改
|
||||||
|
window.subProcess.fileModifiedTip();
|
||||||
},
|
},
|
||||||
err: function(r){
|
err: function(r){
|
||||||
$.simpleAlert(r.msg);
|
$.simpleAlert(r.msg);
|
||||||
@ -142,7 +163,16 @@ class SubProcess {
|
|||||||
|
|
||||||
// 节点关闭事件
|
// 节点关闭事件
|
||||||
shapeClose(event){
|
shapeClose(event){
|
||||||
console.log('sss')
|
console.log('sss');
|
||||||
|
let param = event.data;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
fileModifiedTip(){
|
||||||
|
if (isAutoSave == "0") {
|
||||||
|
$("#saving_tip").css("color", "rgb(255, 0, 0)");
|
||||||
|
$("#saving_tip").text("文件已修改,未保存");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user