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 3f7fd1ff..9d50ade8 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 @@ -174,6 +174,15 @@ Designer.addFunction("selectVertical", function() { subline1.hide() subline2.hide() + var edgePos = getCanvasContentEdge() + var pageSize = Model.define.page; + if(edgePos.bottom > pageSize.height - pageSize.padding) { + Designer.setPageStyle({ + height: edgePos.bottom + pageSize.padding + 30 + }); + $("#page_size_w").spinner('value',edgePos.bottom + pageSize.padding + 30); + } + $(document).unbind("mouseup.drop") }) }) @@ -572,6 +581,75 @@ function moveLanes(type,sublinePos,movedDistance) { } +function getCanvasContentEdge() { + var pos = { + top: 0, + bottom: 0, + left: 0, + right: 0 + } + var elements = Model.define.elements + var xArr = [] + var yArr = [] + for (let key in elements) { + if (elements[key].points == undefined) { // 形状 + xArr.push({ + x: elements[key].props.x, + type: 'shape', + shapeWidth: elements[key].props.w + }) + yArr.push({ + y: elements[key].props.y, + type: 'shape', + shapeHeight: elements[key].props.h + }) + } else { + xArr.push({ + x: elements[key].from.x, + type: 'line' + }) + xArr.push({ + x: elements[key].to.x, + type: 'line' + }) + yArr.push({ + y: elements[key].from.y, + type: 'line' + }) + yArr.push({ + y: elements[key].to.y, + type: 'line' + }) + for (let i = 0; i < elements[key].points.length; i++) { + xArr.push({ + x: elements[key].points[i].x, + type: 'line' + }) + yArr.push({ + y: elements[key].points[i].y, + type: 'line' + }) + } + } + } + pos.left = Math.min.apply(Math,xArr.map(item => { return item.x })) + pos.top = Math.min.apply(Math,yArr.map(item => { return item.y })) + // 特殊处理右和下 若有图形 加上图形的高/宽 + for (let i = 0; i < xArr.length; i++) { + if(xArr[i].type == 'shape') { + xArr[i].x += xArr[i].shapeWidth + } + } + for (let i = 0; i < yArr.length; i++) { + if(yArr[i].type == 'shape') { + yArr[i].y += yArr[i].shapeHeight + } + } + pos.right = Math.max.apply(Math,xArr.map(item => { return item.x })) + pos.bottom = Math.max.apply(Math,yArr.map(item => { return item.y })) + return pos +} + /** * 设计器方法:调节水平间距 */ @@ -679,6 +757,16 @@ Designer.addFunction("selectHorizontal", function() { subline1.hide() subline2.hide() + var edgePos = getCanvasContentEdge() + var pageSize = Model.define.page; + console.log(edgePos.right) + console.log(pageSize.width) + if(edgePos.right > pageSize.width - pageSize.padding) { + Designer.setPageStyle({ + width: edgePos.right + pageSize.padding + 30 + }); + $("#page_size_w").spinner('value',edgePos.right + pageSize.padding + 30); + } $(document).unbind("mouseup.drop") }) }) 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 ba56c49b..c91fb726 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;nr&&(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;r=t?h.push(i[r]):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/2t?l.push(i[r]):d.push(i[r]):"y"==e&&(i[r].props[e]>=t?h.push(i[r]):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/2t?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){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 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,t,r=$("#designer_subline1"),i=$("#designer_subline2"),n=$("#canvas_container"),o=$("#designer_canvas");n.bind("mousemove.drag",function(a){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){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){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.y=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.x1&&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;ni&&(r=!0),e.to[t]>i&&(r=!0);for(let n=0;ni&&(r=!0);return r}function filterShapeAndLine(e,t){var i=Model.define.elements,r=[],n=[],o=[],a=[],l=[],s=0,d=[],p=0,h=[],g=[];for(let e in i)null==i[e].points?r.push(i[e]):n.push(i[e]),"lane"==i[e].category&&o.push(i[e]);for(let i=0;i=t?h.push(r[i]):r[i].props.x+r[i].props.w/2>=t?(a.push(r[i]),h.push(r[i])):r[i].props.x+r[i].props.w/2t?l.push(r[i]):d.push(r[i]):"y"==e&&(r[i].props[e]>=t?h.push(r[i]):r[i].props.y+r[i].props.h/2>=t?(a.push(r[i]),h.push(r[i])):r[i].props.y+r[i].props.h/2t?l.push(r[i]):d.push(r[i]));for(let i=0;ie.id==n[i].id);isLineBelowOrRight(n[i],e,t)&&-1==r&&g.push(n[i])}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;ti.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,i){var r=filterShapeAndLine(e,t),n=r.movingLines,o=r.movingShapes,a=r.passedShapes,l=r.passedMoreShapes;if(0==r.laneArr.length){"y"==e?Designer.op.moveShape(o,{x:0,y:i}):"x"==e&&Designer.op.moveShape(o,{x:i,y:0});for(let r=0;re.id==n[r].from.id),s=a.findIndex(e=>e.id==n[r].to.id),d=l.findIndex(e=>e.id==n[r].from.id),p=l.findIndex(e=>e.id==n[r].to.id);for(let o=0;ot&&(n[r].points[o][e]+=i);if(n[r].from[e]>t&&-1==d)n[r].from[e]+=i;else if(n[r].from[e]<=t&&-1!==o){for(let t=0;tt&&-1==p)n[r].to[e]+=i;else if(a.length>0&&n[r].to[e]<=t&&-1!==s){for(let t=0;t0&&Model.updateMulti(s)}else moveLanes(e,t,i)}function moveLanes(e,t,i){var r=filterShapeAndLine(e,t),n=r.movingLines,o=r.movingShapes,a=r.passedShapes,l=r.passedMoreShapes,s=r.laneArr,d=[],p=[];for(let e=0;e{let r=i.lanes.findIndex(e=>""==e.parent),n=i.lanes.findIndex(e=>"verticalSeparatorBar"==e.name),o=i.lanes.findIndex(e=>"horizontalSeparatorBar"==e.name),a=i.lanes[r],l=i.lanes[n],s=i.lanes[o];if("x"==e){let e=a.props.xt,r=void 0!==l&&l.props.xt,n=a.props.xt;"verticalPool"==i.name?i.isPassed=e&&!r:"horizontalPool"==i.name&&(i.isPassed=e&&!n),i.lanes.forEach(e=>{e.props.x+e.props.w>t&&i.changed.push(e)})}else if("y"==e){let e=a.props.yt,r=void 0!==s&&s.props.yt,n=a.props.yt;"verticalPool"==i.name?i.isPassed=e&&!n:"horizontalPool"==i.name&&(i.isPassed=e&&!r),i.lanes.forEach(e=>{e.props.y+e.props.h>t&&i.changed.push(e)})}}),"x"==e?(Designer.op.moveShape(o.filter(e=>"lane"!==e.category),{x:i,y:0}),d.forEach(e=>{e.changed.forEach(r=>{if(e.isPassed){if(e.isPassed){if("verticalPool"==e.name)switch(r.name){case"verticalPool":r.props.w+=i;break;case"verticalLane":r.props.w+=r.props.xt?i:0,r.props.x+=r.props.x>t?i:0;break;case"horizontalSeparator":r.props.w+=i}if("horizontalPool"==e.name)switch(r.name){case"horizontalPool":case"horizontalLane":r.props.w+=i;break;case"verticalSeparator":r.props.w+=r.props.xt?i:0,r.props.x+=r.props.x>t?i:0;break;case"horizontalSeparatorBar":r.props.w+=i}}}else r.props.x+=i;p.push(r),Designer.painter.renderShape(r)})})):"y"==e&&(Designer.op.moveShape(o.filter(e=>"lane"!==e.category),{x:0,y:i}),d.forEach(e=>{e.changed.forEach(r=>{if(e.isPassed){if(e.isPassed){if("verticalPool"==e.name)switch(r.name){case"verticalPool":case"verticalLane":r.props.h+=i;break;case"horizontalSeparator":r.props.h+=r.props.yt?i:0,r.props.y+=r.props.y>t?i:0;break;case"verticalSeparatorBar":r.props.h+=i}if("horizontalPool"==e.name)switch(r.name){case"horizontalPool":r.props.h+=i;break;case"horizontalLane":r.props.h+=r.props.yt?i:0,r.props.y+=r.props.y>t?i:0;break;case"verticalSeparator":r.props.h+=i}}}else r.props.y+=i;p.push(r),Designer.painter.renderShape(r)})}));for(let r=0;re.id==n[r].from.id),s=a.findIndex(e=>e.id==n[r].to.id),d=l.findIndex(e=>e.id==n[r].from.id),p=l.findIndex(e=>e.id==n[r].to.id);for(let o=0;ot&&(n[r].points[o][e]+=i);if(n[r].from[e]>t&&-1==d)n[r].from[e]+=i;else if(n[r].from[e]<=t&&-1!==o){for(let t=0;tt&&-1==p)n[r].to[e]+=i;else if(a.length>0&&n[r].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,i=[],r=[];for(let e in t)if(null==t[e].points)i.push({x:t[e].props.x,type:"shape",shapeWidth:t[e].props.w}),r.push({y:t[e].props.y,type:"shape",shapeHeight:t[e].props.h});else{i.push({x:t[e].from.x,type:"line"}),i.push({x:t[e].to.x,type:"line"}),r.push({y:t[e].from.y,type:"line"}),r.push({y:t[e].to.y,type:"line"});for(let n=0;ne.x)),e.top=Math.min.apply(Math,r.map(e=>e.y));for(let e=0;ee.x)),e.bottom=Math.max.apply(Math,r.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 i in e)t.push(i);Utils.selectShape(t)}),Designer.addFunction("selectVertical",function(){var e,t,i=$("#designer_subline1"),r=$("#designer_subline2"),n=$("#canvas_container"),o=$("#designer_canvas");n.bind("mousemove.drag",function(a){let l=Utils.getRelativePos(a.pageX,a.pageY,o);i.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){n.unbind("mousemove.drag");let l=Utils.getRelativePos(a.pageX,a.pageY,o);e=l.y,t=filterShapeAndLine("y",e),i.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}),r.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){var a=Utils.getRelativePos(n.pageX,n.pageY,o);if(a.y>=e)i.css({borderColor:"rgb(114,253,107)",backgroundColor:"rgba(114,253,107,0.5)",height:a.y-e}),r.css({borderColor:"rgb(114,253,107)",backgroundColor:"transparent",height:0}),r.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,t,i=$("#designer_subline1"),r=$("#designer_subline2"),n=$("#canvas_container"),o=$("#designer_canvas");n.bind("mousemove.drag",function(a){let l=Utils.getRelativePos(a.pageX,a.pageY,o);i.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){n.unbind("mousemove.drag");let l=Utils.getRelativePos(a.pageX,a.pageY,o);e=l.x,t=filterShapeAndLine("x",e),i.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}),r.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){var a=Utils.getRelativePos(n.pageX,n.pageY,o);if(a.x>=e)i.css({borderColor:"rgb(114,253,107)",backgroundColor:"rgba(114,253,107,0.5)",width:a.x-e}),r.css({borderColor:"rgb(114,253,107)",backgroundColor:"transparent",width:0}),r.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 i=0;i1&&Designer.painter.drawControls(o),Model.updateMulti(i),Utils.showLinkerControls()}}),Designer.addFunction("matchSize",function(e){var t=Utils.getSelected();if(0!=t.length&&e){for(var i=null,r=null,n=[],o=0;oi)&&(i=l.props.w),(null==r||l.props.h>r)&&(r=l.props.h))}"auto"==e.w&&(e.w=i),"auto"==e.h&&(e.h=r),Utils.removeAnchors();var a=[];for(o=0;o=0;r--){i-=1,(g=t[r]).props.zindex=i}}else if("backward"==e){var p=null;for(o=null,r=0;r=0;i--){var r=Model.orderList[i];if(!(r.zindex>=e.props.zindex||Utils.isSelected(r.id))){var n=Model.getShapeById(r.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(),i=0;i4&&(e=4),Utils.hideLinkerCursor(),Designer.config.scale=e,Designer.initialize.initCanvas(),Model.define.elements){var i=Model.define.elements[t];Designer.painter.renderShape(i)}var r=Utils.getSelectedIds(),n=Utils.getSelectedLockedIds();Utils.mergeArray(r,n),Utils.unselect(),Utils.selectShape(r),Utils.showLinkerCursor()}),Designer.addFunction("setShapeProps",function(e){var t=Utils.getSelected();if(0!=t.length&&e){for(var i=[],r=[],n=0;n0&&Model.updateMulti(i);var d=Utils.getSelectedIds();Utils.unselect(),Utils.selectShape(d)}}),Designer.addFunction("addDataAttribute",function(e){var t=Utils.getSelectedIds(),i=Model.getShapeById(t[0]);i.dataAttributes||(i.dataAttributes=[]),e.id=Utils.newId(),e.category="custom",i.dataAttributes.push(e),MessageSource.doWithoutUpdateDock(function(){Model.update(i)})}),Designer.addFunction("updateDataAttribute",function(e){var t=Utils.getSelectedIds(),i=Model.getShapeById(t[0]);i.dataAttributes||(i.dataAttributes=[]);for(var r=!1,n=0;n