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:
Yao 2024-07-11 16:16:55 +08:00 committed by GitHub
commit e4a2aae1ea
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -791,6 +791,9 @@ var Mouse = require('../core/Mouse');
c.translate(part.position.x, part.position.y);
c.rotate(part.angle);
// support img style filter
if (texture.style && texture.style.filter)
context.filter = texture.style.filter;
c.drawImage(
texture,
texture.width * -sprite.xOffset * sprite.xScale,
@ -798,6 +801,10 @@ var Mouse = require('../core/Mouse');
texture.width * sprite.xScale,
texture.height * sprite.yScale
);
// should reset context.filter after draw
if (texture.style && texture.style.filter)
context.filter = "none";
// revert translation, hopefully faster than save / restore
c.rotate(-part.angle);