Skip to content

Commit 0703f3b

Browse files
committed
Merge pull request #2269 from kiwigrc/5926
Fixed #5926: Applying canvas scaling to particles in html5 canvas rendering mode
2 parents d868342 + d6a5d24 commit 0703f3b

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

cocos2d/particle/CCParticleSystem.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2414,6 +2414,8 @@ cc.ParticleSystem = cc.Node.extend(/** @lends cc.ParticleSystem# */{
24142414
context.globalCompositeOperation = 'source-over';
24152415

24162416
var element = this._texture.getHtmlElementObj();
2417+
var locScaleX = cc.view.getScaleX(), locScaleY = cc.view.getScaleY();
2418+
24172419
for (var i = 0; i < this.particleCount; i++) {
24182420
var particle = this._particles[i];
24192421
var lpx = (0 | (particle.size * 0.5));
@@ -2432,8 +2434,8 @@ cc.ParticleSystem = cc.Node.extend(/** @lends cc.ParticleSystem# */{
24322434
var h = this._pointRect.height;
24332435

24342436
context.scale(
2435-
Math.max((1 / w) * size, 0.000001),
2436-
Math.max((1 / h) * size, 0.000001)
2437+
Math.max(size * locScaleX / w, 0.000001),
2438+
Math.max(size * locScaleY / h, 0.000001)
24372439
);
24382440

24392441
if (particle.rotation)

0 commit comments

Comments
 (0)