You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Graphics.clear() only clears paths that have already been drawn; if you were in the middle of defining a path, that active path is not reset by clear().
Expected Behavior
The active path should be cleared by Graphics.clear().
Steps to Reproduce
(async()=>{// Initialize an appconstapp=newPIXI.Application();awaitapp.init({backgroundColor: 0x222222,resizeTo: window});document.body.appendChild(app.canvas);// Create a graphics objectletgraphic=newPIXI.Graphics();app.stage.addChild(graphic);// Start drawing a path, but don't finish itgraphic.moveTo(100,100).lineTo(200,200);// Clear!graphic.clear();// Draw something else// Note that the previous unfinished path wasn't cleared and still gets drawngraphic.circle(150,150,50).stroke({color: 0xffffff,width: 1});})();
Soultion: In GraphicsCOntext.clear(), call this._activePath.clear();.
Workaround: don't clear() when the Graphics object has an active path.
Additional Information
I stumbled upon this issue when I erroneously put stroke()/fill() calls before shape-drawing calls - I am sure I am not the only one who did this after migrating to v8. clear() not clearing active paths made debugging my mistake more confusing.
The text was updated successfully, but these errors were encountered:
Current Behavior
Graphics.clear()
only clears paths that have already been drawn; if you were in the middle of defining a path, that active path is not reset byclear()
.Expected Behavior
The active path should be cleared by
Graphics.clear()
.Steps to Reproduce
Live example: https://pixiplayground.com/#/edit/cqyRtXSXO93cxK33CHSIK
Environment
pixi.js
version: 8.1.3Possible Solution
Soultion: In
GraphicsCOntext.clear()
, callthis._activePath.clear();
.Workaround: don't
clear()
when theGraphics
object has an active path.Additional Information
I stumbled upon this issue when I erroneously put
stroke()
/fill()
calls before shape-drawing calls - I am sure I am not the only one who did this after migrating to v8.clear()
not clearing active paths made debugging my mistake more confusing.The text was updated successfully, but these errors were encountered: