PAL设计器画布大小自适应

This commit is contained in:
mrs_12345@163.com 2022-06-30 13:46:44 +08:00
parent e79af0c654
commit a2c539dc2d
3 changed files with 74 additions and 2 deletions

View File

@ -1955,7 +1955,7 @@ function saveInputContent(obj,value) {
if ($(obj).attr("inputType") == "number") {
var val = $(obj).val();
if (/\D/.test(val)) {
$.simpleAlert("此处只能输入数字", "info", 2000);
$.simpleAlert("此处只能输入数字", "warning", 2000);
//$("#simplealert>.msg").css("top", "15px");
return;
}
@ -2364,6 +2364,19 @@ Designer.events.addEventListener("linkerCreated", function(linker) {
* 图形创建后重写
*/
Designer.events.addEventListener("created", function(shape) {
let shapePosition = shape.props
let pageSize = Model.define.page
if (shapePosition.x + shapePosition.w > pageSize.width - pageSize.padding) {
Designer.setPageStyle({
width: shapePosition.x + shapePosition.w + pageSize.padding + 10,
});
}
if (shapePosition.y + shapePosition.h > pageSize.height - pageSize.padding) {
Designer.setPageStyle({
height: shapePosition.y + shapePosition.h + pageSize.padding + 10,
});
}
if (Designer.status == "demo" && !demoCreatedTiped) {
UI.showStartStep("created", $("#" + shape.id));
demoCreatedTiped = true;

View File

@ -1165,6 +1165,21 @@ var Designer = {
Designer.op.hideSnapLine();
Utils.showLinkerCursor();
Utils.showLinkerControls();
var selectedShape = Utils.getSelected()[0];
if (selectedShape) {
var shapePosition = selectedShape.props;
var pageSize = Model.define.page;
if (shapePosition.x + shapePosition.w > pageSize.width - pageSize.padding){
Designer.setPageStyle({
width: shapePosition.x + shapePosition.w + pageSize.padding + 10
});
}
if (shapePosition.y + shapePosition.h > pageSize.height - pageSize.padding){
Designer.setPageStyle({
height: shapePosition.y + shapePosition.h + pageSize.padding + 10
});
}
}
if (isAutoSave == "0") {
$("#saving_tip").css("color", "rgb(255, 0, 0)");
$("#saving_tip").text("文件已修改,未保存");
@ -1519,6 +1534,21 @@ var Designer = {
Designer.op.resetState();
S.unbind("mousemove.resize");
$(document).unbind("mouseup.resize");
var selectedShape = Utils.getSelected()[0];
if (selectedShape) {
var shapePosition = selectedShape.props;
var pageSize = Model.define.page;
if (shapePosition.x + shapePosition.w > pageSize.width - pageSize.padding){
Designer.setPageStyle({
width: shapePosition.x + shapePosition.w + pageSize.padding + 10
});
}
if (shapePosition.y + shapePosition.h > pageSize.height - pageSize.padding){
Designer.setPageStyle({
height: shapePosition.y + shapePosition.h + pageSize.padding + 10
});
}
}
Designer.op.hideTip();
Utils.showLinkerCursor();
Designer.op.hideSnapLine()