pixi-dashed-line icon indicating copy to clipboard operation
pixi-dashed-line copied to clipboard

There seems to be no way to set the fill color

Open 9a-aaaaaaaa opened this issue 2 years ago • 6 comments

9a-aaaaaaaa avatar Apr 01 '22 03:04 9a-aaaaaaaa

The fill color of the dashed lines or shape?

davidfig avatar Apr 01 '22 13:04 davidfig

I'm very glad to see your answer. What I want to ask is how to fill the image surrounded by dotted lines, such as the color of triangles. Compare and make a dotted border of a triangle. I found that the effect of join = round is not perfect in the broken line display of triangles.

9a-aaaaaaaa avatar Apr 01 '22 14:04 9a-aaaaaaaa

It's not a perfect implementation. What I usually do is draw the shape two times: first for the fill, and second with the dashed line.

davidfig avatar Apr 01 '22 15:04 davidfig

Drawing separately is a good idea. Can I ask for advice? If the triangle needs to draw rounded corners, do you have any good suggestions?

9a-aaaaaaaa avatar Apr 02 '22 06:04 9a-aaaaaaaa

There's a pixi library with another dashed line implementation that may support it. Regrettably, I searched and couldn't find it again. It's a general pixi.js extension that happens to support dashed lines. Hope you can find it!

Otherwise, you can use the PIXI.Graphics code to see how they implement curved lines, and then use similar implementation. The actual dashed line (non-texture) code is relatively simple. Adding the rounded join points should be only moderately difficult. Good luck!

davidfig avatar Apr 02 '22 12:04 davidfig

Thanks for your advice and good luck

9a-aaaaaaaa avatar Apr 11 '22 08:04 9a-aaaaaaaa