Skip to content

Commit a7d6372

Browse files
committed
cleanup
1 parent d7b6a2d commit a7d6372

29 files changed

+77
-70
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,14 @@ A modern set of Typescript tools for manipulating the `d` (description) attribut
1616

1717

1818
While you may find familiar tools inside, this library brings ***new additions***:
19-
* the build in `getBBox`, `getPointAtLength` and `getTotalLength` are more reliable and much more accurate than the native methods, not to mention their world class performance ratings;
19+
* the build in `getBBox`, `getPointAtLength` and `getTotalLength` are more reliable and much more accurate than the native methods, not to mention their high [performance](https://github.com/thednp/svg-path-commander/issues/44) ratings;
2020
* thanks to the community contributions we've implemented useful tools like `getPropertiesAtLength`, `getSegmentOfPoint` or `isPointInStroke`;
2121
* a tool that can *reverse path draw direction* without altering path commands, even with specific shorthand path commands;
2222
* a unique tool that can *reverse path draw direction* for path strings with only 'C' path commands;
2323
* a new and unique tool to *apply transform functions to path commands* via the modern *DOMMatrix* API.
2424

2525
**The key differences with other libraries**:
26-
* Typescript sourced with modernized codebase and build tools; all inherited codebase has been modernized as well;
26+
* Typescript sourced with modernized codebase, all inherited codebase has been modernized as well;
2727
* along with the modern codebase, the library also comes with strong TypeScript definitions;
2828
* this library can create 3D to 2D projections, making your SVGs look like 3D but in the SVG coordinate system;
2929
* you can use this library in both web apps and Node.js, you are not restricted to a single environment;

dist/svg-path-commander.cjs

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

dist/svg-path-commander.cjs.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/svg-path-commander.d.ts

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -364,6 +364,10 @@ export type Point = {
364364
x: number;
365365
y: number;
366366
};
367+
export type PointTuple = [
368+
number,
369+
number
370+
];
367371
/**
368372
* Creates a new SVGPathCommander instance with the following properties:
369373
* * segments: `pathArray`
@@ -407,14 +411,8 @@ declare class SVGPathCommander {
407411
x: number;
408412
y: number;
409413
}) => PointProperties;
410-
static polygonLength: (polygon: [
411-
number,
412-
number
413-
][]) => number;
414-
static polygonArea: (polygon: [
415-
number,
416-
number
417-
][]) => number;
414+
static polygonLength: (polygon: PointTuple[]) => number;
415+
static polygonArea: (polygon: PointTuple[]) => number;
418416
static getClosestPoint: (pathInput: string | PathArray, point: {
419417
x: number;
420418
y: number;

dist/svg-path-commander.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/svg-path-commander.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/svg-path-commander.mjs

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -983,21 +983,21 @@ e.every(([t]) => t === t.toUpperCase()), H = (e) => {
983983
cy: 0,
984984
cz: 0
985985
};
986-
const t = yt(e), {
987-
min: { x: n, y: s },
988-
max: { x: r, y: i }
989-
} = t.bbox, o = r - n, c = i - s;
986+
const {
987+
min: { x: t, y: n },
988+
max: { x: s, y: r }
989+
} = yt(e).bbox, i = s - t, o = r - n;
990990
return {
991-
width: o,
992-
height: c,
993-
x: n,
994-
y: s,
995-
x2: r,
996-
y2: i,
997-
cx: n + o / 2,
998-
cy: s + c / 2,
991+
width: i,
992+
height: o,
993+
x: t,
994+
y: n,
995+
x2: s,
996+
y2: r,
997+
cx: t + i / 2,
998+
cy: n + o / 2,
999999
// an estimted guess
1000-
cz: Math.max(o, c) + Math.min(o, c) / 2
1000+
cz: Math.max(i, o) + Math.min(i, o) / 2
10011001
};
10021002
}, vt = (e, t, n) => {
10031003
if (e[n].length > 7) {

dist/svg-path-commander.mjs.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/svg-path-commander.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/svg-path-commander.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)