|
@@ -388,7 +388,6 @@ export class SelectCtrl extends ModuleControl<EditorModule> {
|
|
|
|
|
|
let tmp = new Matrix();
|
|
|
tmp.copyFrom(obj.worldTransform);
|
|
|
- // tmp.scale(0.5 , 0.5);
|
|
|
|
|
|
let matrix = `matrix(${tmp.a},${tmp.b},${tmp.c},${tmp.d},${tmp.tx},${tmp.ty})`;
|
|
|
tmp.invert();
|
|
@@ -659,6 +658,8 @@ export class SelectCtrl extends ModuleControl<EditorModule> {
|
|
|
scaleCmd = false;
|
|
|
lastScale = { x: 1, y: 1 };
|
|
|
|
|
|
+ initScaleWith = {w: 0, h:0};
|
|
|
+
|
|
|
scaleMousemove(event: MouseEvent) {
|
|
|
let dirIndexs = [
|
|
|
"scaleBottomright",
|
|
@@ -690,6 +691,8 @@ export class SelectCtrl extends ModuleControl<EditorModule> {
|
|
|
this.mainAxisVector = { x: StartX - pivot.x, y: StartY - pivot.y };
|
|
|
let scale = objContainer.parent.scale;
|
|
|
this.initScale = { x: scale.x, y: scale.y };
|
|
|
+ this.initScaleWith = {w: objContainer.width, h: objContainer.height}
|
|
|
+
|
|
|
this.mainAxisVectorLenth = VectorLenth(
|
|
|
this.mainAxisVector.x,
|
|
|
this.mainAxisVector.y
|
|
@@ -715,7 +718,10 @@ export class SelectCtrl extends ModuleControl<EditorModule> {
|
|
|
let dtaY = Project(vec, this.yAxisVector) / this.yAxisVectorLength;
|
|
|
this.lastScale.x = dtaX * this.initScale.x;
|
|
|
this.lastScale.y = dtaY * this.initScale.y;
|
|
|
- objContainer.scale(this.lastScale.x, this.lastScale.y);
|
|
|
+ // objContainer.scale(this.lastScale.x, this.lastScale.y);
|
|
|
+ const currW = this.initScaleWith.w * this.lastScale.x;
|
|
|
+ objContainer.scaleSize(currW, this.lastScale.y * this.initScaleWith.h);
|
|
|
+
|
|
|
} else {
|
|
|
let mainVec = this.mainAxisVector;
|
|
|
let dtaScale = Project(vec, mainVec) / this.mainAxisVectorLenth;
|
|
@@ -724,13 +730,22 @@ export class SelectCtrl extends ModuleControl<EditorModule> {
|
|
|
if (i == -1) {
|
|
|
this.lastScale.x = dtaScale * this.initScale.x;
|
|
|
this.lastScale.y = dtaScale * this.initScale.y;
|
|
|
- objContainer.scale(this.lastScale.x, this.lastScale.y);
|
|
|
+ // objContainer.scale(this.lastScale.x, this.lastScale.y);
|
|
|
+ const currW = this.initScaleWith.w * this.lastScale.x;
|
|
|
+ objContainer.scaleSize(currW, this.initScaleWith.h *this.lastScale.y);
|
|
|
+ // objContainer.scaleHeight(, dtaScale);
|
|
|
+
|
|
|
} else if (i == 0 || i == 1) {
|
|
|
this.lastScale.x = dtaScale * this.initScale.x;
|
|
|
- objContainer.scaleX(this.lastScale.x);
|
|
|
+ // objContainer.scaleX(this.lastScale.x);
|
|
|
+ const currW = this.initScaleWith.w * this.lastScale.x;
|
|
|
+ objContainer.scaleWidth(currW);
|
|
|
+
|
|
|
} else if (i == 2 || i == 3) {
|
|
|
this.lastScale.y = dtaScale * this.initScale.y;
|
|
|
- objContainer.scaleY(this.lastScale.y);
|
|
|
+
|
|
|
+ // objContainer.scaleY(this.lastScale.y);
|
|
|
+ objContainer.scaleHeight(this.lastScale.y * this.initScaleWith.h);
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -743,8 +758,8 @@ export class SelectCtrl extends ModuleControl<EditorModule> {
|
|
|
let preScale = { x: this.initScale.x, y: this.initScale.y };
|
|
|
let scaleIndex = this.scaleIndex;
|
|
|
let lastScale = { x: this.lastScale.x, y: this.lastScale.y };
|
|
|
- this.objContainer?.applyScaleToChildSize();
|
|
|
- this.upgateGizmoStyle();
|
|
|
+ // this.objContainer?.applyScaleToChildSize();
|
|
|
+ // this.upgateGizmoStyle();
|
|
|
// this.editor.history.record({
|
|
|
// undo:()=>{
|
|
|
// this.objContainer.setPivot( scaleIndex );
|