@antv/util 3.3.1 → 3.3.2
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/dist/color/arr2rgb.d.ts +12 -0
- package/dist/color/gradient.d.ts +6 -0
- package/dist/color/index.d.ts +4 -0
- package/dist/color/rgb2arr.d.ts +6 -0
- package/dist/color/tocssgradient.d.ts +1 -0
- package/dist/color/torgb.d.ts +6 -0
- package/dist/helper/index.d.ts +2 -0
- package/dist/helper/mod.d.ts +1 -0
- package/dist/helper/to-radian.d.ts +1 -0
- package/dist/index.d.ts +5 -0
- package/dist/lodash/augment.d.ts +2 -0
- package/dist/lodash/cache.d.ts +14 -0
- package/dist/lodash/clamp.d.ts +2 -0
- package/dist/lodash/clear-animation-frame.d.ts +1 -0
- package/dist/lodash/clone.d.ts +2 -0
- package/dist/lodash/contains.d.ts +2 -0
- package/dist/lodash/debounce.d.ts +2 -0
- package/dist/lodash/deep-mix.d.ts +2 -0
- package/dist/lodash/difference.d.ts +11 -0
- package/dist/lodash/each.d.ts +2 -0
- package/dist/lodash/ends-with.d.ts +3 -0
- package/dist/lodash/every.d.ts +7 -0
- package/dist/lodash/extend.d.ts +2 -0
- package/dist/lodash/filter.d.ts +2 -0
- package/dist/lodash/find-index.d.ts +2 -0
- package/dist/lodash/find.d.ts +3 -0
- package/dist/lodash/first-value.d.ts +2 -0
- package/dist/lodash/fixed-base.d.ts +2 -0
- package/dist/lodash/flatten-deep.d.ts +12 -0
- package/dist/lodash/flatten.d.ts +11 -0
- package/dist/lodash/for-in.d.ts +2 -0
- package/dist/lodash/get-range.d.ts +6 -0
- package/dist/lodash/get-type.d.ts +2 -0
- package/dist/lodash/get-wrap-behavior.d.ts +9 -0
- package/dist/lodash/get.d.ts +8 -0
- package/dist/lodash/group-by.d.ts +6 -0
- package/dist/lodash/group-to-map.d.ts +8 -0
- package/dist/lodash/group.d.ts +2 -0
- package/dist/lodash/has-key.d.ts +2 -0
- package/dist/lodash/has-value.d.ts +2 -0
- package/dist/lodash/has.d.ts +2 -0
- package/dist/lodash/head.d.ts +1 -0
- package/dist/lodash/identity.d.ts +2 -0
- package/dist/lodash/index-of.d.ts +2 -0
- package/dist/lodash/index.d.ts +108 -0
- package/dist/lodash/is-arguments.d.ts +2 -0
- package/dist/lodash/is-array-like.d.ts +2 -0
- package/dist/lodash/is-array.d.ts +2 -0
- package/dist/lodash/is-boolean.d.ts +2 -0
- package/dist/lodash/is-date.d.ts +2 -0
- package/dist/lodash/is-decimal.d.ts +2 -0
- package/dist/lodash/is-element.d.ts +6 -0
- package/dist/lodash/is-empty.d.ts +2 -0
- package/dist/lodash/is-equal-with.d.ts +24 -0
- package/dist/lodash/is-equal.d.ts +2 -0
- package/dist/lodash/is-error.d.ts +2 -0
- package/dist/lodash/is-even.d.ts +2 -0
- package/dist/lodash/is-finite.d.ts +1 -0
- package/dist/lodash/is-function.d.ts +5 -0
- package/dist/lodash/is-integer.d.ts +2 -0
- package/dist/lodash/is-match.d.ts +2 -0
- package/dist/lodash/is-negative.d.ts +2 -0
- package/dist/lodash/is-nil.d.ts +2 -0
- package/dist/lodash/is-null.d.ts +2 -0
- package/dist/lodash/is-number-equal.d.ts +1 -0
- package/dist/lodash/is-number.d.ts +2 -0
- package/dist/lodash/is-object-like.d.ts +2 -0
- package/dist/lodash/is-object.d.ts +2 -0
- package/dist/lodash/is-odd.d.ts +2 -0
- package/dist/lodash/is-plain-object.d.ts +2 -0
- package/dist/lodash/is-positive.d.ts +2 -0
- package/dist/lodash/is-prototype.d.ts +2 -0
- package/dist/lodash/is-reg-exp.d.ts +2 -0
- package/dist/lodash/is-segment-equal.d.ts +2 -0
- package/dist/lodash/is-string.d.ts +2 -0
- package/dist/lodash/is-type.d.ts +2 -0
- package/dist/lodash/is-undefined.d.ts +2 -0
- package/dist/lodash/keys.d.ts +2 -0
- package/dist/lodash/last.d.ts +1 -0
- package/dist/lodash/lower-case.d.ts +2 -0
- package/dist/lodash/lower-first.d.ts +2 -0
- package/dist/lodash/map-values.d.ts +6 -0
- package/dist/lodash/map.d.ts +2 -0
- package/dist/lodash/max-by.d.ts +16 -0
- package/dist/lodash/max.d.ts +19 -0
- package/dist/lodash/memoize.d.ts +11 -0
- package/dist/lodash/merge.d.ts +7 -0
- package/dist/lodash/min-by.d.ts +16 -0
- package/dist/lodash/min.d.ts +19 -0
- package/dist/lodash/mix.d.ts +1 -0
- package/dist/lodash/mod.d.ts +2 -0
- package/dist/lodash/noop.d.ts +2 -0
- package/dist/lodash/number2color.d.ts +2 -0
- package/dist/lodash/omit.d.ts +3 -0
- package/dist/lodash/parse-radius.d.ts +9 -0
- package/dist/lodash/pick.d.ts +16 -0
- package/dist/lodash/pull-at.d.ts +2 -0
- package/dist/lodash/pull.d.ts +2 -0
- package/dist/lodash/reduce.d.ts +3 -0
- package/dist/lodash/remove.d.ts +2 -0
- package/dist/lodash/request-animation-frame.d.ts +1 -0
- package/dist/lodash/set.d.ts +8 -0
- package/dist/lodash/size.d.ts +1 -0
- package/dist/lodash/some.d.ts +7 -0
- package/dist/lodash/sort-by.d.ts +7 -0
- package/dist/lodash/starts-with.d.ts +3 -0
- package/dist/lodash/substitute.d.ts +5 -0
- package/dist/lodash/throttle.d.ts +6 -0
- package/dist/lodash/to-array.d.ts +2 -0
- package/dist/lodash/to-degree.d.ts +2 -0
- package/dist/lodash/to-integer.d.ts +1 -0
- package/dist/lodash/to-radian.d.ts +2 -0
- package/dist/lodash/to-string.d.ts +2 -0
- package/dist/lodash/types/index.d.ts +3 -0
- package/dist/lodash/union.d.ts +2 -0
- package/dist/lodash/uniq.d.ts +1 -0
- package/dist/lodash/unique-id.d.ts +2 -0
- package/dist/lodash/upper-case.d.ts +2 -0
- package/dist/lodash/upper-first.d.ts +2 -0
- package/dist/lodash/values-of-key.d.ts +2 -0
- package/dist/lodash/values.d.ts +2 -0
- package/dist/lodash/wrap-behavior.d.ts +9 -0
- package/dist/math/index.d.ts +2 -0
- package/dist/math/is-point-in-polygon.d.ts +1 -0
- package/dist/math/is-polygons-intersect.d.ts +4 -0
- package/dist/matrix/index.d.ts +27 -0
- package/dist/path/convert/path-2-absolute.d.ts +2 -0
- package/dist/path/convert/path-2-curve.d.ts +2 -0
- package/dist/path/convert/path-2-string.d.ts +6 -0
- package/dist/path/index.d.ts +18 -0
- package/dist/path/parser/finalize-segment.d.ts +5 -0
- package/dist/path/parser/is-arc-command.d.ts +4 -0
- package/dist/path/parser/is-digit-start.d.ts +6 -0
- package/dist/path/parser/is-path-command.d.ts +4 -0
- package/dist/path/parser/is-space.d.ts +4 -0
- package/dist/path/parser/params-count.d.ts +13 -0
- package/dist/path/parser/params-parser.d.ts +10 -0
- package/dist/path/parser/parse-path-string.d.ts +6 -0
- package/dist/path/parser/path-parser.d.ts +16 -0
- package/dist/path/parser/scan-flag.d.ts +6 -0
- package/dist/path/parser/scan-param.d.ts +6 -0
- package/dist/path/parser/scan-segment.d.ts +6 -0
- package/dist/path/parser/skip-spaces.d.ts +7 -0
- package/dist/path/process/arc-2-cubic.d.ts +7 -0
- package/dist/path/process/clone-path.d.ts +2 -0
- package/dist/path/process/fix-arc.d.ts +2 -0
- package/dist/path/process/line-2-cubic.d.ts +1 -0
- package/dist/path/process/normalize-path.d.ts +8 -0
- package/dist/path/process/normalize-segment.d.ts +6 -0
- package/dist/path/process/quad-2-cubic.d.ts +1 -0
- package/dist/path/process/reverse-curve.d.ts +2 -0
- package/dist/path/process/round-path.d.ts +6 -0
- package/dist/path/process/segment-2-cubic.d.ts +2 -0
- package/dist/path/types.d.ts +127 -0
- package/dist/path/util/distance-square-root.d.ts +1 -0
- package/dist/path/util/equalize-segments.d.ts +2 -0
- package/dist/path/util/get-draw-direction.d.ts +2 -0
- package/dist/path/util/get-path-area.d.ts +8 -0
- package/dist/path/util/get-path-bbox-total-length.d.ts +5 -0
- package/dist/path/util/get-path-bbox.d.ts +5 -0
- package/dist/path/util/get-point-at-length.d.ts +5 -0
- package/dist/path/util/get-properties-at-length.d.ts +6 -0
- package/dist/path/util/get-properties-at-point.d.ts +7 -0
- package/dist/path/util/get-rotated-curve.d.ts +2 -0
- package/dist/path/util/get-total-length.d.ts +8 -0
- package/dist/path/util/is-absolute-array.d.ts +6 -0
- package/dist/path/util/is-curve-array.d.ts +9 -0
- package/dist/path/util/is-normalized-array.d.ts +7 -0
- package/dist/path/util/is-path-array.d.ts +5 -0
- package/dist/path/util/is-point-in-stroke.d.ts +5 -0
- package/dist/path/util/mid-point.d.ts +1 -0
- package/dist/path/util/path-length-factory.d.ts +7 -0
- package/dist/path/util/rotate-vector.d.ts +4 -0
- package/dist/path/util/segment-arc-factory.d.ts +8 -0
- package/dist/path/util/segment-cubic-factory.d.ts +6 -0
- package/dist/path/util/segment-line-factory.d.ts +6 -0
- package/dist/path/util/segment-quad-factory.d.ts +6 -0
- package/dist/util.min.js +1 -1
- package/package.json +2 -5
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
declare const _default: (f: Function, resolver?: (...args: any[]) => string) => {
|
|
2
|
+
(...args: any[]): any;
|
|
3
|
+
cache: Map<any, any>;
|
|
4
|
+
};
|
|
5
|
+
/**
|
|
6
|
+
* _.memoize(calColor);
|
|
7
|
+
* _.memoize(calColor, (...args) => args[0]);
|
|
8
|
+
* @param f
|
|
9
|
+
* @param resolver
|
|
10
|
+
*/
|
|
11
|
+
export default _default;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
declare const _default: <T>(arr: T[], fn: string | ((v: T) => number)) => T;
|
|
2
|
+
/**
|
|
3
|
+
* @param {Array} arr The array to iterate over.
|
|
4
|
+
* @param {Function} [fn] The iteratee invoked per element.
|
|
5
|
+
* @return {*} Returns the minimum value.
|
|
6
|
+
* @example
|
|
7
|
+
*
|
|
8
|
+
* var objects = [{ 'n': 1 }, { 'n': 2 }];
|
|
9
|
+
*
|
|
10
|
+
* minBy(objects, function(o) { return o.n; });
|
|
11
|
+
* // => { 'n': 1 }
|
|
12
|
+
*
|
|
13
|
+
* minBy(objects, 'n');
|
|
14
|
+
* // => { 'n': 1 }
|
|
15
|
+
*/
|
|
16
|
+
export default _default;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
declare const _default: (arr: number[]) => number | undefined;
|
|
2
|
+
/**
|
|
3
|
+
* @param {Array} arr The array to iterate over.
|
|
4
|
+
* @return {*} Returns the minimum value.
|
|
5
|
+
* @example
|
|
6
|
+
*
|
|
7
|
+
* min([1, 2]);
|
|
8
|
+
* // => 1
|
|
9
|
+
*
|
|
10
|
+
* min([]);
|
|
11
|
+
* // => undefined
|
|
12
|
+
*
|
|
13
|
+
* const data = new Array(1250010).fill(1).map((d,idx) => idx);
|
|
14
|
+
*
|
|
15
|
+
* min(data);
|
|
16
|
+
* // => 1250010
|
|
17
|
+
* // Math.min(...data) will encounter "Maximum call stack size exceeded" error
|
|
18
|
+
*/
|
|
19
|
+
export default _default;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function mix<Base, A, B, C>(dist: Base & A & B & C, src1?: A, src2?: B, src3?: C): Base & A & B & C;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Creates an object composed of the picked `object` properties.
|
|
3
|
+
*
|
|
4
|
+
* @param {Object} object The source object.
|
|
5
|
+
* @param {...(string[])} [paths] The property paths to pick.
|
|
6
|
+
* @returns {Object} Returns the new object.
|
|
7
|
+
* @example
|
|
8
|
+
*
|
|
9
|
+
* var object = { 'a': 1, 'b': '2', 'c': 3 };
|
|
10
|
+
* pick(object, ['a', 'c']); // => { 'a': 1, 'c': 3 }
|
|
11
|
+
*/
|
|
12
|
+
export interface ObjectType<T> {
|
|
13
|
+
[key: string]: T;
|
|
14
|
+
}
|
|
15
|
+
declare const _default: <T>(object: ObjectType<T>, keys: string[]) => ObjectType<T>;
|
|
16
|
+
export default _default;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function requestAnimationFrame(fn: FrameRequestCallback): any;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function size(o: unknown): number;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export interface ObjectType<T> {
|
|
2
|
+
[key: string]: T;
|
|
3
|
+
}
|
|
4
|
+
declare function sortBy<T>(arr: ObjectType<T>[], key: Function): ObjectType<T>[];
|
|
5
|
+
declare function sortBy<T>(arr: ObjectType<T>[], key: string): ObjectType<T>[];
|
|
6
|
+
declare function sortBy<T>(arr: ObjectType<T>[], key: string[]): ObjectType<T>[];
|
|
7
|
+
export default sortBy;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default parseInt;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function uniq(arr: any[], cache?: Map<any, any>): any[];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function isPointInPolygon(points: number[][], x: number, y: number): boolean;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 根据 actions 来做 transform
|
|
3
|
+
* @param m
|
|
4
|
+
* @param actions
|
|
5
|
+
*/
|
|
6
|
+
export declare function transform(m: number[], actions: any[][]): any[];
|
|
7
|
+
/**
|
|
8
|
+
* 向量 v1 到 向量 v2 夹角的方向
|
|
9
|
+
* @param {Array} v1 向量
|
|
10
|
+
* @param {Array} v2 向量
|
|
11
|
+
* @return {Boolean} >= 0 顺时针 < 0 逆时针
|
|
12
|
+
*/
|
|
13
|
+
export declare function direction(v1: number[], v2: number[]): number;
|
|
14
|
+
/**
|
|
15
|
+
* 二维向量 v1 到 v2 的夹角
|
|
16
|
+
* @param v1
|
|
17
|
+
* @param v2
|
|
18
|
+
* @param direct
|
|
19
|
+
*/
|
|
20
|
+
export declare function angleTo(v1: [number, number], v2: [number, number], direct?: boolean): number;
|
|
21
|
+
/**
|
|
22
|
+
* 计算二维向量的垂直向量
|
|
23
|
+
* @param out
|
|
24
|
+
* @param v
|
|
25
|
+
* @param flag
|
|
26
|
+
*/
|
|
27
|
+
export declare function vertical(out: number[], v: number[], flag: boolean): number[];
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export { path2String } from './convert/path-2-string';
|
|
2
|
+
export { path2Curve } from './convert/path-2-curve';
|
|
3
|
+
export { path2Absolute } from './convert/path-2-absolute';
|
|
4
|
+
export { clonePath } from './process/clone-path';
|
|
5
|
+
export { normalizePath } from './process/normalize-path';
|
|
6
|
+
export { reverseCurve } from './process/reverse-curve';
|
|
7
|
+
export { arcToCubic } from './process/arc-2-cubic';
|
|
8
|
+
export { getPathBBox } from './util/get-path-bbox';
|
|
9
|
+
export { getTotalLength } from './util/get-total-length';
|
|
10
|
+
export { getPathBBoxTotalLength } from './util/get-path-bbox-total-length';
|
|
11
|
+
export { getRotatedCurve } from './util/get-rotated-curve';
|
|
12
|
+
export { getPathArea } from './util/get-path-area';
|
|
13
|
+
export { getDrawDirection } from './util/get-draw-direction';
|
|
14
|
+
export { getPointAtLength } from './util/get-point-at-length';
|
|
15
|
+
export { isPointInStroke } from './util/is-point-in-stroke';
|
|
16
|
+
export { distanceSquareRoot } from './util/distance-square-root';
|
|
17
|
+
export { equalizeSegments } from './util/equalize-segments';
|
|
18
|
+
export * from './types';
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { PathArray } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* The `PathParser` is used by the `parsePathString` static method
|
|
4
|
+
* to generate a `pathArray`.
|
|
5
|
+
*/
|
|
6
|
+
export declare class PathParser {
|
|
7
|
+
pathValue: string;
|
|
8
|
+
segments: PathArray;
|
|
9
|
+
max: number;
|
|
10
|
+
index: number;
|
|
11
|
+
param: number;
|
|
12
|
+
segmentStart: number;
|
|
13
|
+
data: any;
|
|
14
|
+
err: string;
|
|
15
|
+
constructor(pathString: string);
|
|
16
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Converts A (arc-to) segments to C (cubic-bezier-to).
|
|
3
|
+
*
|
|
4
|
+
* For more information of where this math came from visit:
|
|
5
|
+
* http://www.w3.org/TR/SVG11/implnote.html#ArcImplementationNotes
|
|
6
|
+
*/
|
|
7
|
+
export declare function arcToCubic(X1: number, Y1: number, RX: number, RY: number, angle: number, LAF: number, SF: number, X2: number, Y2: number, recursive: number[]): any[];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function lineToCubic(x1: number, y1: number, x2: number, y2: number): number[];
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { PathArray, NormalArray } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* @example
|
|
4
|
+
* const path = 'M0 0 H50';
|
|
5
|
+
* const normalizedPath = SVGPathCommander.normalizePath(path);
|
|
6
|
+
* // result => [['M', 0, 0], ['L', 50, 0]]
|
|
7
|
+
*/
|
|
8
|
+
export declare function normalizePath(pathInput: string | PathArray): NormalArray;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function quadToCubic(x1: number, y1: number, qx: number, qy: number, x2: number, y2: number): number[];
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
export declare type Point = {
|
|
2
|
+
x: number;
|
|
3
|
+
y: number;
|
|
4
|
+
};
|
|
5
|
+
export declare type MCommand = 'M';
|
|
6
|
+
export declare type mCommand = 'm';
|
|
7
|
+
export declare type LCommand = 'L';
|
|
8
|
+
export declare type lCommand = 'l';
|
|
9
|
+
export declare type VCommand = 'V';
|
|
10
|
+
export declare type vCommand = 'v';
|
|
11
|
+
export declare type HCommand = 'H';
|
|
12
|
+
export declare type hCommand = 'h';
|
|
13
|
+
export declare type ZCommand = 'Z';
|
|
14
|
+
export declare type zCommand = 'z';
|
|
15
|
+
export declare type CCommand = 'C';
|
|
16
|
+
export declare type cCommand = 'c';
|
|
17
|
+
export declare type SCommand = 'S';
|
|
18
|
+
export declare type sCommand = 's';
|
|
19
|
+
export declare type QCommand = 'Q';
|
|
20
|
+
export declare type qCommand = 'q';
|
|
21
|
+
export declare type TCommand = 'T';
|
|
22
|
+
export declare type tCommand = 't';
|
|
23
|
+
export declare type ACommand = 'A';
|
|
24
|
+
export declare type aCommand = 'a';
|
|
25
|
+
export declare type AbsoluteCommand = MCommand | LCommand | VCommand | HCommand | ZCommand | CCommand | SCommand | QCommand | TCommand | ACommand;
|
|
26
|
+
export declare type RelativeCommand = mCommand | lCommand | vCommand | hCommand | zCommand | cCommand | sCommand | qCommand | tCommand | aCommand;
|
|
27
|
+
export declare type PathCommand = AbsoluteCommand | RelativeCommand;
|
|
28
|
+
export declare type MSegment = [MCommand, number, number];
|
|
29
|
+
export declare type mSegment = [mCommand, number, number];
|
|
30
|
+
export declare type MoveSegment = MSegment | mSegment;
|
|
31
|
+
export declare type LSegment = [LCommand, number, number];
|
|
32
|
+
export declare type lSegment = [lCommand, number, number];
|
|
33
|
+
export declare type LineSegment = LSegment | lSegment;
|
|
34
|
+
export declare type VSegment = [VCommand, number];
|
|
35
|
+
export declare type vSegment = [vCommand, number];
|
|
36
|
+
export declare type VertLineSegment = vSegment | VSegment;
|
|
37
|
+
export declare type HSegment = [HCommand, number];
|
|
38
|
+
export declare type hSegment = [hCommand, number];
|
|
39
|
+
export declare type HorLineSegment = HSegment | hSegment;
|
|
40
|
+
export declare type ZSegment = [ZCommand];
|
|
41
|
+
export declare type zSegment = [zCommand];
|
|
42
|
+
export declare type CloseSegment = ZSegment | zSegment;
|
|
43
|
+
export declare type CSegment = [CCommand, number, number, number, number, number, number];
|
|
44
|
+
export declare type cSegment = [cCommand, number, number, number, number, number, number];
|
|
45
|
+
export declare type CubicSegment = CSegment | cSegment;
|
|
46
|
+
export declare type SSegment = [SCommand, number, number, number, number];
|
|
47
|
+
export declare type sSegment = [sCommand, number, number, number, number];
|
|
48
|
+
export declare type ShortCubicSegment = SSegment | sSegment;
|
|
49
|
+
export declare type QSegment = [QCommand, number, number, number, number];
|
|
50
|
+
export declare type qSegment = [qCommand, number, number, number, number];
|
|
51
|
+
export declare type QuadSegment = QSegment | qSegment;
|
|
52
|
+
export declare type TSegment = [TCommand, number, number];
|
|
53
|
+
export declare type tSegment = [tCommand, number, number];
|
|
54
|
+
export declare type ShortQuadSegment = TSegment | tSegment;
|
|
55
|
+
export declare type ASegment = [ACommand, number, number, number, number, number, number, number];
|
|
56
|
+
export declare type aSegment = [aCommand, number, number, number, number, number, number, number];
|
|
57
|
+
export declare type ArcSegment = ASegment | aSegment;
|
|
58
|
+
export declare type PathSegment = MoveSegment | LineSegment | VertLineSegment | HorLineSegment | CloseSegment | CubicSegment | ShortCubicSegment | QuadSegment | ShortQuadSegment | ArcSegment;
|
|
59
|
+
export interface SegmentProperties {
|
|
60
|
+
/** the segment */
|
|
61
|
+
segment: PathSegment;
|
|
62
|
+
/** the segment index */
|
|
63
|
+
index: number;
|
|
64
|
+
/** the segment length */
|
|
65
|
+
length: number;
|
|
66
|
+
/** the length including the segment length */
|
|
67
|
+
lengthAtSegment: number;
|
|
68
|
+
[key: string]: any;
|
|
69
|
+
}
|
|
70
|
+
export declare type ShortSegment = VertLineSegment | HorLineSegment | ShortCubicSegment | ShortQuadSegment | CloseSegment;
|
|
71
|
+
export declare type AbsoluteSegment = MSegment | LSegment | VSegment | HSegment | CSegment | SSegment | QSegment | TSegment | ASegment | ZSegment;
|
|
72
|
+
export declare type RelativeSegment = mSegment | lSegment | vSegment | hSegment | cSegment | sSegment | qSegment | tSegment | aSegment | zSegment;
|
|
73
|
+
export declare type NormalSegment = MSegment | LSegment | CSegment | QSegment | ASegment | ZSegment;
|
|
74
|
+
export declare type PathArray = [MSegment | mSegment, ...PathSegment[]];
|
|
75
|
+
export declare type AbsoluteArray = [MSegment, ...AbsoluteSegment[]];
|
|
76
|
+
export declare type RelativeArray = [MSegment, ...RelativeSegment[]];
|
|
77
|
+
export declare type NormalArray = [MSegment, ...NormalSegment[]];
|
|
78
|
+
export declare type CurveArray = [MSegment, ...CSegment[]];
|
|
79
|
+
export declare type PolygonArray = [MSegment, ...LSegment[], ZSegment];
|
|
80
|
+
export declare type PolylineArray = [MSegment, ...LSegment[]];
|
|
81
|
+
export interface ParserParams {
|
|
82
|
+
x1: number;
|
|
83
|
+
y1: number;
|
|
84
|
+
x2: number;
|
|
85
|
+
y2: number;
|
|
86
|
+
x: number;
|
|
87
|
+
y: number;
|
|
88
|
+
qx: number | null;
|
|
89
|
+
qy: number | null;
|
|
90
|
+
}
|
|
91
|
+
export interface PathBBox {
|
|
92
|
+
width: number;
|
|
93
|
+
height: number;
|
|
94
|
+
x: number;
|
|
95
|
+
y: number;
|
|
96
|
+
x2: number;
|
|
97
|
+
y2: number;
|
|
98
|
+
cx: number;
|
|
99
|
+
cy: number;
|
|
100
|
+
cz: number;
|
|
101
|
+
}
|
|
102
|
+
export interface PathBBoxTotalLength extends PathBBox {
|
|
103
|
+
length: number;
|
|
104
|
+
}
|
|
105
|
+
export interface PathLengthFactoryOptions {
|
|
106
|
+
bbox: boolean;
|
|
107
|
+
length: boolean;
|
|
108
|
+
sampleSize: number;
|
|
109
|
+
}
|
|
110
|
+
export interface SegmentLimits {
|
|
111
|
+
min: Point;
|
|
112
|
+
max: Point;
|
|
113
|
+
}
|
|
114
|
+
export interface PointProperties {
|
|
115
|
+
closest: {
|
|
116
|
+
x: number;
|
|
117
|
+
y: number;
|
|
118
|
+
};
|
|
119
|
+
distance: number;
|
|
120
|
+
segment?: SegmentProperties;
|
|
121
|
+
}
|
|
122
|
+
export interface LengthFactory {
|
|
123
|
+
length: number;
|
|
124
|
+
point: Point;
|
|
125
|
+
min: Point;
|
|
126
|
+
max: Point;
|
|
127
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function distanceSquareRoot(a: [number, number], b: [number, number]): number;
|