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 8e73ebfa..7966253b 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 @@ -673,6 +673,9 @@
+ diff --git a/com.actionsoft.apps.coe.pal/web/com.actionsoft.apps.coe.pal/js/coe.team.pal.designer.js b/com.actionsoft.apps.coe.pal/web/com.actionsoft.apps.coe.pal/js/coe.team.pal.designer.js index 1163a55c..887a5396 100644 --- a/com.actionsoft.apps.coe.pal/web/com.actionsoft.apps.coe.pal/js/coe.team.pal.designer.js +++ b/com.actionsoft.apps.coe.pal/web/com.actionsoft.apps.coe.pal/js/coe.team.pal.designer.js @@ -315,8 +315,85 @@ $(function() { $("#saving_tip").text("文件已修改,未保存"); } }) + + // 快捷调整画布大小点击事件 + $('#bar_resize').off('click').on('click',function () { + let pos = getCanvasContentEdge() + var elements = Model.define.elements; + var shapeIds = []; + for(var shapeId in elements){ + shapeIds.push(shapeId); + } + Utils.selectShape(shapeIds); + var movingShapes = null + if (movingShapes == null) { // 形状移动 designer.extend.core.js方法挪用 + var selected = Utils.getSelected(); + var familyShapes = Utils.getFamilyShapes(selected); + selected = selected.concat(familyShapes); + var containedShapes = Utils.getContainedShapes(selected); + selected = selected.concat(containedShapes); + var attachedShapes = Utils.getAttachedShapes(selected); + selected = selected.concat(attachedShapes); + var outlinkers = Utils.getOutlinkers(selected); + movingShapes = selected.concat(outlinkers); + } + if(movingShapes.length > 0) { + // 下移或上移 距顶部60 默认padding 60 + Designer.op.moveShape(movingShapes, { + x : 0, + y : 120 - pos.top + }); + // 右移或左移 距左部60 默认padding 60 + Designer.op.moveShape(movingShapes, { + x : 120 - pos.left, + y : 0 + }); + } + var contentWidth = pos.right - pos.left + var contentHeight = pos.bottom - pos.top + Designer.setPageStyle({ + width: contentWidth + 240, + height: contentHeight + 240 + }); + $("#saving_tip").css("color", "rgb(255, 0, 0)"); + $("#saving_tip").text("文件已修改,未保存"); + movingShapes = null; + Designer.op.hideTip(); + Utils.unselect(); + }) }); +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(elements[key].props.x) + yArr.push(elements[key].props.y) + } else { + xArr.push(elements[key].from.x) + xArr.push(elements[key].to.x) + yArr.push(elements[key].from.y) + yArr.push(elements[key].to.y) + for (let i = 0; i < elements[key].points.length; i++) { + xArr.push(elements[key].points[i].x) + yArr.push(elements[key].points[i].y) + } + } + } + pos.left = Math.min.apply(null,xArr) + pos.right = Math.max.apply(null,xArr) + pos.top = Math.min.apply(null,yArr) + pos.bottom = Math.max.apply(null,yArr) + return pos +} /**定时保存**/ function saveTimer() { diff --git a/com.actionsoft.apps.coe.pal/web/com.actionsoft.apps.coe.pal/lib/designer/themes/default/diagraming/ui.css b/com.actionsoft.apps.coe.pal/web/com.actionsoft.apps.coe.pal/lib/designer/themes/default/diagraming/ui.css index 9d86fa8a..812bc502 100755 --- a/com.actionsoft.apps.coe.pal/web/com.actionsoft.apps.coe.pal/lib/designer/themes/default/diagraming/ui.css +++ b/com.actionsoft.apps.coe.pal/web/com.actionsoft.apps.coe.pal/lib/designer/themes/default/diagraming/ui.css @@ -150,6 +150,9 @@ html{ .ico.sort{ background-position: 1px -637px; } +.ico.resize{ + background-position: -20px -600px; +} .ico.brush{ background-position: -20px -20px; }