Hacker Newsnew | past | comments | ask | show | jobs | submit | yqnn's commentslogin

Using TouchEvents, and a bit of basic geometry.

It's here: https://github.com/Yqnn/svg-path-editor/blob/master/src/app/...


You can copy 'svg.ts' and 'svg-parser.ts', from here: https://github.com/Yqnn/svg-path-editor/tree/master/src/app It's what's used internally by the tool.

  const path = new Svg('M 0 0 L 1 1');
  path.translate(1, 2);    // Translates (x:1pt , y:2pt)
  path.scale(2, 3);        // Scales (x:200%, y:300%)
  path.setRelative(true);  // Converts the path to use only relative commands 
  path.asString();         // Export the path with no minification
  path.asString(1, true);  // Export the path with 4 decimals, and minification

I wanted to publish them separately on npm, but didn't had time to do it :)


Very cool! Thanks!


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: