泳道图图形调整

This commit is contained in:
lihongyu 2022-09-21 10:17:19 +08:00
parent 398d8a43f6
commit ebcc65bcd3

View File

@ -892,7 +892,7 @@ Schema.addShape({name:"method_service_node4", title:"人工任务", text:"人工
/***菱形Decision*/Schema.addShape({name:"decision", title:"判定", text:"判定", category:"process_flowchart", props:{w:90, h:50},fillStyle:{color:"175,210,255"}, path:[ /***菱形Decision*/Schema.addShape({name:"decision", title:"判定", text:"判定", category:"process_flowchart", props:{w:150, h:66},fillStyle:{color:"175,210,255"}, path:[
{actions:[ {actions:[
{action:"move", x:"0", y:"h/2"}, {action:"move", x:"0", y:"h/2"},
{action:"line", x:"w/2", y:"0"}, {action:"line", x:"w/2", y:"0"},
@ -1021,6 +1021,7 @@ Schema.addGlobalCommand("method_script_task", [
/*泳池/泳道分组*/ /*泳池/泳道分组*/
Schema.addCategory({name:"lane", text:"泳池/泳道"}); Schema.addCategory({name:"lane", text:"泳池/泳道"});
function getPool(a, d) { function getPool(a, d) {
@ -1067,7 +1068,40 @@ function getChild(c, a) {
} }
return null return null
} }
Schema.addShape({name:"verticalPool", title:"泳池(垂直)",text:"泳池(垂直)", category:"lane", attribute:{rotatable:false, linkable:false, container:true}, children:[], props:{w:250, h:540}, fontStyle:{size:16}, textBlock:{x:10, y:0, w:"w-20", h:40},textBlockFinal:{x:"w/2-60", y:"h", w:"120", h:"30"}, anchors:[], resizeDir:["l", "b", "r"],
path:[
{fillStyle:{type:"none"}, lineStyle:{lineStyle:"solid"}, actions:{ref:"rectangle"}},
{fillStyle:{color:"232,242,255"},lineStyle:{lineStyle:"solid"}, actions:[
{action:"move", x:0, y:0},
{action:"line", x:"w", y:0},
{action:"line", x:"w", y:40},
{action:"line", x:0, y:40},
{action:"close"}
]}
], drawIcon:function (b, c) {
b += 8;
var a = -4;
return[
{fillStyle:{type:"none"}, actions:[
{action:"move", x:a, y:0},
{action:"line", x:b, y:0},
{action:"line", x:b, y:c},
{action:"line", x:a, y:c},
{action:"close"}
]},
{actions:[
{action:"move", x:a, y:0},
{action:"line", x:b, y:0},
{action:"line", x:b, y:4},
{action:"line", x:a, y:4},
{action:"close"}
]},
{actions:[
{action:"move", x:(a + b) / 2, y:4},
{action:"line", x:(a + b) / 2, y:c}
]}
]
}});
Schema.addShape({name:"verticalLane", title:"泳道(垂直)", text:"泳道(垂直)", category:"lane", attribute:{container:true, rotatable:false, linkable:false}, props:{w:250, h:500}, textBlock:{x:10, y:0, w:"w-20", h:30},textBlockFinal:{x:"w/2-60", y:"h", w:"120", h:"30"}, Schema.addShape({name:"verticalLane", title:"泳道(垂直)", text:"泳道(垂直)", category:"lane", attribute:{container:true, rotatable:false, linkable:false}, props:{w:250, h:500}, textBlock:{x:10, y:0, w:"w-20", h:30},textBlockFinal:{x:"w/2-60", y:"h", w:"120", h:"30"},
anchors:[], resizeDir:["l", "b", "r"], path:[ anchors:[], resizeDir:["l", "b", "r"], path:[
{fillStyle:{type:"none"}, lineStyle:{lineStyle:"solid"}, actions:{ref:"rectangle"}}, {fillStyle:{type:"none"}, lineStyle:{lineStyle:"solid"}, actions:{ref:"rectangle"}},
@ -1218,6 +1252,40 @@ Schema.addShape({name:"verticalLane", title:"泳道(垂直)", text:"泳道(垂
Designer.painter.renderShape(d); Designer.painter.renderShape(d);
this.parent = d.id this.parent = d.id
}}); }});
Schema.addShape({name:"horizontalPool", title:"泳池(水平)",text:"泳池(水平)", category:"lane", attribute:{rotatable:false, linkable:false, container:true}, children:[], props:{w:640, h:200}, fontStyle:{size:16, orientation:"horizontal"}, textBlock:{x:0, y:10, w:40, h:"h-20"},textBlockFinal:{x:"w/2-60", y:"h", w:"120", h:"30"},
anchors:[], resizeDir:["t", "r", "b"], path:[
{fillStyle:{type:"none"}, lineStyle:{lineStyle:"solid"}, actions:{ref:"rectangle"}},
{fillStyle:{color:"232,242,255"},lineStyle:{lineStyle:"solid"}, actions:[
{action:"move", x:0, y:0},
{action:"line", x:40, y:0},
{action:"line", x:40, y:"h"},
{action:"line", x:0, y:"h"},
{action:"close"}
]}
], drawIcon:function (a, b) {
b += 8;
var c = -4;
return[
{fillStyle:{type:"none"}, actions:[
{action:"move", x:0, y:c},
{action:"line", x:a, y:c},
{action:"line", x:a, y:b},
{action:"line", x:0, y:b},
{action:"close"}
]},
{actions:[
{action:"move", x:0, y:c},
{action:"line", x:4, y:c},
{action:"line", x:4, y:b},
{action:"line", x:0, y:b},
{action:"close"}
]},
{actions:[
{action:"move", x:4, y:(c + b) / 2},
{action:"line", x:a, y:(c + b) / 2}
]}
]
}});
Schema.addShape({name:"horizontalLane", title:"泳道(水平)",text:"泳道(水平)", category:"lane", attribute:{container:true, rotatable:false, linkable:false}, props:{w:600, h:200}, fontStyle:{orientation:"horizontal"}, textBlock:{x:0, y:10, w:30, h:"h-20"},textBlockFinal:{x:"w/2-60", y:"h", w:"120", h:"30"}, Schema.addShape({name:"horizontalLane", title:"泳道(水平)",text:"泳道(水平)", category:"lane", attribute:{container:true, rotatable:false, linkable:false}, props:{w:600, h:200}, fontStyle:{orientation:"horizontal"}, textBlock:{x:0, y:10, w:30, h:"h-20"},textBlockFinal:{x:"w/2-60", y:"h", w:"120", h:"30"},
anchors:[], resizeDir:["t", "b", "r"], path:[ anchors:[], resizeDir:["t", "b", "r"], path:[
{fillStyle:{type:"none"}, lineStyle:{lineStyle:"solid"}, actions:{ref:"rectangle"}}, {fillStyle:{type:"none"}, lineStyle:{lineStyle:"solid"}, actions:{ref:"rectangle"}},
@ -1511,161 +1579,3 @@ Schema.addShape({name:"verticalSeparator", title:"分隔符(垂直)", category:"
} }
this.props.zindex = Model.maxZIndex + 1 this.props.zindex = Model.maxZIndex + 1
}}); }});
Schema.addShape({name:"verticalSeparatorBar", title:"水平分隔条", category:"lane", attribute:{rotatable:false, linkable:false, visible:false}, props:{w:20, h:500}, anchors:[], resizeDir:[], textBlock:{}, textBlockFinal:{x:"w/2-60", y:"h", w:"120", h:"30"},path:[
{lineStyle:{lineStyle:"solid"}, actions:{ref:"rectangle"}}
]});
Schema.addShape({name:"horizontalSeparator", title:"分隔符(水平)", category:"lane", attribute:{rotatable:false, linkable:false}, props:{w:300, h:0}, fontStyle:{orientation:"horizontal", textAlign:"left"}, textBlock:{x:0, y:5, w:20, h:"h-10"},textBlockFinal:{x:"w/2-60", y:"h", w:"120", h:"30"}, text:"阶段",
anchors:[], resizeDir:["b"], path:[
{fillStyle:{type:"none"}, lineStyle:{lineStyle:"solid"}, actions:[
{action:"move", x:0, y:"h"},
{action:"line", x:"w", y:"h"}
]},
{actions:[
{action:"move", x:0, y:0},
{action:"line", x:20, y:0},
{action:"line", x:20, y:"h"},
{action:"line", x:0, y:"h"},
{action:"close"}
]}
], drawIcon:function (a, b) {
return[
{fillStyle:{type:"none"}, lineStyle:{lineStyle:"solid"}, actions:[
{action:"move", x:0, y:0},
{action:"line", x:a, y:0}
]}
]
}, onCreated:function () {
var g = getPool(this, "verticalPool");
if (g == null) {
return false
}
var j = getChild(g, "verticalSeparatorBar");
if (j == null) {
j = Model.create("verticalSeparatorBar", g.props.x - 20, g.props.y + 40);
j.props.h = g.props.h - 40;
j.parent = g.id;
Model.add(j);
Designer.painter.renderShape(j);
g.props.x -= j.props.w;
g.props.w += j.props.w;
g.children.push(j.id);
Designer.painter.renderShape(g)
}
var a = this.props.y + this.props.h;
var h = g.props.y + 40;
var f = null;
for (var e = 0; e < g.children.length; e++) {
var d = g.children[e];
var b = Model.getShapeById(d);
if (b.name != "horizontalSeparator") {
continue
}
var c = b.props.y + b.props.h;
if (c <= a) {
h += b.props.h
} else {
if (f == null || b.props.y < f.props.y) {
f = b
}
}
}
this.props.x = g.props.x;
this.props.w = g.props.w;
this.props.h = a - h;
this.props.y = h;
g.children.push(this.id);
this.parent = g.id;
if (a > g.props.y + g.props.h) {
this.props.h = g.props.y + g.props.h - h
}
Designer.painter.renderShape(this);
if (f != null) {
f.props.y += this.props.h;
f.props.h -= this.props.h;
Designer.painter.renderShape(f);
Model.updateMulti([g, f])
} else {
Model.update(g)
}
this.props.zindex = Model.maxZIndex + 1
}});
Schema.addShape({name:"horizontalSeparatorBar", title:"垂直分隔条", category:"lane", attribute:{rotatable:false, linkable:false, visible:false}, props:{w:600, h:20}, anchors:[], resizeDir:[], textBlock:{},textBlockFinal:{x:"w/2-60", y:"h", w:"120", h:"30"}, path:[
{lineStyle:{lineStyle:"solid"}, actions:{ref:"rectangle"}}
]});
Schema.addShape({name:"verticalSeparator", title:"分隔符(垂直)", category:"lane", attribute:{rotatable:false, linkable:false}, props:{w:0, h:300}, fontStyle:{textAlign:"right"}, textBlock:{x:5, y:0, w:"w-10", h:20},textBlockFinal:{x:"w/2-60", y:"h", w:"120", h:"30"}, text:"阶段", anchors:[], resizeDir:["r"], path:[
{fillStyle:{type:"none"}, lineStyle:{lineStyle:"solid"}, actions:[
{action:"move", x:"w", y:0},
{action:"line", x:"w", y:"h"}
]},
{actions:[
{action:"move", x:0, y:0},
{action:"line", x:"w", y:0},
{action:"line", x:"w", y:20},
{action:"line", x:0, y:20},
{action:"close"}
]}
], drawIcon:function (a, b) {
return[
{fillStyle:{type:"none"}, lineStyle:{lineStyle:"solid"}, actions:[
{action:"move", x:0, y:0},
{action:"line", x:0, y:b}
]}
]
}, onCreated:function () {
var e = getPool(this, "horizontalPool");
if (e == null) {
return false
}
var g = getChild(e, "horizontalSeparatorBar");
if (g == null) {
g = Model.create("horizontalSeparatorBar", e.props.x + 40, e.props.y - 20);
e.props.y -= g.props.h;
e.props.h += g.props.h;
e.children.push(g.id);
Designer.painter.renderShape(e);
g.props.w = e.props.w - 40;
g.parent = e.id;
Model.add(g);
Designer.painter.renderShape(g)
}
var j = this.props.x + this.props.w;
var h = e.props.x + 40;
var d = null;
for (var c = 0; c < e.children.length; c++) {
var b = e.children[c];
var a = Model.getShapeById(b);
if (a.name != "verticalSeparator") {
continue
}
var f = a.props.x + a.props.w;
if (f <= j) {
h += a.props.w
} else {
if (d == null || a.props.x < d.props.x) {
d = a
}
}
}
this.props.x = h;
this.props.w = j - h;
this.props.y = e.props.y;
this.props.h = e.props.h;
if (j > e.props.x + e.props.w) {
this.props.w = e.props.x + e.props.w - h
}
Designer.painter.renderShape(this);
e.children.push(this.id);
this.parent = e.id;
if (d != null) {
d.props.x += this.props.w;
d.props.w -= this.props.w;
Designer.painter.renderShape(d);
Model.updateMulti([e, d])
} else {
Model.update(e)
}
this.props.zindex = Model.maxZIndex + 1
}});