|
@@ -147,7 +147,9 @@ export class SGraphSelectContainer extends SObject {
|
|
|
// 将p转换为当前item中的坐标
|
|
|
let p1 = curItem.mapFromScene(p.x, p.y);
|
|
|
// 根据等式差值相等 newboundx - oldboundx = newposx - oldposx => newposx = newboundx - oldboundx + oldposx
|
|
|
- curItem.x = p1.x - curItem.boundingRect().x + curItem.x;
|
|
|
+ curItem.x =
|
|
|
+ (p1.x - curItem.boundingRect().x) * curItem.inverseScale +
|
|
|
+ curItem.x;
|
|
|
}
|
|
|
}
|
|
|
} // Function alignLeft()
|
|
@@ -166,7 +168,9 @@ export class SGraphSelectContainer extends SObject {
|
|
|
let curItem = this.itemList[i];
|
|
|
if (curItem.moveable) {
|
|
|
let p1 = curItem.mapFromScene(p.x, p.y);
|
|
|
- curItem.y = p1.y - curItem.boundingRect().y + curItem.y;
|
|
|
+ curItem.y =
|
|
|
+ (p1.y - curItem.boundingRect().y) * curItem.inverseScale +
|
|
|
+ curItem.y;
|
|
|
}
|
|
|
}
|
|
|
} // Function alignTop()
|
|
@@ -185,7 +189,10 @@ export class SGraphSelectContainer extends SObject {
|
|
|
let curItem = this.itemList[i];
|
|
|
if (curItem.moveable) {
|
|
|
let p1 = curItem.mapFromScene(p.x, p.y);
|
|
|
- curItem.x = p1.x - curItem.boundingRect().right + curItem.x;
|
|
|
+ curItem.x =
|
|
|
+ (p1.x - curItem.boundingRect().right) *
|
|
|
+ curItem.inverseScale +
|
|
|
+ curItem.x;
|
|
|
}
|
|
|
}
|
|
|
} // Function alignRight()
|
|
@@ -204,7 +211,10 @@ export class SGraphSelectContainer extends SObject {
|
|
|
let curItem = this.itemList[i];
|
|
|
if (curItem.moveable) {
|
|
|
let p1 = curItem.mapFromScene(p.x, p.y);
|
|
|
- curItem.y = p1.y - curItem.boundingRect().bottom + curItem.y;
|
|
|
+ curItem.y =
|
|
|
+ (p1.y - curItem.boundingRect().bottom) *
|
|
|
+ curItem.inverseScale +
|
|
|
+ curItem.y;
|
|
|
}
|
|
|
}
|
|
|
} // Function alignBottom()
|
|
@@ -226,7 +236,9 @@ export class SGraphSelectContainer extends SObject {
|
|
|
let p1 = curItem.mapFromScene(p.x, p.y);
|
|
|
// 根据等式差值相等 newcenterx - oldcenterx = newposx - oldposx => newposx = newcenterx - oldcenterx + oldposx
|
|
|
curItem.x =
|
|
|
- p1.x - curItem.boundingRect().center().x + curItem.x;
|
|
|
+ (p1.x - curItem.boundingRect().center().x) *
|
|
|
+ curItem.inverseScale +
|
|
|
+ curItem.x;
|
|
|
}
|
|
|
}
|
|
|
} // Function alignCenter()
|
|
@@ -247,7 +259,9 @@ export class SGraphSelectContainer extends SObject {
|
|
|
if (curItem.moveable) {
|
|
|
let p1 = curItem.mapFromScene(p.x, p.y);
|
|
|
curItem.y =
|
|
|
- p1.y - curItem.boundingRect().center().y + curItem.y;
|
|
|
+ (p1.y - curItem.boundingRect().center().y) *
|
|
|
+ curItem.inverseScale +
|
|
|
+ curItem.y;
|
|
|
}
|
|
|
}
|
|
|
} // Function alignMiddle()
|
|
@@ -302,7 +316,9 @@ export class SGraphSelectContainer extends SObject {
|
|
|
);
|
|
|
let p2 = curItem.mapFromScene(p1.x, p1.y + average * k);
|
|
|
curItem.y =
|
|
|
- p2.y - curItem.boundingRect().center().y + curItem.y;
|
|
|
+ (p2.y - curItem.boundingRect().center().y) *
|
|
|
+ curItem.inverseScale +
|
|
|
+ curItem.y;
|
|
|
}
|
|
|
}
|
|
|
} // Function alignVertical()
|
|
@@ -358,7 +374,9 @@ export class SGraphSelectContainer extends SObject {
|
|
|
let p2 = curItem.mapFromScene(p1.x + average * k, p1.y);
|
|
|
// 根据等式 newposx - oldposx = newcenterx - oldcenterx
|
|
|
curItem.x =
|
|
|
- p2.x - curItem.boundingRect().center().x + curItem.x;
|
|
|
+ (p2.x - curItem.boundingRect().center().x) *
|
|
|
+ curItem.inverseScale +
|
|
|
+ curItem.x;
|
|
|
}
|
|
|
}
|
|
|
} // Function alignHorizontal()
|