Socket
Socket
Sign inDemoInstall

svgpath

Package Overview
Dependencies
Maintainers
1
Versions
26
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

svgpath - npm Package Compare versions

Comparing version 2.2.1 to 2.2.2

7

CHANGELOG.md

@@ -0,1 +1,8 @@

2.2.2 / 2019-04-27
------------------
- Dev deps bump.
- Fix typescript definitions, #32.
2.2.1 / 2016-12-24

@@ -2,0 +9,0 @@ ------------------

4

index.d.ts

@@ -11,7 +11,7 @@ declare module "svgpath" {

skewY(degrees: number): SvgPath;
matrix(m1: number, m2: number, m3: number, m4: number, m5: number, m6: number): SvgPath;
matrix(m: number[]): SvgPath;
transform(str: string): SvgPath;
unshort(): SvgPath;
unarc(): SvgPath;
toString(): String;
toString(): string;
round(precision: number): SvgPath;

@@ -18,0 +18,0 @@ iterate(iterator: (segment: any[], index: number, x: number, y: number) => void, keepLazyStack?: boolean): SvgPath;

@@ -11,16 +11,19 @@ // Convert an arc to a sequence of cubic bézier curves

// Calculate an angle between two vectors
// Calculate an angle between two unit vectors
//
function vector_angle(ux, uy, vx, vy) {
// Since we measure angle between radii of circular arcs,
// we can use simplified math (without length normalization)
//
function unit_vector_angle(ux, uy, vx, vy) {
var sign = (ux * vy - uy * vx < 0) ? -1 : 1;
var umag = Math.sqrt(ux * ux + uy * uy);
var vmag = Math.sqrt(ux * ux + uy * uy);
var dot = ux * vx + uy * vy;
var div = dot / (umag * vmag);
// Add this to work with arbitrary vectors:
// dot /= Math.sqrt(ux * ux + uy * uy) * Math.sqrt(vx * vx + vy * vy);
// rounding errors, e.g. -1.0000000000000002 can screw up this
if (div > 1.0) { div = 1.0; }
if (div < -1.0) { div = -1.0; }
if (dot > 1.0) { dot = 1.0; }
if (dot < -1.0) { dot = -1.0; }
return sign * Math.acos(div);
return sign * Math.acos(dot);
}

@@ -84,4 +87,4 @@

var theta1 = vector_angle(1, 0, v1x, v1y);
var delta_theta = vector_angle(v1x, v1y, v2x, v2y);
var theta1 = unit_vector_angle(1, 0, v1x, v1y);
var delta_theta = unit_vector_angle(v1x, v1y, v2x, v2y);

@@ -88,0 +91,0 @@ if (fs === 0 && delta_theta > 0) {

@@ -72,2 +72,3 @@ 'use strict';

// the x - axis - rotation angle is the argument of the l1 - eigenvector
/*eslint-disable indent*/
this.ax = (Math.abs(L) < epsilon && Math.abs(l1 - K) < epsilon) ?

@@ -81,2 +82,3 @@ 90

) * 180 / Math.PI;
/*eslint-enable indent*/

@@ -83,0 +85,0 @@ // if ax > 0 => rx = sqrt(l1), ry = sqrt(l2), else exchange axes and ax += 90

@@ -182,10 +182,10 @@ // SVG Path transformations library

return elements.join(' ')
// Optimizations: remove spaces around commands & before `-`
//
// We could also remove leading zeros for `0.5`-like values,
// but their count is too small to spend time for.
.replace(/ ?([achlmqrstvz]) ?/gi, '$1')
.replace(/ \-/g, '-')
// workaround for FontForge SVG importing bug
.replace(/zm/g, 'z m');
// Optimizations: remove spaces around commands & before `-`
//
// We could also remove leading zeros for `0.5`-like values,
// but their count is too small to spend time for.
.replace(/ ?([achlmqrstvz]) ?/gi, '$1')
.replace(/ \-/g, '-')
// workaround for FontForge SVG importing bug
.replace(/zm/g, 'z m');
};

@@ -192,0 +192,0 @@

{
"name": "svgpath",
"version": "2.2.1",
"version": "2.2.2",
"description": "Low level toolkit for SVG paths transformations.",

@@ -30,7 +30,7 @@ "keywords": [

"benchmark": "^2.1.1",
"coveralls": "^2.11.2",
"eslint": "^3.5.0",
"coveralls": "^3.0.3",
"eslint": "^5.16.0",
"istanbul": "^0.4.5",
"mocha": "^3.0.2"
"mocha": "^6.1.4"
}
}

@@ -9,7 +9,8 @@ svgpath

> Low level toolkit for SVG paths transformations. Sometime you can't use
`transform` attributes and have to apply changes to svg paths directly.
> Low level toolkit for SVG paths transformations.
Sometimes you can't use `transform` attributes and have to apply changes to svg paths directly.
Then this package is for you :) !
Note, this package works with `paths`, not with svg xml sources.
Note: this package works with [path data](https://www.w3.org/TR/SVG11/paths.html#PathData) strings,
not with full svg xml sources.

@@ -16,0 +17,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc