Skip to content

Feature Request: Allow to provide path data as array of segments #170

Open

Description

@aleksey-shmatov

Currently path method accepts data as a string. In the internals it is being parse twice once in pointsOnPath and another time in svgPath. In my case I want to do some preprocessing to the path data before applying roughness. Currently I am basically forced to:

  1. Parse string to segments.
  2. Apply my own transformations to path data.
  3. Convert transformed data back to string.
  4. This string will be parsed twice inside RoughJS library.

Activity

  1. pshihn commented on May 9, 2021

    @pshihn
    Collaborator

    Sorry for the late response. But if you are still interested in this, can you give a bit more details and context. Maybe some example of what you are trying to achieve? thanks!

  2. aleksey-shmatov commented on May 10, 2021

    @aleksey-shmatov
    Author

    I want to implement real-time resizing of the shapes. I can't just use scaling because the way RoughJS works is based on the absolute distance values. So for example if you apply roughness to 10px line and then scale it 10x result will not be same as applying roughness to the 100px line. In second case there would be more "roughness" and result looks more natural. So what I am doing is adjusting shape/path data according to a new size and then pass down adjusted data to the RoughJS library. The problem is that RoughJS accepts only a string. This basically results in 3 path data parsing operations. One is my own because I need to adjust data to a new size and another two inside RoughJS(not sure why it happens twice pretty sure this can be optimised to single one). All these additional parsing slows down things quite a bit and for more complex shapes I am seeing performance issues during resize.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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