Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resizing and moving SVGs with paths #77

Open
zrisha opened this issue Feb 20, 2023 · 0 comments
Open

Resizing and moving SVGs with paths #77

zrisha opened this issue Feb 20, 2023 · 0 comments

Comments

@zrisha
Copy link

zrisha commented Feb 20, 2023

Great tool, quite the hidden gem! I noticed when using the Stamp tool with SVGs that have a path element, the graphic becomes distorted after moving it or resizing it. From what I could tell, this seems to be from the following function in rescale-2-resize.js. There seemed to be null values inserted into the path data after the function ran.

  path: function (s) {
    var offsetX = s.pathOffset.x;
    var offsetY = s.pathOffset.y;
    for (var i = 0; i < s.path.length; i++) {
      s.path[i][1] = (s.path[i][1] - offsetX) * s.scaleX + offsetX;
      s.path[i][2] = (s.path[i][2] - offsetY) * s.scaleY + offsetY;
      s.path[i][3] = (s.path[i][3] - offsetX) * s.scaleX + offsetX;
      s.path[i][4] = (s.path[i][4] - offsetY) * s.scaleY + offsetY;
    }
    basicWidthHeightTransform(s);
  }

I commented the function out and resizing and moving of paths seemed to work just fine. I was not able to discover any ramifications from doing so, but I also don't understand the original purpose of the function.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant