svg-path-commander 2.2.3 → 2.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +19 -0
- package/README.md +2 -2
- package/dist/index.d.ts +224 -7
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +106 -6
- package/dist/index.js.map +1 -1
- package/dist/index.min.js +2 -2
- package/dist/index.min.js.map +1 -1
- package/dist/util.d.ts +72 -3
- package/dist/util.d.ts.map +1 -1
- package/dist/util.js +2 -2
- package/dist/util.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":[],"sources":["../src/interface.ts","../src/types.ts","../src/math/distanceSquareRoot.ts","../src/math/midPoint.ts","../src/math/rotateVector.ts","../src/math/roundTo.ts","../src/convert/pathToAbsolute.ts","../src/convert/pathToRelative.ts","../src/convert/pathToCurve.ts","../src/convert/pathToString.ts","../src/parser/parsePathString.ts","../src/parser/pathParser.ts","../src/parser/finalizeSegment.ts","../src/parser/isArcCommand.ts","../src/parser/isDigit.ts","../src/parser/isDigitStart.ts","../src/parser/isMoveCommand.ts","../src/parser/isPathCommand.ts","../src/parser/isSpace.ts","../src/parser/scanFlag.ts","../src/parser/scanParam.ts","../src/parser/scanSegment.ts","../src/parser/skipSpaces.ts","../src/util/getPathBBox.ts","../src/util/getTotalLength.ts","../src/util/getClosestPoint.ts","../src/util/getDrawDirection.ts","../src/util/getPathArea.ts","../src/util/getPointAtLength.ts","../src/util/getPropertiesAtLength.ts","../src/util/getPropertiesAtPoint.ts","../src/util/getSegmentAtLength.ts","../src/util/getSegmentOfPoint.ts","../src/util/isAbsoluteArray.ts","../src/util/isPolygonArray.ts","../src/util/isCurveArray.ts","../src/util/isNormalizedArray.ts","../src/util/isPathArray.ts","../src/util/isPointInStroke.ts","../src/util/isRelativeArray.ts","../src/util/isValidPath.ts","../src/morph/samplePolygon.ts","../src/util/shapeToPath.ts","../src/util/shapeToPathArray.ts","../src/util/isMultiPath.ts","../src/util/isPolylineArray.ts","../src/util/isClosedPath.ts","../src/process/normalizePath.ts","../src/process/optimizePath.ts","../src/process/reversePath.ts","../src/process/splitPath.ts","../src/process/transformPath.ts","../src/process/absolutizeSegment.ts","../src/process/arcToCubic.ts","../src/process/getSVGMatrix.ts","../src/process/iterate.ts","../src/process/lineToCubic.ts","../src/process/normalizeSegment.ts","../src/process/projection2d.ts","../src/process/quadToCubic.ts","../src/process/relativizeSegment.ts","../src/process/reverseCurve.ts","../src/process/roundPath.ts","../src/process/roundSegment.ts","../src/process/segmentToCubic.ts","../src/process/shortenSegment.ts","../src/morph/fixPath.ts","../src/morph/splitCubicSegment.ts","../src/morph/equalizeSegments.ts","../src/morph/equalizePaths.ts","../src/intersect/pathIntersection.ts","../src/intersect/boundingBoxIntersect.ts","../src/intersect/isPointInsideBBox.ts","../src/main.ts"],"mappings":";;;;;;;;KAGY
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../src/interface.ts","../src/types.ts","../src/math/distanceSquareRoot.ts","../src/math/midPoint.ts","../src/math/rotateVector.ts","../src/math/roundTo.ts","../src/convert/pathToAbsolute.ts","../src/convert/pathToRelative.ts","../src/convert/pathToCurve.ts","../src/convert/pathToString.ts","../src/parser/parsePathString.ts","../src/parser/pathParser.ts","../src/parser/finalizeSegment.ts","../src/parser/isArcCommand.ts","../src/parser/isDigit.ts","../src/parser/isDigitStart.ts","../src/parser/isMoveCommand.ts","../src/parser/isPathCommand.ts","../src/parser/isSpace.ts","../src/parser/scanFlag.ts","../src/parser/scanParam.ts","../src/parser/scanSegment.ts","../src/parser/skipSpaces.ts","../src/util/getPathBBox.ts","../src/util/getTotalLength.ts","../src/util/getClosestPoint.ts","../src/util/getDrawDirection.ts","../src/util/getPathArea.ts","../src/util/getPointAtLength.ts","../src/util/getPropertiesAtLength.ts","../src/util/getPropertiesAtPoint.ts","../src/util/getSegmentAtLength.ts","../src/util/getSegmentOfPoint.ts","../src/util/isAbsoluteArray.ts","../src/util/isPolygonArray.ts","../src/util/isCurveArray.ts","../src/util/isNormalizedArray.ts","../src/util/isPathArray.ts","../src/util/isPointInStroke.ts","../src/util/isRelativeArray.ts","../src/util/isValidPath.ts","../src/morph/samplePolygon.ts","../src/util/shapeToPath.ts","../src/util/shapeToPathArray.ts","../src/util/isMultiPath.ts","../src/util/isPolylineArray.ts","../src/util/isClosedPath.ts","../src/process/normalizePath.ts","../src/process/optimizePath.ts","../src/process/reversePath.ts","../src/process/splitPath.ts","../src/process/transformPath.ts","../src/process/absolutizeSegment.ts","../src/process/arcToCubic.ts","../src/process/getSVGMatrix.ts","../src/process/iterate.ts","../src/process/lineToCubic.ts","../src/process/normalizeSegment.ts","../src/process/projection2d.ts","../src/process/quadToCubic.ts","../src/process/relativizeSegment.ts","../src/process/reverseCurve.ts","../src/process/roundPath.ts","../src/process/roundSegment.ts","../src/process/segmentToCubic.ts","../src/process/shortenSegment.ts","../src/morph/fixPath.ts","../src/morph/splitCubicSegment.ts","../src/morph/equalizeSegments.ts","../src/morph/equalizePaths.ts","../src/intersect/pathIntersection.ts","../src/intersect/boundingBoxIntersect.ts","../src/intersect/isPointInsideBBox.ts","../src/main.ts"],"mappings":";;;;;;;;KAGY;;EAEV,SAAS;;EAET;;EAEA;;EAEA;;;KAIU;;EAEV;;IAEE;;IAEA;;;EAGF;;EAEA,UAAU;;;KAIA;;EAEV;;EAEA;;EAEA;;EAEA;;EAEA;GACC;;;KAGS;;EAEV;;EAEA;GACC;;;KAGS;;EAEV;;EAEA;;EAEA;;EAEA;GACC;;;KAGS;;EAEV;;EAEA;;EAEA;;EAEA;;EAEA;GACC;;;KAGS;;EAEV;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA;GACC;;;KAGS;;EAEV;;EAEA;GACC;;;KAIS;;EAEV;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA;;EAEA;;;KAIU;;EAEV;;E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SAEhB,oBAAW;;SAEX,oBAAW;;SAEX,yBAAgB;;SAEhB,8BAAqB;;SAErB,6BAAoB;;SAEpB,2BAAkB;;SAElB,0BAAiB;;SAEjB,uBAAc;;SAGd,wBAAe;;SAEf,qBAAY;;SAEZ,uBAAc;;SAEd,0BAAiB;;SAEjB,oBAAW;;SAEX,wBAAe;;SAEf,wBAAe;;SAEf,oBAAW;;SAGX,sBAAa;;SAEb,aAFa;;SAIb,oBAAW;;SAEX,yBAAgB;;SAGhB,0BAAiB;;SAEjB,mBAAU;;SAEV,qBAAY;;SAEZ,gBAAO;;SAEP,oBAAW;;SAEX,sBAAa;;SAEb,yBAAgB;;SAEhB,qBAAY;;SAEZ,qBAAY;;SAEZ,oBAAW;;SAEX,0BAAiB;;SAEjB,qBAAY;;SAEZ,oBAAW;;SAEX,kBAAS;;SAET,qBAAY;;SAEZ,uBAAc;;SAEd,uBAAc;;SAEd,kBAAS;;SAET,sBAAa;;SAEb,yBAAgB;;SAEhB,0BAAiB;;SAEjB,sBAAa;;SAEb,0BAAiB;;SAEjB,0BAAiB;;SAEjB,6BAAoB;;SAEpB,oBAAW;;SAEX,qBAAY;;SAEZ,wBAAe;;SAEf"}
|
package/dist/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* SVGPathCommander v2.2.
|
|
2
|
+
* SVGPathCommander v2.2.4 (http://thednp.github.io/svg-path-commander)
|
|
3
3
|
* Copyright 2026 © thednp
|
|
4
4
|
* Licensed under MIT (https://github.com/thednp/svg-path-commander/blob/master/LICENSE)
|
|
5
5
|
*/
|
|
6
6
|
import CSSMatrix from "@thednp/dommatrix";
|
|
7
7
|
//#region package.json
|
|
8
|
-
var version = "2.2.
|
|
8
|
+
var version = "2.2.4";
|
|
9
9
|
//#endregion
|
|
10
10
|
//#region src/math/midPoint.ts
|
|
11
11
|
/**
|
|
@@ -4311,7 +4311,7 @@ const interHelper = (bez1, bez2, config) => {
|
|
|
4311
4311
|
* pathsIntersection('M0 50C0 0,100 0,100 50', 'M50 0C100 0,100 100,50 100', true)
|
|
4312
4312
|
* // => 1
|
|
4313
4313
|
* pathsIntersection('M0 50C0 0,100 0,100 50', 'M50 0C100 0,100 100,50 100', false)
|
|
4314
|
-
* // => [{ x:
|
|
4314
|
+
* // => [{ x: 80.4136, y: 19.5864, t1: 0.7262, t2: 0.2738 }]
|
|
4315
4315
|
* ```
|
|
4316
4316
|
*/
|
|
4317
4317
|
const pathsIntersection = (pathInput1, pathInput2, justCount = true) => {
|
|
@@ -4443,9 +4443,21 @@ var SVGPathCommander = class {
|
|
|
4443
4443
|
this.origin = origin;
|
|
4444
4444
|
return this;
|
|
4445
4445
|
}
|
|
4446
|
+
/**
|
|
4447
|
+
* Returns the path bounding box, equivalent to native `path.getBBox()`.
|
|
4448
|
+
*
|
|
4449
|
+
* @public
|
|
4450
|
+
* @returns the pathBBox
|
|
4451
|
+
*/
|
|
4446
4452
|
get bbox() {
|
|
4447
4453
|
return getPathBBox(this.segments);
|
|
4448
4454
|
}
|
|
4455
|
+
/**
|
|
4456
|
+
* Returns the total path length, equivalent to native `path.getTotalLength()`.
|
|
4457
|
+
*
|
|
4458
|
+
* @public
|
|
4459
|
+
* @returns the path total length
|
|
4460
|
+
*/
|
|
4449
4461
|
get length() {
|
|
4450
4462
|
return getTotalLength(this.segments);
|
|
4451
4463
|
}
|
|
@@ -4536,7 +4548,7 @@ var SVGPathCommander = class {
|
|
|
4536
4548
|
* @example
|
|
4537
4549
|
* ```ts
|
|
4538
4550
|
* new SVGPathCommander('M0 0L100 0L100 100L0 100Z').reverse().toString()
|
|
4539
|
-
* // => 'M0
|
|
4551
|
+
* // => 'M0 100L100 100L100 0L0 0Z'
|
|
4540
4552
|
* ```
|
|
4541
4553
|
*
|
|
4542
4554
|
* @param onlySubpath - option to reverse all sub-paths except first
|
|
@@ -4585,7 +4597,7 @@ var SVGPathCommander = class {
|
|
|
4585
4597
|
* @example
|
|
4586
4598
|
* ```ts
|
|
4587
4599
|
* new SVGPathCommander('M10 10L10 10L90 90').optimize().toString()
|
|
4588
|
-
* // => 'M10
|
|
4600
|
+
* // => 'M10 10v0l80 80'
|
|
4589
4601
|
* ```
|
|
4590
4602
|
*
|
|
4591
4603
|
* @returns this for chaining
|
|
@@ -4709,96 +4721,184 @@ var SVGPathCommander = class {
|
|
|
4709
4721
|
dispose() {
|
|
4710
4722
|
Object.keys(this).forEach((key) => delete this[key]);
|
|
4711
4723
|
}
|
|
4724
|
+
/** The default instance options. */
|
|
4712
4725
|
static options = defaultOptions;
|
|
4726
|
+
/**
|
|
4727
|
+
* The DOMMatrix shim used for transformations.
|
|
4728
|
+
* @see https://github.com/thednp/dommatrix
|
|
4729
|
+
*/
|
|
4713
4730
|
static CSSMatrix = CSSMatrix;
|
|
4731
|
+
/** The tools for elliptical arc computation. */
|
|
4714
4732
|
static arcTools = arcTools;
|
|
4733
|
+
/** The tools for Bezier curve computation. */
|
|
4715
4734
|
static bezierTools = bezierTools;
|
|
4735
|
+
/** The tools for cubic Bezier computation. */
|
|
4716
4736
|
static cubicTools = cubicTools;
|
|
4737
|
+
/** The tools for line segment computation. */
|
|
4717
4738
|
static lineTools = lineTools;
|
|
4739
|
+
/** The tools for polygon computation. */
|
|
4718
4740
|
static polygonTools = polygonTools;
|
|
4741
|
+
/** The tools for quadratic Bezier computation. */
|
|
4719
4742
|
static quadTools = quadTools;
|
|
4743
|
+
/** Parses a path string value or object and returns an array */
|
|
4720
4744
|
static pathToAbsolute = pathToAbsolute;
|
|
4745
|
+
/** Parses a path string value or object and returns an array */
|
|
4721
4746
|
static pathToRelative = pathToRelative;
|
|
4747
|
+
/** Parses a path string or PathArray and returns a new one */
|
|
4722
4748
|
static pathToCurve = pathToCurve;
|
|
4749
|
+
/** Returns a valid `d` attribute string value created */
|
|
4723
4750
|
static pathToString = pathToString;
|
|
4751
|
+
/** Returns the square root of the distance */
|
|
4724
4752
|
static distanceSquareRoot = distanceSquareRoot;
|
|
4753
|
+
/** Returns the coordinates of a specified distance */
|
|
4725
4754
|
static midPoint = midPoint;
|
|
4755
|
+
/** Returns an {x,y} vector rotated by a given */
|
|
4726
4756
|
static rotateVector = rotateVector;
|
|
4757
|
+
/** Rounds a number to the specified number of decimal places. */
|
|
4727
4758
|
static roundTo = roundTo;
|
|
4759
|
+
/** Parses a path string value and returns an array */
|
|
4728
4760
|
static parsePathString = parsePathString;
|
|
4761
|
+
/** Breaks the parsing of a pathString once a segment is finalized. */
|
|
4729
4762
|
static finalizeSegment = finalizeSegment;
|
|
4763
|
+
/** Error message prefix used when a path string cannot be parsed. */
|
|
4730
4764
|
static invalidPathValue = invalidPathValue;
|
|
4765
|
+
/** Checks if the character is an A (arc-to) path command. */
|
|
4731
4766
|
static isArcCommand = isArcCommand;
|
|
4767
|
+
/** Checks if a character is a digit. */
|
|
4732
4768
|
static isDigit = isDigit;
|
|
4769
|
+
/** Checks if the character is or belongs to a number. */
|
|
4733
4770
|
static isDigitStart = isDigitStart;
|
|
4771
|
+
/** Checks if the character is a MoveTo command. */
|
|
4734
4772
|
static isMoveCommand = isMoveCommand;
|
|
4773
|
+
/** Checks if the character is a path command. */
|
|
4735
4774
|
static isPathCommand = isPathCommand;
|
|
4775
|
+
/** Checks if the character is a space. */
|
|
4736
4776
|
static isSpace = isSpace;
|
|
4777
|
+
/** The number of parameters for each path command. */
|
|
4737
4778
|
static paramsCount = paramsCounts;
|
|
4779
|
+
/** Default parser parameters object used to track position state */
|
|
4738
4780
|
static paramsParser = paramsParser;
|
|
4781
|
+
/** The `PathParser` is used by the `parsePathString` static method */
|
|
4739
4782
|
static PathParser = PathParser;
|
|
4783
|
+
/** Validates an A (arc-to) specific path command value. */
|
|
4740
4784
|
static scanFlag = scanFlag;
|
|
4785
|
+
/** Validates every character of the path string, */
|
|
4741
4786
|
static scanParam = scanParam;
|
|
4787
|
+
/** Scans every character in the path string to determine */
|
|
4742
4788
|
static scanSegment = scanSegment;
|
|
4789
|
+
/** Points the parser to the next character in the */
|
|
4743
4790
|
static skipSpaces = skipSpaces;
|
|
4791
|
+
/** Small threshold value used for floating-point distance comparisons in path calculations. */
|
|
4744
4792
|
static distanceEpsilon = DISTANCE_EPSILON;
|
|
4793
|
+
/** Checks a `PathArray` for an unnecessary `Z` segment */
|
|
4745
4794
|
static fixPath = fixPath;
|
|
4795
|
+
/** Returns the point in path closest to a given point. */
|
|
4746
4796
|
static getClosestPoint = getClosestPoint;
|
|
4797
|
+
/** Check if a path is drawn clockwise and returns true if so, */
|
|
4747
4798
|
static getDrawDirection = getDrawDirection;
|
|
4799
|
+
/** Returns the area of a single cubic-bezier segment. */
|
|
4748
4800
|
static getPathArea = getPathArea;
|
|
4801
|
+
/** Calculates the bounding box of a path. */
|
|
4749
4802
|
static getPathBBox = getPathBBox;
|
|
4803
|
+
/** Returns [x,y] coordinates of a point at a given length along a path. */
|
|
4750
4804
|
static getPointAtLength = getPointAtLength;
|
|
4805
|
+
/** Returns the segment, its index and length as well as */
|
|
4751
4806
|
static getPropertiesAtLength = getPropertiesAtLength;
|
|
4807
|
+
/** Returns the point and segment in path closest to a given point as well as */
|
|
4752
4808
|
static getPropertiesAtPoint = getPropertiesAtPoint;
|
|
4809
|
+
/** Returns the segment at a given length. */
|
|
4753
4810
|
static getSegmentAtLength = getSegmentAtLength;
|
|
4811
|
+
/** Returns the path segment which contains a given point. */
|
|
4754
4812
|
static getSegmentOfPoint = getSegmentOfPoint;
|
|
4813
|
+
/** Returns the total length of a path, equivalent to `shape.getTotalLength()`. */
|
|
4755
4814
|
static getTotalLength = getTotalLength;
|
|
4815
|
+
/** Iterates an array to check if it's a `pathArray` */
|
|
4756
4816
|
static isAbsoluteArray = isAbsoluteArray;
|
|
4817
|
+
/** Iterates an array to check if it's a `pathArray` */
|
|
4757
4818
|
static isCurveArray = isCurveArray;
|
|
4819
|
+
/** Checks if a path is a polygon (only M, L, H, V, Z commands). */
|
|
4758
4820
|
static isPolygonArray = isPolygonArray;
|
|
4821
|
+
/** Iterates an array to check if it's a `pathArray` */
|
|
4759
4822
|
static isNormalizedArray = isNormalizedArray;
|
|
4823
|
+
/** Iterates an array to check if it's an actual `pathArray`. */
|
|
4760
4824
|
static isPathArray = isPathArray;
|
|
4825
|
+
/** Checks if a given point is in the stroke of a path. */
|
|
4761
4826
|
static isPointInStroke = isPointInStroke;
|
|
4827
|
+
/** Iterates an array to check if it's a `pathArray` */
|
|
4762
4828
|
static isRelativeArray = isRelativeArray;
|
|
4829
|
+
/** Parses a path string value to determine its validity */
|
|
4763
4830
|
static isValidPath = isValidPath;
|
|
4831
|
+
/** Samples points from a path to form a polygon approximation. */
|
|
4764
4832
|
static samplePolygon = samplePolygon;
|
|
4833
|
+
/** Supported shapes and their specific parameters. */
|
|
4765
4834
|
static shapeParams = shapeParams;
|
|
4835
|
+
/** Returns a new `<path>` element created from attributes of a `<line>`, `<polyline>`, */
|
|
4766
4836
|
static shapeToPath = shapeToPath;
|
|
4837
|
+
/** Returns a new PathArray from line attributes. */
|
|
4767
4838
|
static shapeToPathArray = shapeToPathArray;
|
|
4839
|
+
/** Returns an absolute segment of a `PathArray` object. */
|
|
4768
4840
|
static absolutizeSegment = absolutizeSegment;
|
|
4841
|
+
/** Converts A (arc-to) segments to C (cubic-bezier-to). */
|
|
4769
4842
|
static arcToCubic = arcToCubic;
|
|
4843
|
+
/** Returns a transformation matrix to apply to `<path>` elements. */
|
|
4770
4844
|
static getSVGMatrix = getSVGMatrix;
|
|
4845
|
+
/** Iterates over a `PathArray`, executing a callback for each segment. */
|
|
4771
4846
|
static iterate = iterate;
|
|
4847
|
+
/** Converts an L (line-to) segment to C (cubic-bezier). */
|
|
4772
4848
|
static lineToCubic = lineToCubic;
|
|
4849
|
+
/** Parses a path string or PathArray, then iterates the result for: */
|
|
4773
4850
|
static normalizePath = normalizePath;
|
|
4851
|
+
/** Normalizes a single segment of a `pathArray` object. */
|
|
4774
4852
|
static normalizeSegment = normalizeSegment;
|
|
4853
|
+
/** Optimizes a PathArray: */
|
|
4775
4854
|
static optimizePath = optimizePath;
|
|
4855
|
+
/** Transforms a specified point using a matrix, returning a new */
|
|
4776
4856
|
static projection2d = projection2d;
|
|
4857
|
+
/** Converts a Q (quadratic-bezier) segment to C (cubic-bezier). */
|
|
4777
4858
|
static quadToCubic = quadToCubic;
|
|
4859
|
+
/** Returns a relative segment of a `PathArray` object. */
|
|
4778
4860
|
static relativizeSegment = relativizeSegment;
|
|
4861
|
+
/** Reverses all segments of a `pathArray` */
|
|
4779
4862
|
static reverseCurve = reverseCurve;
|
|
4863
|
+
/** Reverses all segments of a PathArray and returns a new PathArray */
|
|
4780
4864
|
static reversePath = reversePath;
|
|
4865
|
+
/** Rounds the values of a `pathArray` instance to */
|
|
4781
4866
|
static roundPath = roundPath;
|
|
4867
|
+
/** Rounds the numeric values of a path segment to the specified precision. */
|
|
4782
4868
|
static roundSegment = roundSegment;
|
|
4869
|
+
/** Converts any segment to C (cubic-bezier). */
|
|
4783
4870
|
static segmentToCubic = segmentToCubic;
|
|
4871
|
+
/** Shorten a single segment of a `pathArray` object. */
|
|
4784
4872
|
static shortenSegment = shortenSegment;
|
|
4873
|
+
/** Split a path string or PathArray into an array of sub-paths. */
|
|
4785
4874
|
static splitPath = splitPath;
|
|
4875
|
+
/** Equalizes two paths for morphing (single/multi subpath). */
|
|
4786
4876
|
static equalizePaths = equalizePaths;
|
|
4877
|
+
/** Equalizes two paths for morphing (single subpath only). */
|
|
4787
4878
|
static equalizeSegments = equalizeSegments;
|
|
4879
|
+
/** Split a cubic Bézier into two cubics at parameter t [0–1]. */
|
|
4788
4880
|
static splitCubicSegment = splitCubicSegment;
|
|
4881
|
+
/** Apply a 2D / 3D transformation to a PathArray. */
|
|
4789
4882
|
static transformPath = transformPath;
|
|
4883
|
+
/** Checks if a point is inside a bounding box. */
|
|
4790
4884
|
static isPointInsideBBox = isPointInsideBBox;
|
|
4885
|
+
/** Finds intersection points between two paths. */
|
|
4791
4886
|
static pathsIntersection = pathsIntersection;
|
|
4887
|
+
/** Checks if two bounding boxes intersect. */
|
|
4792
4888
|
static boundingBoxIntersect = boundingBoxIntersect;
|
|
4889
|
+
/** Determines if an SVG path contains multiple subpaths. */
|
|
4793
4890
|
static isMultiPath = isMultiPath;
|
|
4891
|
+
/** Check if a PathArray is closed, which means its last segment is a Z. */
|
|
4794
4892
|
static isClosedPath = isClosedPath;
|
|
4893
|
+
/** Checks if a path is a polyline (only M, L, H, V commands). */
|
|
4795
4894
|
static isPolylineArray = isPolylineArray;
|
|
4895
|
+
/** The library version. */
|
|
4796
4896
|
static version = version;
|
|
4797
4897
|
};
|
|
4798
4898
|
//#endregion
|
|
4799
4899
|
//#region src/index.ts
|
|
4800
4900
|
var src_default = SVGPathCommander;
|
|
4801
4901
|
//#endregion
|
|
4802
|
-
export { src_default as default };
|
|
4902
|
+
export { SVGPathCommander, src_default as default };
|
|
4803
4903
|
|
|
4804
4904
|
//# sourceMappingURL=index.js.map
|