Pinned replies
Avatar
Freya Holmér
  • Answer
  • Planned

dashed polylines are one of those features that feel obvious and essential, but, in practice, implementing dashed polylines has a few implications that are difficult to deal with


  • technically, it's a tradeoff between quality and performance here
    • naively implementing this for polylines means using the current geometry and just passing in distance data, will actually make skew dashes, especially near sharp turns
    • a quick and dirty fix is to add additional vertices to the mesh, but I want to avoid this since I want Shapes to be very light on the CPU
    • I might end up having to do the quick an dirty one in the end, but, I got a cursed idea a few days ago that might work out that I need to experiment with~


    • design-wise, some questions now arise, because dash size is currently relative to the thickness of the line
      • If you change thickness across the line, it's a little ambiguous how this should be handled
      • I could ignore it, and let dash length change relative to changing thickness, but I think this is somewhat nontrivial and also just not very practically useful
      • The other option is to change dash size to no longer be relative to thickness, but,
        • this is a breaking change (but might be worth it), and having relative dash sizes is still useful for lines that don't change width
        • a non-breaking way of doing this, is to make it an option, but, options require a lot of design too, especially for the component side of the library


    anyway sorry for thought dump!

    tldr: it's more complicated than one might think, but it's something people expect to have, so I'll have to solve it somehow! I just want to make sure I do it the right way

    Avatar
    Freya Holmér
    • Answer
    • Planned

    dashed polylines are one of those features that feel obvious and essential, but, in practice, implementing dashed polylines has a few implications that are difficult to deal with


    • technically, it's a tradeoff between quality and performance here
      • naively implementing this for polylines means using the current geometry and just passing in distance data, will actually make skew dashes, especially near sharp turns
      • a quick and dirty fix is to add additional vertices to the mesh, but I want to avoid this since I want Shapes to be very light on the CPU
      • I might end up having to do the quick an dirty one in the end, but, I got a cursed idea a few days ago that might work out that I need to experiment with~


      • design-wise, some questions now arise, because dash size is currently relative to the thickness of the line
        • If you change thickness across the line, it's a little ambiguous how this should be handled
        • I could ignore it, and let dash length change relative to changing thickness, but I think this is somewhat nontrivial and also just not very practically useful
        • The other option is to change dash size to no longer be relative to thickness, but,
          • this is a breaking change (but might be worth it), and having relative dash sizes is still useful for lines that don't change width
          • a non-breaking way of doing this, is to make it an option, but, options require a lot of design too, especially for the component side of the library


      anyway sorry for thought dump!

      tldr: it's more complicated than one might think, but it's something people expect to have, so I'll have to solve it somehow! I just want to make sure I do it the right way

      Avatar
      Ernest Szoka

      I too second dashed polylines, I would rather have a compromised/limited version than none at all.  I've been contemplating linking multiple dashed lines to do the effect but I know it won't be as good as something native to shapes.   Really appreciate the the whole toolset and I think this would really be a great addition.