Skip to content

Commit 4bd9121

Browse files
authored
fixes rotation / scale calculation + cleanup rotation test (#626)
2 parents dc91494 + 641bb6e commit 4bd9121

File tree

2 files changed

+2
-5
lines changed

2 files changed

+2
-5
lines changed

examples/tests/rotation.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,6 @@ export default async function ({ renderer, testRoot }: ExampleSettings) {
4242
colorBottom: randomColor(),
4343
colorTop: randomColor(),
4444
parent: testRoot,
45-
shader: renderer.createShader('RoundedRectangle', {
46-
radius: rnd(10, 50),
47-
}),
4845
scale: 1,
4946
pivot,
5047
});

src/core/CoreNode.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -983,6 +983,7 @@ export class CoreNode extends EventEmitter {
983983
const mountTranslateY = p.mountY * h;
984984

985985
if (p.rotation !== 0 || p.scaleX !== 1 || p.scaleY !== 1) {
986+
const scaleRotate = Matrix3d.rotate(p.rotation).scale(p.scaleX, p.scaleY);
986987
const pivotTranslateX = p.pivotX * w;
987988
const pivotTranslateY = p.pivotY * h;
988989

@@ -991,8 +992,7 @@ export class CoreNode extends EventEmitter {
991992
y - mountTranslateY + pivotTranslateY,
992993
this.localTransform,
993994
)
994-
.rotate(p.rotation)
995-
.scale(p.scaleX, p.scaleY)
995+
.multiply(scaleRotate)
996996
.translate(-pivotTranslateX, -pivotTranslateY);
997997
} else {
998998
this.localTransform = Matrix3d.translate(

0 commit comments

Comments
 (0)