fix:修复多种数据结构布局对齐问题
This commit is contained in:
parent
bd6f9cd0d4
commit
4ef63ec96d
3
.gitignore
vendored
3
.gitignore
vendored
@ -1,4 +1,5 @@
|
||||
node_modules
|
||||
test
|
||||
dist
|
||||
资料
|
||||
资料
|
||||
\copyDist2Anyview.js
|
||||
@ -1,6 +1,6 @@
|
||||
const fs = require('fs');
|
||||
const sourcePath = 'E:\\研究生\\StructV2\\dist\\sv.js';
|
||||
const targetPath = 'E:\\研究生\\froend_student\\src\\pages\\student\\assets\\js\\sv.js'
|
||||
const sourcePath = 'D:\\个人项目\\StructV2\\dist\\sv.js';
|
||||
const targetPath = 'D:\\个人项目\\froend_student\\src\\pages\\student\\assets\\js\\sv.js'
|
||||
|
||||
|
||||
function COPY(from, to) {
|
||||
|
||||
@ -282,37 +282,44 @@ export class LayoutProvider {
|
||||
prevBound: BoundingRect,
|
||||
bound: BoundingRect,
|
||||
boundList: BoundingRect[] = [],
|
||||
groupPadding = this.viewOptions.groupPadding,
|
||||
groupPadding = this.viewOptions.groupPadding,
|
||||
dx = 0,
|
||||
dy = 0;
|
||||
dy = 0,
|
||||
prevCenterX = 0,
|
||||
prevCenterY = 0;
|
||||
|
||||
|
||||
for (let i = 0; i < modelGroupList.length; i++) {
|
||||
group = modelGroupList[i];
|
||||
bound = group.getPaddingBound(groupPadding);
|
||||
|
||||
// 左往右水平布局
|
||||
// 左往右水平布局
|
||||
if (layoutMode === ELayoutMode.HORIZONTAL) {
|
||||
if (prevBound) {
|
||||
dx = prevBound.x + prevBound.width - bound.x;
|
||||
dy = prevCenterY - (bound.y + bound.height / 2);
|
||||
} else {
|
||||
dx = bound.x;
|
||||
}
|
||||
|
||||
group.translate(dx, 0);
|
||||
Bound.translate(bound, dx, 0);
|
||||
group.translate(dx, dy);
|
||||
Bound.translate(bound, dx, dy);
|
||||
|
||||
prevCenterY = bound.y + bound.height / 2;
|
||||
}
|
||||
|
||||
// 上到下垂直布局
|
||||
// 上到下垂直布局
|
||||
if (layoutMode === ELayoutMode.VERTICAL) {
|
||||
if (prevBound) {
|
||||
dx = prevCenterX - (bound.x + bound.width / 2);
|
||||
dy = prevBound.y + prevBound.height - bound.y - groupPadding;
|
||||
} else {
|
||||
dy = bound.y;
|
||||
}
|
||||
|
||||
group.translate(0, dy);
|
||||
Bound.translate(bound, 0, dy);
|
||||
group.translate(dx, dy);
|
||||
Bound.translate(bound, dx, dy);
|
||||
|
||||
prevCenterX = bound.x + bound.width / 2;
|
||||
}
|
||||
|
||||
boundList.push(bound);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user