fix: 流程图生成图片 右侧出现大片空白问题

This commit is contained in:
qinoy 2024-11-08 14:41:39 +08:00
parent a70f725ee4
commit 2c86dd443e
2 changed files with 11 additions and 18 deletions

View File

@ -4332,9 +4332,8 @@ public class PALRepositoryQueryAPIManager {
//特殊处理shape外属性显示内容被切割问题
boolean addEmptyFlag = false;
String str = "";
int maxX = 0;
int maxY = 0;
int maxW = 0;
int rightBoundary = 0; // 记录图最右侧边界值
int bottomBoundary = 0; // 记录图最下侧边界值
boolean isRight = false;
JSONObject defineObj = JSON.parseObject(define);
if (defineObj.containsKey("elements")) {
@ -4372,18 +4371,12 @@ public class PALRepositoryQueryAPIManager {
if (null == props) {
continue;
}
Integer x = props.getInteger("x");
if (null != x && x > maxX) {
maxX = x;
}
Integer y = props.getInteger("y");
if (null != y && y > maxY) {
maxY = y;
}
Integer w = props.getInteger("w");
if (null != w && w > maxW){
maxW = w;
}
int x = props.getIntValue("x");
int y = props.getIntValue("y");
int w = props.getIntValue("w");
int h = props.getIntValue("h");
rightBoundary = Math.max(x + w, rightBoundary);
bottomBoundary = Math.max(y + h, bottomBoundary);
}
}
@ -4394,12 +4387,12 @@ public class PALRepositoryQueryAPIManager {
if (textShape != null && textShape.containsKey("props")) {
JSONObject props = textShape.getJSONObject("props");
props.put("w", 100);
props.put("y", maxY);
props.put("y", bottomBoundary);
props.put("h", 50);
if (isRight) {
props.put("x", maxX + maxW + (str.length() * 2));
props.put("x", rightBoundary + (str.length() * 2));
} else {
props.put("x", maxX - (str.length() * 2));
props.put("x", rightBoundary - (str.length() * 2));
}
elements.put(textShape.getString("id"), textShape);