@next2d/display 2.4.2 → 2.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +9 -9
- package/src/DisplayObject/usecase/DisplayObjectGetScaleXUseCase.js +4 -3
- package/src/DisplayObject/usecase/DisplayObjectGetScaleYUseCase.js +4 -3
- package/src/DisplayObject/usecase/DisplayObjectSetRotationUseCase.js +3 -1
- package/src/DisplayObject/usecase/DisplayObjectSetScaleXUseCase.js +12 -7
- package/src/DisplayObject/usecase/DisplayObjectSetScaleYUseCase.js +16 -6
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@next2d/display",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.5.0",
|
|
4
4
|
"description": "Next2D Display Package",
|
|
5
5
|
"author": "Toshiyuki Ienaga<ienaga@next2d.app> (https://github.com/ienaga/)",
|
|
6
6
|
"license": "MIT",
|
|
@@ -24,13 +24,13 @@
|
|
|
24
24
|
"url": "git+https://github.com/Next2D/Player.git"
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@next2d/ui": "2.
|
|
28
|
-
"@next2d/text": "2.
|
|
29
|
-
"@next2d/geom": "2.
|
|
30
|
-
"@next2d/media": "2.
|
|
31
|
-
"@next2d/net": "2.
|
|
32
|
-
"@next2d/events": "2.
|
|
33
|
-
"@next2d/filters": "2.
|
|
34
|
-
"@next2d/render-queue": "2.
|
|
27
|
+
"@next2d/ui": "2.5.0",
|
|
28
|
+
"@next2d/text": "2.5.0",
|
|
29
|
+
"@next2d/geom": "2.5.0",
|
|
30
|
+
"@next2d/media": "2.5.0",
|
|
31
|
+
"@next2d/net": "2.5.0",
|
|
32
|
+
"@next2d/events": "2.5.0",
|
|
33
|
+
"@next2d/filters": "2.5.0",
|
|
34
|
+
"@next2d/render-queue": "2.5.0"
|
|
35
35
|
}
|
|
36
36
|
}
|
|
@@ -15,7 +15,8 @@ export const execute = (display_object) => {
|
|
|
15
15
|
if (!matrix) {
|
|
16
16
|
return 1;
|
|
17
17
|
}
|
|
18
|
-
const
|
|
19
|
-
|
|
20
|
-
|
|
18
|
+
const EPS = 1e-12;
|
|
19
|
+
const signX = (Math.abs(matrix[0]) >= EPS ? Math.sign(matrix[0]) : Math.sign(matrix[1])) || 1;
|
|
20
|
+
const xScale = Math.hypot(matrix[0], matrix[1]);
|
|
21
|
+
return Math.round(xScale * signX * 10000) / 10000;
|
|
21
22
|
};
|
|
@@ -15,7 +15,8 @@ export const execute = (display_object) => {
|
|
|
15
15
|
if (!matrix) {
|
|
16
16
|
return 1;
|
|
17
17
|
}
|
|
18
|
-
const
|
|
19
|
-
|
|
20
|
-
|
|
18
|
+
const EPS = 1e-12;
|
|
19
|
+
const sxAbs = Math.hypot(matrix[0], matrix[1]);
|
|
20
|
+
const signX = (Math.abs(matrix[0]) >= EPS ? Math.sign(matrix[0]) : Math.sign(matrix[1])) || 1;
|
|
21
|
+
return Math.round((matrix[0] * matrix[3] - matrix[1] * matrix[2]) / (sxAbs * signX) * 10000) / 10000;
|
|
21
22
|
};
|
|
@@ -18,7 +18,7 @@ const $Deg2Rad = Math.PI / 180;
|
|
|
18
18
|
* @protected
|
|
19
19
|
*/
|
|
20
20
|
export const execute = (display_object, rotation) => {
|
|
21
|
-
rotation = $clamp(rotation % 360,
|
|
21
|
+
rotation = $clamp(rotation % 360, -360, 360, 0);
|
|
22
22
|
if (display_object.$rotation === rotation) {
|
|
23
23
|
return;
|
|
24
24
|
}
|
|
@@ -58,6 +58,8 @@ export const execute = (display_object, rotation) => {
|
|
|
58
58
|
matrix.d = scaleY * Math.cos(radianY);
|
|
59
59
|
}
|
|
60
60
|
}
|
|
61
|
+
display_object.$scaleX = null;
|
|
62
|
+
display_object.$scaleY = null;
|
|
61
63
|
display_object.$rotation = rotation;
|
|
62
64
|
displayObjectApplyChangesService(display_object);
|
|
63
65
|
};
|
|
@@ -26,16 +26,21 @@ export const execute = (display_object, scale_x) => {
|
|
|
26
26
|
: new Matrix();
|
|
27
27
|
}
|
|
28
28
|
if (matrix.b === 0 || isNaN(matrix.b)) {
|
|
29
|
-
matrix.a =
|
|
29
|
+
matrix.a = scaleX;
|
|
30
30
|
}
|
|
31
31
|
else {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
32
|
+
const EPS = 1e-12;
|
|
33
|
+
const theta = Math.atan2(matrix.b, matrix.a);
|
|
34
|
+
const sxAbs = Math.hypot(matrix.a, matrix.b);
|
|
35
|
+
const signX = (Math.abs(matrix.a) >= EPS ? Math.sign(matrix.a) : Math.sign(matrix.b)) || 1;
|
|
36
|
+
const sxSigned = sxAbs * signX;
|
|
37
|
+
const thetaPos = sxSigned >= 0 ? theta : theta - Math.PI;
|
|
38
|
+
const thetaUse = thetaPos + (scaleX < 0 ? Math.PI : 0);
|
|
39
|
+
const use = Math.abs(scaleX);
|
|
40
|
+
matrix.a = use * Math.cos(thetaUse);
|
|
41
|
+
matrix.b = use * Math.sin(thetaUse);
|
|
38
42
|
}
|
|
39
43
|
display_object.$scaleX = scaleX;
|
|
44
|
+
display_object.$rotation = null;
|
|
40
45
|
displayObjectApplyChangesService(display_object);
|
|
41
46
|
};
|
|
@@ -26,16 +26,26 @@ export const execute = (display_object, scale_y) => {
|
|
|
26
26
|
: new Matrix();
|
|
27
27
|
}
|
|
28
28
|
if (matrix.c === 0 || isNaN(matrix.c)) {
|
|
29
|
-
matrix.d =
|
|
29
|
+
matrix.d = scaleY;
|
|
30
30
|
}
|
|
31
31
|
else {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
32
|
+
const targetAbs = Math.max(0, Math.abs(scaleY));
|
|
33
|
+
const EPS = 1e-12;
|
|
34
|
+
let theta = Math.atan2(matrix.b, matrix.a);
|
|
35
|
+
if (matrix.a < 0 || Math.abs(matrix.a) < EPS && matrix.b < 0) {
|
|
36
|
+
theta -= Math.PI;
|
|
35
37
|
}
|
|
36
|
-
|
|
37
|
-
|
|
38
|
+
if (theta <= -Math.PI) {
|
|
39
|
+
theta += 2 * Math.PI;
|
|
40
|
+
}
|
|
41
|
+
if (theta > Math.PI) {
|
|
42
|
+
theta -= 2 * Math.PI;
|
|
43
|
+
}
|
|
44
|
+
const thetaUse = theta + (scaleY < 0 ? Math.PI : 0);
|
|
45
|
+
matrix.c = -targetAbs * Math.sin(thetaUse);
|
|
46
|
+
matrix.d = targetAbs * Math.cos(thetaUse);
|
|
38
47
|
}
|
|
39
48
|
display_object.$scaleY = scaleY;
|
|
49
|
+
display_object.$rotation = null;
|
|
40
50
|
displayObjectApplyChangesService(display_object);
|
|
41
51
|
};
|