Skip to content

Resizing and moving SVGs with paths #77

@zrisha

Description

@zrisha

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.

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