diff --git a/com.actionsoft.apps.coe.pal/template/page/pal.pl.repository.designer.htm b/com.actionsoft.apps.coe.pal/template/page/pal.pl.repository.designer.htm index fe64efd8..084b0308 100755 --- a/com.actionsoft.apps.coe.pal/template/page/pal.pl.repository.designer.htm +++ b/com.actionsoft.apps.coe.pal/template/page/pal.pl.repository.designer.htm @@ -912,12 +912,12 @@
  • 全选
    Ctrl+A
  • -
  • 调整垂直间距 -
    -
  • -
  • 调整水平间距 -
    -
  • + + + + + +
  • 创建连线 diff --git a/com.actionsoft.apps.coe.pal/web/com.actionsoft.apps.coe.pal/lib/designer/extend/js/designer.extend.core.js b/com.actionsoft.apps.coe.pal/web/com.actionsoft.apps.coe.pal/lib/designer/extend/js/designer.extend.core.js index fa25881e..724701b8 100755 --- a/com.actionsoft.apps.coe.pal/web/com.actionsoft.apps.coe.pal/lib/designer/extend/js/designer.extend.core.js +++ b/com.actionsoft.apps.coe.pal/web/com.actionsoft.apps.coe.pal/lib/designer/extend/js/designer.extend.core.js @@ -6,6 +6,8 @@ Designer.contextMenu.show = function(x, y) { var currentFocus = Utils.getShapeByPosition(x, y, false); menu.children().hide(); menu.children("li[ac=selectall]").show(); + menu.children("li[ac=selectVertical]").show(); + menu.children("li[ac=selectHorizontal]").show(); menu.children(".devi_selectall").show(); menu.children("li[ac=drawline]").show(); menu.children("li[ac=processAttribute]").show(); @@ -163,6 +165,10 @@ Designer.contextMenu.execAction = function(item) { showPropertiesDialog(true); } else if (action == "customdefine") { openCustomDefineDialog(); + } else if(action == 'selectVertical') { + Designer.selectVertical(this.menuPos); + } else if (action == 'selectHorizontal') { + Designer.selectHorizontal(this.menuPos); } }; diff --git a/com.actionsoft.apps.coe.pal/web/com.actionsoft.apps.coe.pal/lib/designer/scripts/diagraming/designer.methods.debug.js b/com.actionsoft.apps.coe.pal/web/com.actionsoft.apps.coe.pal/lib/designer/scripts/diagraming/designer.methods.debug.js index b8a6e7fe..26eecc08 100755 --- a/com.actionsoft.apps.coe.pal/web/com.actionsoft.apps.coe.pal/lib/designer/scripts/diagraming/designer.methods.debug.js +++ b/com.actionsoft.apps.coe.pal/web/com.actionsoft.apps.coe.pal/lib/designer/scripts/diagraming/designer.methods.debug.js @@ -1,7 +1,7 @@ /** * 设计器对外提供的方法 */ - + /** @@ -17,55 +17,216 @@ Designer.addFunction("open", function(definition){ $(".shape_box").remove(); Model.define.elements = {}; Model.persistence.elements = {}; - Model.define.page = definition.page; - + Model.define.page = definition.page; + //*******此处添加AWS流程设计器特有的属性*******// - Model.define.processProperties=definition.processProperties;//此处添加aws全局属性 - Model.define.processDocument=definition.processDocument;//此处添加aws全局属性 - Model.define.uuid=definition.uuid;//此处添加流程uuid - //Model.define.title=definition.title;//此处添加流程title - //向页面processDefId processDefTitle 赋值 - //process.processDefId=definition.uuid; - process.title=definition.title; + Model.define.processProperties=definition.processProperties;//此处添加aws全局属性 + Model.define.processDocument=definition.processDocument;//此处添加aws全局属性 + Model.define.uuid=definition.uuid;//此处添加流程uuid + //Model.define.title=definition.title;//此处添加流程title + //向页面processDefId processDefTitle 赋值 + //process.processDefId=definition.uuid; + process.title=definition.title; //*******添加结束*******// - - Model.persistence.page = Utils.copy(definition.page); - Designer.initialize.initCanvas(); - var shapes = definition.elements; - //先构造形状,再构造连接线,因为连接线的绘制过程有可能依赖所连接的图形 - var shapeCount = 0; - for(var shapeId in shapes){ - var shape = shapes[shapeId]; - if(shape.name != "linker"){ - Schema.initShapeFunctions(shape); - Designer.painter.renderShape(shape); - Model.add(shape, false); - } - shapeCount++; - } - for(var shapeId in shapes){ - var shape = shapes[shapeId]; - if(shape.name == "linker"){ - Designer.painter.renderLinker(shape); - Model.add(shape, false); - } - } - if(shapeCount == 0){ - Model.build(); - } - Navigator.draw(); + + Model.persistence.page = Utils.copy(definition.page); + Designer.initialize.initCanvas(); + var shapes = definition.elements; + //先构造形状,再构造连接线,因为连接线的绘制过程有可能依赖所连接的图形 + var shapeCount = 0; + for(var shapeId in shapes){ + var shape = shapes[shapeId]; + if(shape.name != "linker"){ + Schema.initShapeFunctions(shape); + Designer.painter.renderShape(shape); + Model.add(shape, false); + } + shapeCount++; + } + for(var shapeId in shapes){ + var shape = shapes[shapeId]; + if(shape.name == "linker"){ + Designer.painter.renderLinker(shape); + Model.add(shape, false); + } + } + if(shapeCount == 0){ + Model.build(); + } + Navigator.draw(); }); /** * 设计器方法:全选 */ Designer.addFunction("selectAll", function(){ - var shapes = Model.define.elements; - var shapeIds = []; - for(var shapeId in shapes){ - shapeIds.push(shapeId); - } - Utils.selectShape(shapeIds); + var shapes = Model.define.elements; + var shapeIds = []; + for(var shapeId in shapes){ + shapeIds.push(shapeId); + } + Utils.selectShape(shapeIds); +}); + +/** + * 设计器方法:调节垂直间距 + */ +Designer.addFunction("selectVertical", function(menuPos){ + var selectedIds = []; + var lineArr = [] + var shapeArr = [] + var menuY = menuPos.y + var shapes = Model.define.elements; + console.log(shapes) + + var subline1 = $('#designer_subline1') + var subline2 = $('#designer_subline2') + subline1.css({ + display : "block", + "z-index" : Model.orderList.length + 4, + width: Model.define.page.width, + height: 0, + borderStyle:'dotted', + borderWidth: '1px', + left: 0, + top : menuY + }); + subline2.css({ + display : "block", + "z-index" : Model.orderList.length + 5, + width: Model.define.page.width, + height: 0, + borderStyle:'dotted', + borderWidth: '1px', + left: 0, + top : menuY, + cursor: 'move' + }); + + var container = $("#canvas_container"); + var canvas = $("#designer_canvas"); + subline2.bind('mousedown.drag',function (b) { + container.bind('mousemove.drag',function (e) { + var newPos = Utils.getRelativePos(e.pageX, e.pageY, canvas); + if (newPos.y >= menuY) { + subline1.css({ + backgroundColor: 'rgba(114,253,107,0.5)', + height: newPos.y - menuY + }) + subline2.css({ + backgroundColor: 'translate', + height: 0 + }) + } else { + subline1.css({ + backgroundColor: 'translate', + height: 0 + }) + subline2.css({ + backgroundColor: 'rgba(246,163,163,0.5)', + height: menuY - newPos.y + }) + } + subline2.css({ + top : newPos.y, + }); + $(document).unbind("mouseup.drop").bind("mouseup.drop", + function() { + subline1.css({ + backgroundColor: 'translate', + height: 0 + }) + subline2.css({ + backgroundColor: 'translate', + height: 0 + }) + subline1.hide() + subline2.hide() + $(document).unbind("mouseup.drop") + }) + }) + $(document).bind('mouseup.drag',function () { + container.unbind("mousemove.drag"); + // subline2.unbind("mousedown.drag"); + $(document).unbind("mouseup.drag"); + }) + }) + + + for(var shapeId in shapes){ + if (shapes[shapeId].points == undefined) { + shapeArr.push(shapes[shapeId]) + } else { + lineArr.push(shapes[shapeId]) + } + } + + for (var i = 0; i < shapeArr.length; i++) { + if (shapeArr[i].props.y + shapeArr[i].props.h >= menuY) { + selectedIds.push(shapeArr[i].id) + } + } + for (var i = 0; i < lineArr.length; i++) { + if (lineArr[i].from.y >= menuY || lineArr[i].to.y >= menuY) { + selectedIds.push(lineArr[i].id) + } + } + // Utils.selectShape(selectedIds); + + + // for (var i = 0; i < selectedIds.length; i++) { + // N(selectedIds[i]) + // $(".shape_contour[forshape=" + selectedIds[i].id + "]").css({ + // left: selectedIds[i].props.x.toScale(), + // top: selectedIds[i].props.y.toScale() + // }) + // } + // var K = Utils.getSelectedLinkerIds(); + // if (selectedIds.length == 1 && K.length == 1) { + // return + // } + // if (K.length > 0) { + // var I = Utils.getSelectedIds(); + // Designer.painter.drawControls(I) + // } else { + // var E = $("#shape_controls"); + // E.css({ + // left: parseFloat(E.css("left")), + // top: parseFloat(E.css("top")) + 100 + // }) + // } + // var F = $("#shape_controls").position(); + // if (F && Utils.getSelected().length > 0) { + // Designer.op.showTip("X: " + Math.round(F.left.restoreScale()) + "  Y: " + Math.round(F.top.restoreScale())); + // } + // function N(a) { + // a.props.x += 0; + // a.props.y += 100; + // var b = $("#" + a.id); + // b.css({ + // left: parseFloat(b.css("left")), + // top: parseFloat(b.css("top")) + 100 + // }) + // } +}); + +/** + * 设计器方法:调节水平间距 + */ +Designer.addFunction("selectHorizontal", function(menuPos){ + var menuX = menuPos.x + let subline = $('#designer_subline') + console.log(subline) + subline.css({ + display : "block", + "z-index" : Model.orderList.length + 4, + width: 0, + height: Model.define.page.height, + borderStyle:'dotted', + borderWidth: '1px', + left: menuX, + top :0, + }); }); /**