Better HN
topnewbestaskshowjobs
Log inSign up

yqnn

2 karma · joined Nov 13, 2020 (6y ago) · 2 submissions

Submissions

comment 6y ago · link · parent

Using TouchEvents, and a bit of basic geometry.

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

comment 6y ago · link · parent

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 :)