0
0
Fork 0
mirror of https://github.com/liabru/matter-js.git synced 2025-03-14 00:38:41 -04:00
This commit is contained in:
Anirudh Sharma 2024-07-06 22:39:08 +02:00 committed by GitHub
commit 36ed31cf84
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 9 additions and 3 deletions

View file

@ -82,7 +82,8 @@ var Axes = require('../geometry/Axes');
xScale: 1,
yScale: 1,
xOffset: 0,
yOffset: 0
yOffset: 0,
lockRotation: false
}
},
events: null,

View file

@ -789,7 +789,9 @@ var Mouse = require('../core/Mouse');
texture = _getTexture(render, sprite.texture);
c.translate(part.position.x, part.position.y);
c.rotate(part.angle);
// rotate sprite if not lockRotation
if(!part.render.sprite.lockRotation)
c.rotate(part.angle);
c.drawImage(
texture,
@ -800,7 +802,10 @@ var Mouse = require('../core/Mouse');
);
// revert translation, hopefully faster than save / restore
c.rotate(-part.angle);
// rotate sprite if not lockRotation
if(!part.render.sprite.lockRotation)
c.rotate(-part.angle);
c.translate(-part.position.x, -part.position.y);
} else {
// part polygon