Skip to content

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

@optimumsuave

Description

@optimumsuave

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();
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions