|
@@ -38,12 +38,18 @@ export class TransferCtrl extends ModuleControl<EditorModule> {
|
|
|
width: "",
|
|
|
height: "",
|
|
|
transform: {
|
|
|
+ scale: 1,
|
|
|
rotate: "0deg",
|
|
|
translateX: "-50%",
|
|
|
translateY: "-50%",
|
|
|
},
|
|
|
});
|
|
|
|
|
|
+ originPiont = {
|
|
|
+ x: 0,
|
|
|
+ y: 0,
|
|
|
+ };
|
|
|
+
|
|
|
init(pageEl: HTMLElement) {
|
|
|
this.groupCtrl.init();
|
|
|
|
|
@@ -117,20 +123,27 @@ export class TransferCtrl extends ModuleControl<EditorModule> {
|
|
|
const matrix = new Matrix();
|
|
|
matrix.setFormDiv(this.compEl);
|
|
|
|
|
|
- this.transferStyle.width = this.compEl.clientWidth + "px";
|
|
|
- this.transferStyle.height = this.compEl.clientHeight + "px";
|
|
|
+ const width = this.compEl.clientWidth * matrix.getScale();
|
|
|
+ const height = this.compEl.clientHeight * matrix.getScale();
|
|
|
+
|
|
|
+ this.transferStyle.width = width + "px";
|
|
|
+ this.transferStyle.height = height + "px";
|
|
|
this.transferStyle.top = rect.top + rect.height / 2 - pageRect.top + "px";
|
|
|
this.transferStyle.left = rect.left + rect.width / 2 - pageRect.left + "px";
|
|
|
if (!this.transferStyle.transform) {
|
|
|
this.transferStyle.transform = {
|
|
|
+ scale: 1,
|
|
|
rotate: "0deg",
|
|
|
translateX: "-50%",
|
|
|
translateY: "-50%",
|
|
|
};
|
|
|
}
|
|
|
+ this.transferStyle.transform.scale = matrix.getScale();
|
|
|
this.transferStyle.transform.rotate = matrix.getRotate() + "deg";
|
|
|
- this.transferStyle.transform.translateY =
|
|
|
- "-" + this.compEl.clientHeight / 2 + "px";
|
|
|
+ this.transferStyle.transform.translateY = "-" + height / 2 + "px";
|
|
|
+
|
|
|
+ this.originPiont.x = rect.left + rect.width / 2;
|
|
|
+ this.originPiont.y = rect.top + rect.height / 2;
|
|
|
}
|
|
|
|
|
|
resetStyle() {
|