BUG Html5 LineStyle performing a LineTo to the origin

Hello,

I’m using haxe since a long time and decide to switch to openfl, i try to update my game and i just discover a bug with html5 (all works fine with flash).
I draw some lines on a sprite graphics but when i switch the lineStyle, it automatically add a “lineTo” to the origin.

Here’s the code:
private function fail()
{
var fail:Sprite = new Sprite();
addChild(fail);

	fail.graphics.lineStyle(1, 0x00ff00);
	fail.graphics.moveTo(100, 100);
	fail.graphics.lineTo(200, 100);
	fail.graphics.lineTo(200, 200);
	
	fail.graphics.lineStyle(2, 0xff0000);
}

And the result it’s the green line on the printscreen. i must have two lines, but here there’s 3, my 2 lines plus a line to the origin.

Anybody else have seen this ? Is there a workaround ?

Thanks

Hello! Looks like I had the same issue in html5. Try to add one more lineTo to back to previous point like this:

fail.graphics.lineStyle(1, 0x00ff00);
fail.graphics.moveTo(100, 100);
fail.graphics.lineTo(200, 100);
fail.graphics.lineTo(200, 200);
fail.graphics.lineTo(200, 100); //new line

fail.graphics.lineStyle(2, 0xff0000);

*or maybe moveTo to the origin (or previous) point

I can make multiple shapes, each with a line-style for a work-around.

I give up the html5 target =/, too many bugs for this platform.

I thought I saw this problem in the “DrawingShapes” sample, but tried again and I’m not seeing it. Perhaps the latest changes to the Graphics class today fixed it. I’ll keep my eyes out if this appears to occur again, thanks :slight_smile: