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 bc862529..c97af809 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 @@ -160,9 +160,10 @@ Designer.addFunction("selectVertical", function() { function(e) { var height1 = subline1.height() var height2 = subline2.height() - if (height1 != 0) { // 增加 + if (height1 > 0) { // 增加 moveShapeAndFile('y',sublinePos,height1) - } else if (height2 != 0) { // 减少 + } + if (height2 > 0) { // 减少 moveShapeAndFile('y',sublinePos,0-height2) } subline1.css({ @@ -749,9 +750,10 @@ Designer.addFunction("selectHorizontal", function() { function(e) { var width1 = subline1.width() var width2 = subline2.width() - if(width1 != 0) { // 增加 + if(width1 > 0) { // 增加 moveShapeAndFile('x',sublinePos,width1) - } else if(width2 != 0) { // 减少 + } + if(width2 > 0) { // 减少 moveShapeAndFile('x',sublinePos,0-width2) } diff --git a/com.actionsoft.apps.coe.pal/web/com.actionsoft.apps.coe.pal/lib/designer/scripts/diagraming/designer.methods.js b/com.actionsoft.apps.coe.pal/web/com.actionsoft.apps.coe.pal/lib/designer/scripts/diagraming/designer.methods.js index 2cde5689..6905eab6 100755 --- a/com.actionsoft.apps.coe.pal/web/com.actionsoft.apps.coe.pal/lib/designer/scripts/diagraming/designer.methods.js +++ b/com.actionsoft.apps.coe.pal/web/com.actionsoft.apps.coe.pal/lib/designer/scripts/diagraming/designer.methods.js @@ -1 +1 @@ -function isLineBelowOrRight(e,t,r){let i=!1;e.from[t]>=r&&(i=!0),e.to[t]>=r&&(i=!0);for(let n=0;n=r&&(i=!0);return i}function filterShapeAndLine(e,t){var r=Model.define.elements,i=[],n=[],o=[],a=[],l=[],s=0,d=[],p=0,h=[],g=[];for(let e in r)null==r[e].points?i.push(r[e]):n.push(r[e]),"lane"==r[e].category&&o.push(r[e]);for(let r=0;rt?h.push(i[r]):i[r].props.x<=t&&i[r].props.x+i[r].props.w/2>=t?(a.push(i[r]),h.push(i[r])):i[r].props.x+i[r].props.w/2=t?l.push(i[r]):d.push(i[r]):"y"==e&&(i[r].props[e]>t?h.push(i[r]):i[r].props.y<=t&&i[r].props.y+i[r].props.h/2>=t?(a.push(i[r]),h.push(i[r])):i[r].props.y+i[r].props.h/2=t?l.push(i[r]):d.push(i[r]));for(let r=0;re.id==n[r].id);isLineBelowOrRight(n[r],e,t)&&-1==i&&g.push(n[r])}if(d.length>0&&"y"==e?p=Math.max.apply(Math,d.map(e=>e.props.y+e.props.h)):d.length>0&&"x"==e&&(p=Math.max.apply(Math,d.map(e=>e.props.x+e.props.w))),a.concat(l).length>0&&(s=Math.max.apply(Math,a.concat(l).map(t=>t.props[e]))),a.length>0){let e=Utils.getOutlinkers(a);for(let t=0;tr.id==e[t].id)&&g.push(e[t])}return{passedShapes:a,passedMoreShapes:l,passedShapesEdge:s,sublineSideEdge:p,movingShapes:h,movingLines:g,laneArr:o}}function moveShapeAndFile(e,t,r){console.log("间距调节方法调用");var i=filterShapeAndLine(e,t),n=i.movingLines,o=i.movingShapes,a=i.passedShapes,l=i.passedMoreShapes;if(0==i.laneArr.length){"y"==e?Designer.op.moveShape(o,{x:0,y:r}):"x"==e&&Designer.op.moveShape(o,{x:r,y:0});for(let i=0;ie.id==n[i].from.id),s=a.findIndex(e=>e.id==n[i].to.id),d=l.findIndex(e=>e.id==n[i].from.id),p=l.findIndex(e=>e.id==n[i].to.id);for(let o=0;ot&&(n[i].points[o][e]+=r);if(n[i].from[e]>t&&-1==d)n[i].from[e]+=r;else if(n[i].from[e]<=t&&-1!==o){for(let t=0;tt&&-1==p)n[i].to[e]+=r;else if(a.length>0&&n[i].to[e]<=t&&-1!==s){for(let t=0;t0&&Model.updateMulti(s)}else moveLanes(e,t,r)}function moveLanes(e,t,r){var i=filterShapeAndLine(e,t),n=i.movingLines,o=i.movingShapes,a=i.passedShapes,l=i.passedMoreShapes,s=i.laneArr,d=[],p=[];for(let e=0;e{let i=r.lanes.findIndex(e=>""==e.parent),n=r.lanes.findIndex(e=>"verticalSeparatorBar"==e.name),o=r.lanes.findIndex(e=>"horizontalSeparatorBar"==e.name),a=r.lanes[i],l=r.lanes[n],s=r.lanes[o];if("x"==e){let e=a.props.xt,i=void 0!==l&&l.props.xt,n=a.props.xt;"verticalPool"==r.name?r.isPassed=e&&!i:"horizontalPool"==r.name&&(r.isPassed=e&&!n),r.lanes.forEach(e=>{e.props.x+e.props.w>t&&r.changed.push(e)})}else if("y"==e){let e=a.props.yt,i=void 0!==s&&s.props.yt,n=a.props.yt;"verticalPool"==r.name?r.isPassed=e&&!n:"horizontalPool"==r.name&&(r.isPassed=e&&!i),r.lanes.forEach(e=>{e.props.y+e.props.h>t&&r.changed.push(e)})}}),"x"==e?(Designer.op.moveShape(o.filter(e=>"lane"!==e.category),{x:r,y:0}),d.forEach(e=>{e.changed.forEach(i=>{if(e.isPassed){if(e.isPassed){if("verticalPool"==e.name)switch(i.name){case"verticalPool":i.props.w+=r;break;case"verticalLane":i.props.w+=i.props.xt?r:0,i.props.x+=i.props.x>t?r:0;break;case"horizontalSeparator":i.props.w+=r}if("horizontalPool"==e.name)switch(i.name){case"horizontalPool":case"horizontalLane":i.props.w+=r;break;case"verticalSeparator":i.props.w+=i.props.xt?r:0,i.props.x+=i.props.x>t?r:0;break;case"horizontalSeparatorBar":i.props.w+=r}}}else i.props.x+=r;p.push(i),Designer.painter.renderShape(i)})})):"y"==e&&(Designer.op.moveShape(o.filter(e=>"lane"!==e.category),{x:0,y:r}),d.forEach(e=>{e.changed.forEach(i=>{if(e.isPassed){if(e.isPassed){if("verticalPool"==e.name)switch(i.name){case"verticalPool":case"verticalLane":i.props.h+=r;break;case"horizontalSeparator":i.props.h+=i.props.yt?r:0,i.props.y+=i.props.y>t?r:0;break;case"verticalSeparatorBar":i.props.h+=r}if("horizontalPool"==e.name)switch(i.name){case"horizontalPool":i.props.h+=r;break;case"horizontalLane":i.props.h+=i.props.yt?r:0,i.props.y+=i.props.y>t?r:0;break;case"verticalSeparator":i.props.h+=r}}}else i.props.y+=r;p.push(i),Designer.painter.renderShape(i)})}));for(let i=0;ie.id==n[i].from.id),s=a.findIndex(e=>e.id==n[i].to.id),d=l.findIndex(e=>e.id==n[i].from.id),p=l.findIndex(e=>e.id==n[i].to.id);for(let o=0;ot&&(n[i].points[o][e]+=r);if(n[i].from[e]>t&&-1==d)n[i].from[e]+=r;else if(n[i].from[e]<=t&&-1!==o){for(let t=0;tt&&-1==p)n[i].to[e]+=r;else if(a.length>0&&n[i].to[e]<=t&&-1!==s){for(let t=0;t"lane"!==e.category).concat(p).concat(n);h.length>0&&Model.updateMulti(h)}function getCanvasContentEdge(){var e={top:0,bottom:0,left:0,right:0},t=Model.define.elements,r=[],i=[];for(let e in t)if(null==t[e].points)r.push({x:t[e].props.x,type:"shape",shapeWidth:t[e].props.w}),i.push({y:t[e].props.y,type:"shape",shapeHeight:t[e].props.h});else{r.push({x:t[e].from.x,type:"line"}),r.push({x:t[e].to.x,type:"line"}),i.push({y:t[e].from.y,type:"line"}),i.push({y:t[e].to.y,type:"line"});for(let n=0;ne.x)),e.top=Math.min.apply(Math,i.map(e=>e.y));for(let e=0;ee.x)),e.bottom=Math.max.apply(Math,i.map(e=>e.y)),e}function addDefaultSchemaShape(){Schema.addCategory({name:"standard",text:"Standard",dataAttributes:[]}),Schema.addShape({name:"standardText",title:"",text:"",category:"standard",attribute:{linkable:!1},props:{w:160,h:40},anchors:[],textBlock:{x:0,y:0,w:"w",h:"h"},path:[{lineStyle:{lineWidth:0},fillStyle:{type:"none"},actions:{ref:"rectangle"}}]}),Schema.addShape({name:"standardImage",title:"",text:"",attribute:{linkable:!1,editable:!1,visible:!1},category:"standard",props:{w:100,h:70},path:[{lineStyle:{lineWidth:0},actions:{ref:"rectangle"}}]}),Schema.addShape({name:"standardRectangle",title:"",text:"",attribute:{visible:!1},category:"standard",props:{w:100,h:70},path:[{actions:{ref:"rectangle"}}]})}Designer.addFunction("open",function(definition){if(""!=definition){"string"==typeof definition&&eval("definition = "+definition),$(".shape_box").remove(),Model.define.elements={},Model.persistence.elements={},Model.define.page=definition.page,Model.define.processProperties=definition.processProperties,Model.define.processDocument=definition.processDocument,Model.define.uuid=definition.uuid,process.title=definition.title,Model.persistence.page=Utils.copy(definition.page),Designer.initialize.initCanvas();var shapes=definition.elements,shapeCount=0;for(var shapeId in shapes){var shape=shapes[shapeId];"linker"!=shape.name&&(Schema.initShapeFunctions(shape),Designer.painter.renderShape(shape),Model.add(shape,!1)),shapeCount++}for(var shapeId in shapes){var shape=shapes[shapeId];"linker"==shape.name&&(Designer.painter.renderLinker(shape),Model.add(shape,!1))}0==shapeCount&&Model.build(),Navigator.draw()}}),Designer.addFunction("selectAll",function(){var e=Model.define.elements,t=[];for(var r in e)t.push(r);Utils.selectShape(t)}),Designer.addFunction("selectVertical",function(){var e;console.log("调节垂直间距");var t,r=$("#designer_subline1"),i=$("#designer_subline2"),n=$("#canvas_container"),o=$("#designer_canvas");n.bind("mousemove.drag",function(a){Designer.op.destroy();let l=Utils.getRelativePos(a.pageX,a.pageY,o);r.css({display:"block","z-index":Model.orderList.length+4,width:Model.define.page.width,height:0,borderStyle:"dotted",borderWidth:"1px",left:0,top:l.y}),n.bind("mousedown.drag",function(a){Designer.op.destroy(),n.unbind("mousemove.drag");let l=Utils.getRelativePos(a.pageX,a.pageY,o);e=l.y,t=filterShapeAndLine("y",e),r.css({display:"block","z-index":Model.orderList.length+4,width:Model.define.page.width,height:0,borderStyle:"dotted",borderWidth:"1px",left:0,top:l.y}),i.css({display:"block","z-index":Model.orderList.length+5,width:Model.define.page.width,height:0,borderStyle:"dotted",borderWidth:"1px",left:0,top:l.y,cursor:"move"}),n.bind("mousemove.drag",function(n){Designer.op.destroy();var a=Utils.getRelativePos(n.pageX,n.pageY,o);if(a.y>=e)r.css({borderColor:"rgb(114,253,107)",backgroundColor:"rgba(114,253,107,0.5)",height:a.y-e}),i.css({borderColor:"rgb(114,253,107)",backgroundColor:"transparent",height:0}),i.css({top:a.y});else{let n=t.passedShapesEdge-t.sublineSideEdge>0?t.passedShapesEdge:t.sublineSideEdge;a.yl.height-l.padding&&(Designer.setPageStyle({height:a.bottom+l.padding+30}),$("#page_size_w").spinner("value",a.bottom+l.padding+30)),$(document).unbind("mouseup.drop")})}),$(document).bind("mouseup.drag",function(){n.unbind("mousemove.drag"),n.unbind("mousedown.drag"),$(document).unbind("mouseup.drag")})})})}),Designer.addFunction("selectHorizontal",function(){var e;console.log("调节水平间距");var t,r=$("#designer_subline1"),i=$("#designer_subline2"),n=$("#canvas_container"),o=$("#designer_canvas");n.bind("mousemove.drag",function(a){Designer.op.destroy();let l=Utils.getRelativePos(a.pageX,a.pageY,o);r.css({display:"block","z-index":Model.orderList.length+4,width:0,height:Model.define.page.height,borderStyle:"dotted",borderWidth:"1px",left:l.x,top:0}),n.bind("mousedown.drag",function(a){Designer.op.destroy(),n.unbind("mousemove.drag");let l=Utils.getRelativePos(a.pageX,a.pageY,o);e=l.x,t=filterShapeAndLine("x",e),r.css({display:"block","z-index":Model.orderList.length+4,width:0,height:Model.define.page.height,borderStyle:"dotted",borderWidth:"1px",left:l.x,top:0}),i.css({display:"block","z-index":Model.orderList.length+5,width:0,height:Model.define.page.height,borderStyle:"dotted",borderWidth:"1px",left:l.x,top:0,cursor:"move"}),n.bind("mousemove.drag",function(n){Designer.op.destroy();var a=Utils.getRelativePos(n.pageX,n.pageY,o);if(a.x>=e)r.css({borderColor:"rgb(114,253,107)",backgroundColor:"rgba(114,253,107,0.5)",width:a.x-e}),i.css({borderColor:"rgb(114,253,107)",backgroundColor:"transparent",width:0}),i.css({left:a.x});else{let n=t.passedShapesEdge-t.sublineSideEdge>0?t.passedShapesEdge:t.sublineSideEdge;a.xl.width-l.padding&&(Designer.setPageStyle({width:a.right+l.padding+30}),$("#page_size_w").spinner("value",a.right+l.padding+30)),$(document).unbind("mouseup.drop")})}),$(document).bind("mouseup.drag",function(){n.unbind("mousemove.drag"),n.unbind("mousedown.drag"),$(document).unbind("mouseup.drag")})})})}),Designer.addFunction("setFontStyle",function(e){var t=Utils.getSelected();if(0!=t.length){for(var r=0;r1&&Designer.painter.drawControls(o),Model.updateMulti(r),Utils.showLinkerControls()}}),Designer.addFunction("matchSize",function(e){var t=Utils.getSelected();if(0!=t.length&&e){for(var r=null,i=null,n=[],o=0;or)&&(r=l.props.w),(null==i||l.props.h>i)&&(i=l.props.h))}"auto"==e.w&&(e.w=r),"auto"==e.h&&(e.h=i),Utils.removeAnchors();var a=[];for(o=0;o=0;i--){r-=1,(g=t[i]).props.zindex=r}}else if("backward"==e){var p=null;for(o=null,i=0;i=0;r--){var i=Model.orderList[r];if(!(i.zindex>=e.props.zindex||Utils.isSelected(i.id))){var n=Model.getShapeById(i.id),o=Utils.getShapeBox(n);if(Utils.rectCross(t,o))return n}}return null}}),Designer.addFunction("group",function(){var e=Utils.getSelected();if(!(e.length<2)){for(var t=Utils.newId(),r=0;r4&&(e=4),Utils.hideLinkerCursor(),Designer.config.scale=e,Designer.initialize.initCanvas(),Model.define.elements){var r=Model.define.elements[t];Designer.painter.renderShape(r)}var i=Utils.getSelectedIds(),n=Utils.getSelectedLockedIds();Utils.mergeArray(i,n),Utils.unselect(),Utils.selectShape(i),Utils.showLinkerCursor()}),Designer.addFunction("setShapeProps",function(e){var t=Utils.getSelected();if(0!=t.length&&e){for(var r=[],i=[],n=0;n0&&Model.updateMulti(r);var d=Utils.getSelectedIds();Utils.unselect(),Utils.selectShape(d)}}),Designer.addFunction("addDataAttribute",function(e){var t=Utils.getSelectedIds(),r=Model.getShapeById(t[0]);r.dataAttributes||(r.dataAttributes=[]),e.id=Utils.newId(),e.category="custom",r.dataAttributes.push(e),MessageSource.doWithoutUpdateDock(function(){Model.update(r)})}),Designer.addFunction("updateDataAttribute",function(e){var t=Utils.getSelectedIds(),r=Model.getShapeById(t[0]);r.dataAttributes||(r.dataAttributes=[]);for(var i=!1,n=0;n=r&&(i=!0),e.to[t]>=r&&(i=!0);for(let n=0;n=r&&(i=!0);return i}function filterShapeAndLine(e,t){var r=Model.define.elements,i=[],n=[],o=[],a=[],l=[],s=0,d=[],p=0,h=[],g=[];for(let e in r)null==r[e].points?i.push(r[e]):n.push(r[e]),"lane"==r[e].category&&o.push(r[e]);for(let r=0;rt?h.push(i[r]):i[r].props.x<=t&&i[r].props.x+i[r].props.w/2>=t?(a.push(i[r]),h.push(i[r])):i[r].props.x+i[r].props.w/2=t?l.push(i[r]):d.push(i[r]):"y"==e&&(i[r].props[e]>t?h.push(i[r]):i[r].props.y<=t&&i[r].props.y+i[r].props.h/2>=t?(a.push(i[r]),h.push(i[r])):i[r].props.y+i[r].props.h/2=t?l.push(i[r]):d.push(i[r]));for(let r=0;re.id==n[r].id);isLineBelowOrRight(n[r],e,t)&&-1==i&&g.push(n[r])}if(d.length>0&&"y"==e?p=Math.max.apply(Math,d.map(e=>e.props.y+e.props.h)):d.length>0&&"x"==e&&(p=Math.max.apply(Math,d.map(e=>e.props.x+e.props.w))),a.concat(l).length>0&&(s=Math.max.apply(Math,a.concat(l).map(t=>t.props[e]))),a.length>0){let e=Utils.getOutlinkers(a);for(let t=0;tr.id==e[t].id)&&g.push(e[t])}return{passedShapes:a,passedMoreShapes:l,passedShapesEdge:s,sublineSideEdge:p,movingShapes:h,movingLines:g,laneArr:o}}function moveShapeAndFile(e,t,r){console.log("间距调节方法调用");var i=filterShapeAndLine(e,t),n=i.movingLines,o=i.movingShapes,a=i.passedShapes,l=i.passedMoreShapes;if(0==i.laneArr.length){"y"==e?Designer.op.moveShape(o,{x:0,y:r}):"x"==e&&Designer.op.moveShape(o,{x:r,y:0});for(let i=0;ie.id==n[i].from.id),s=a.findIndex(e=>e.id==n[i].to.id),d=l.findIndex(e=>e.id==n[i].from.id),p=l.findIndex(e=>e.id==n[i].to.id);for(let o=0;ot&&(n[i].points[o][e]+=r);if(n[i].from[e]>t&&-1==d)n[i].from[e]+=r;else if(n[i].from[e]<=t&&-1!==o){for(let t=0;tt&&-1==p)n[i].to[e]+=r;else if(a.length>0&&n[i].to[e]<=t&&-1!==s){for(let t=0;t0&&Model.updateMulti(s)}else moveLanes(e,t,r)}function moveLanes(e,t,r){var i=filterShapeAndLine(e,t),n=i.movingLines,o=i.movingShapes,a=i.passedShapes,l=i.passedMoreShapes,s=i.laneArr,d=[],p=[];for(let e=0;e{let i=r.lanes.findIndex(e=>""==e.parent),n=r.lanes.findIndex(e=>"verticalSeparatorBar"==e.name),o=r.lanes.findIndex(e=>"horizontalSeparatorBar"==e.name),a=r.lanes[i],l=r.lanes[n],s=r.lanes[o];if("x"==e){let e=a.props.xt,i=void 0!==l&&l.props.xt,n=a.props.xt;"verticalPool"==r.name?r.isPassed=e&&!i:"horizontalPool"==r.name&&(r.isPassed=e&&!n),r.lanes.forEach(e=>{e.props.x+e.props.w>t&&r.changed.push(e)})}else if("y"==e){let e=a.props.yt,i=void 0!==s&&s.props.yt,n=a.props.yt;"verticalPool"==r.name?r.isPassed=e&&!n:"horizontalPool"==r.name&&(r.isPassed=e&&!i),r.lanes.forEach(e=>{e.props.y+e.props.h>t&&r.changed.push(e)})}}),"x"==e?(Designer.op.moveShape(o.filter(e=>"lane"!==e.category),{x:r,y:0}),d.forEach(e=>{e.changed.forEach(i=>{if(e.isPassed){if(e.isPassed){if("verticalPool"==e.name)switch(i.name){case"verticalPool":i.props.w+=r;break;case"verticalLane":i.props.w+=i.props.xt?r:0,i.props.x+=i.props.x>t?r:0;break;case"horizontalSeparator":i.props.w+=r}if("horizontalPool"==e.name)switch(i.name){case"horizontalPool":case"horizontalLane":i.props.w+=r;break;case"verticalSeparator":i.props.w+=i.props.xt?r:0,i.props.x+=i.props.x>t?r:0;break;case"horizontalSeparatorBar":i.props.w+=r}}}else i.props.x+=r;p.push(i),Designer.painter.renderShape(i)})})):"y"==e&&(Designer.op.moveShape(o.filter(e=>"lane"!==e.category),{x:0,y:r}),d.forEach(e=>{e.changed.forEach(i=>{if(e.isPassed){if(e.isPassed){if("verticalPool"==e.name)switch(i.name){case"verticalPool":case"verticalLane":i.props.h+=r;break;case"horizontalSeparator":i.props.h+=i.props.yt?r:0,i.props.y+=i.props.y>t?r:0;break;case"verticalSeparatorBar":i.props.h+=r}if("horizontalPool"==e.name)switch(i.name){case"horizontalPool":i.props.h+=r;break;case"horizontalLane":i.props.h+=i.props.yt?r:0,i.props.y+=i.props.y>t?r:0;break;case"verticalSeparator":i.props.h+=r}}}else i.props.y+=r;p.push(i),Designer.painter.renderShape(i)})}));for(let i=0;ie.id==n[i].from.id),s=a.findIndex(e=>e.id==n[i].to.id),d=l.findIndex(e=>e.id==n[i].from.id),p=l.findIndex(e=>e.id==n[i].to.id);for(let o=0;ot&&(n[i].points[o][e]+=r);if(n[i].from[e]>t&&-1==d)n[i].from[e]+=r;else if(n[i].from[e]<=t&&-1!==o){for(let t=0;tt&&-1==p)n[i].to[e]+=r;else if(a.length>0&&n[i].to[e]<=t&&-1!==s){for(let t=0;t"lane"!==e.category).concat(p).concat(n);h.length>0&&Model.updateMulti(h)}function getCanvasContentEdge(){var e={top:0,bottom:0,left:0,right:0},t=Model.define.elements,r=[],i=[];for(let e in t)if(null==t[e].points)r.push({x:t[e].props.x,type:"shape",shapeWidth:t[e].props.w}),i.push({y:t[e].props.y,type:"shape",shapeHeight:t[e].props.h});else{r.push({x:t[e].from.x,type:"line"}),r.push({x:t[e].to.x,type:"line"}),i.push({y:t[e].from.y,type:"line"}),i.push({y:t[e].to.y,type:"line"});for(let n=0;ne.x)),e.top=Math.min.apply(Math,i.map(e=>e.y));for(let e=0;ee.x)),e.bottom=Math.max.apply(Math,i.map(e=>e.y)),e}function addDefaultSchemaShape(){Schema.addCategory({name:"standard",text:"Standard",dataAttributes:[]}),Schema.addShape({name:"standardText",title:"",text:"",category:"standard",attribute:{linkable:!1},props:{w:160,h:40},anchors:[],textBlock:{x:0,y:0,w:"w",h:"h"},path:[{lineStyle:{lineWidth:0},fillStyle:{type:"none"},actions:{ref:"rectangle"}}]}),Schema.addShape({name:"standardImage",title:"",text:"",attribute:{linkable:!1,editable:!1,visible:!1},category:"standard",props:{w:100,h:70},path:[{lineStyle:{lineWidth:0},actions:{ref:"rectangle"}}]}),Schema.addShape({name:"standardRectangle",title:"",text:"",attribute:{visible:!1},category:"standard",props:{w:100,h:70},path:[{actions:{ref:"rectangle"}}]})}Designer.addFunction("open",function(definition){if(""!=definition){"string"==typeof definition&&eval("definition = "+definition),$(".shape_box").remove(),Model.define.elements={},Model.persistence.elements={},Model.define.page=definition.page,Model.define.processProperties=definition.processProperties,Model.define.processDocument=definition.processDocument,Model.define.uuid=definition.uuid,process.title=definition.title,Model.persistence.page=Utils.copy(definition.page),Designer.initialize.initCanvas();var shapes=definition.elements,shapeCount=0;for(var shapeId in shapes){var shape=shapes[shapeId];"linker"!=shape.name&&(Schema.initShapeFunctions(shape),Designer.painter.renderShape(shape),Model.add(shape,!1)),shapeCount++}for(var shapeId in shapes){var shape=shapes[shapeId];"linker"==shape.name&&(Designer.painter.renderLinker(shape),Model.add(shape,!1))}0==shapeCount&&Model.build(),Navigator.draw()}}),Designer.addFunction("selectAll",function(){var e=Model.define.elements,t=[];for(var r in e)t.push(r);Utils.selectShape(t)}),Designer.addFunction("selectVertical",function(){var e;console.log("调节垂直间距");var t,r=$("#designer_subline1"),i=$("#designer_subline2"),n=$("#canvas_container"),o=$("#designer_canvas");n.bind("mousemove.drag",function(a){Designer.op.destroy();let l=Utils.getRelativePos(a.pageX,a.pageY,o);r.css({display:"block","z-index":Model.orderList.length+4,width:Model.define.page.width,height:0,borderStyle:"dotted",borderWidth:"1px",left:0,top:l.y}),n.bind("mousedown.drag",function(a){Designer.op.destroy(),n.unbind("mousemove.drag");let l=Utils.getRelativePos(a.pageX,a.pageY,o);e=l.y,t=filterShapeAndLine("y",e),r.css({display:"block","z-index":Model.orderList.length+4,width:Model.define.page.width,height:0,borderStyle:"dotted",borderWidth:"1px",left:0,top:l.y}),i.css({display:"block","z-index":Model.orderList.length+5,width:Model.define.page.width,height:0,borderStyle:"dotted",borderWidth:"1px",left:0,top:l.y,cursor:"move"}),n.bind("mousemove.drag",function(n){Designer.op.destroy();var a=Utils.getRelativePos(n.pageX,n.pageY,o);if(a.y>=e)r.css({borderColor:"rgb(114,253,107)",backgroundColor:"rgba(114,253,107,0.5)",height:a.y-e}),i.css({borderColor:"rgb(114,253,107)",backgroundColor:"transparent",height:0}),i.css({top:a.y});else{let n=t.passedShapesEdge-t.sublineSideEdge>0?t.passedShapesEdge:t.sublineSideEdge;a.y0&&moveShapeAndFile("y",e,n),o>0&&moveShapeAndFile("y",e,0-o),r.css({borderColor:"#333",backgroundColor:"transparent",height:0}),i.css({borderColor:"#333",backgroundColor:"transparent",height:0}),r.hide(),i.hide();var a=getCanvasContentEdge(),l=Model.define.page;a.bottom>l.height-l.padding&&(Designer.setPageStyle({height:a.bottom+l.padding+30}),$("#page_size_w").spinner("value",a.bottom+l.padding+30)),$(document).unbind("mouseup.drop")})}),$(document).bind("mouseup.drag",function(){n.unbind("mousemove.drag"),n.unbind("mousedown.drag"),$(document).unbind("mouseup.drag")})})})}),Designer.addFunction("selectHorizontal",function(){var e;console.log("调节水平间距");var t,r=$("#designer_subline1"),i=$("#designer_subline2"),n=$("#canvas_container"),o=$("#designer_canvas");n.bind("mousemove.drag",function(a){Designer.op.destroy();let l=Utils.getRelativePos(a.pageX,a.pageY,o);r.css({display:"block","z-index":Model.orderList.length+4,width:0,height:Model.define.page.height,borderStyle:"dotted",borderWidth:"1px",left:l.x,top:0}),n.bind("mousedown.drag",function(a){Designer.op.destroy(),n.unbind("mousemove.drag");let l=Utils.getRelativePos(a.pageX,a.pageY,o);e=l.x,t=filterShapeAndLine("x",e),r.css({display:"block","z-index":Model.orderList.length+4,width:0,height:Model.define.page.height,borderStyle:"dotted",borderWidth:"1px",left:l.x,top:0}),i.css({display:"block","z-index":Model.orderList.length+5,width:0,height:Model.define.page.height,borderStyle:"dotted",borderWidth:"1px",left:l.x,top:0,cursor:"move"}),n.bind("mousemove.drag",function(n){Designer.op.destroy();var a=Utils.getRelativePos(n.pageX,n.pageY,o);if(a.x>=e)r.css({borderColor:"rgb(114,253,107)",backgroundColor:"rgba(114,253,107,0.5)",width:a.x-e}),i.css({borderColor:"rgb(114,253,107)",backgroundColor:"transparent",width:0}),i.css({left:a.x});else{let n=t.passedShapesEdge-t.sublineSideEdge>0?t.passedShapesEdge:t.sublineSideEdge;a.x0&&moveShapeAndFile("x",e,n),o>0&&moveShapeAndFile("x",e,0-o),r.css({borderColor:"#333",backgroundColor:"transparent",width:0}),i.css({borderColor:"#333",backgroundColor:"transparent",width:0}),r.hide(),i.hide();var a=getCanvasContentEdge(),l=Model.define.page;a.right>l.width-l.padding&&(Designer.setPageStyle({width:a.right+l.padding+30}),$("#page_size_w").spinner("value",a.right+l.padding+30)),$(document).unbind("mouseup.drop")})}),$(document).bind("mouseup.drag",function(){n.unbind("mousemove.drag"),n.unbind("mousedown.drag"),$(document).unbind("mouseup.drag")})})})}),Designer.addFunction("setFontStyle",function(e){var t=Utils.getSelected();if(0!=t.length){for(var r=0;r1&&Designer.painter.drawControls(o),Model.updateMulti(r),Utils.showLinkerControls()}}),Designer.addFunction("matchSize",function(e){var t=Utils.getSelected();if(0!=t.length&&e){for(var r=null,i=null,n=[],o=0;or)&&(r=l.props.w),(null==i||l.props.h>i)&&(i=l.props.h))}"auto"==e.w&&(e.w=r),"auto"==e.h&&(e.h=i),Utils.removeAnchors();var a=[];for(o=0;o=0;i--){r-=1,(g=t[i]).props.zindex=r}}else if("backward"==e){var p=null;for(o=null,i=0;i=0;r--){var i=Model.orderList[r];if(!(i.zindex>=e.props.zindex||Utils.isSelected(i.id))){var n=Model.getShapeById(i.id),o=Utils.getShapeBox(n);if(Utils.rectCross(t,o))return n}}return null}}),Designer.addFunction("group",function(){var e=Utils.getSelected();if(!(e.length<2)){for(var t=Utils.newId(),r=0;r4&&(e=4),Utils.hideLinkerCursor(),Designer.config.scale=e,Designer.initialize.initCanvas(),Model.define.elements){var r=Model.define.elements[t];Designer.painter.renderShape(r)}var i=Utils.getSelectedIds(),n=Utils.getSelectedLockedIds();Utils.mergeArray(i,n),Utils.unselect(),Utils.selectShape(i),Utils.showLinkerCursor()}),Designer.addFunction("setShapeProps",function(e){var t=Utils.getSelected();if(0!=t.length&&e){for(var r=[],i=[],n=0;n0&&Model.updateMulti(r);var d=Utils.getSelectedIds();Utils.unselect(),Utils.selectShape(d)}}),Designer.addFunction("addDataAttribute",function(e){var t=Utils.getSelectedIds(),r=Model.getShapeById(t[0]);r.dataAttributes||(r.dataAttributes=[]),e.id=Utils.newId(),e.category="custom",r.dataAttributes.push(e),MessageSource.doWithoutUpdateDock(function(){Model.update(r)})}),Designer.addFunction("updateDataAttribute",function(e){var t=Utils.getSelectedIds(),r=Model.getShapeById(t[0]);r.dataAttributes||(r.dataAttributes=[]);for(var i=!1,n=0;n