Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Phaser.GameObject.Polygon ignores closePath with Phaser.CANVAS #5983

Closed
optimumsuave opened this issue Jan 26, 2022 · 1 comment
Closed

Phaser.GameObject.Polygon ignores closePath with Phaser.CANVAS #5983

optimumsuave opened this issue Jan 26, 2022 · 1 comment

Comments

@optimumsuave
Copy link
Contributor

optimumsuave commented Jan 26, 2022

Version

  • Phaser Version: 3.55.2

Description

Phaser.GameObjects.Polygon ignores the closePath boolean when GameConfig.type === Phaser.CANVAS

Screen Shot 2022-01-26 at 1 50 08 PM

Example Test Code

https://codepen.io/optimumsuave/pen/abVzweR

Additional Information

I have forked the repo and will be opening a PR.

Problem

PolygonCanvasRenderer always calls closePath() - does not check for src.closePath boolean.
https://github.com/photonstorm/phaser/blob/master/src/gameobjects/shape/polygon/PolygonCanvasRenderer.js#L59

ctx.closePath();

Solution

StrokePathWebGL (called from PolygonWebGLRenderer when type === Phaser.WEBGL) checks for closePath (here)
A solution which can be found in ArcCanvasRenderer & CurveCanvasRenderer wraps closePath() with a check:

if(src.closePath) {
  ctx.closePath();
}
@photonstorm
Copy link
Collaborator

Thanks for opening this issue, and for submitting a PR to fix it. We have merged your PR into the master branch and attributed the work to you in the Change Log. If you need to tweak the code for whatever reason please submit a new PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants