antvis / util

utility library for AntV products.
MIT License
74 stars 28 forks source link

fix: make segment size configurable when calculating path length & bbox #93

Closed xiaoiver closed 2 years ago

xiaoiver commented 2 years ago

以下方法增加了可选配置项 options,内部会跳过不需要的计算过程(bbox 或长度),目前支持参数有 sampleSize,越少的采样点计算越快,但会牺牲一些精度:

getTotalLength(pathInput: string | PathArray, options?: Partial<PathLengthFactoryOptions>): number;
getPathBBox(path: string | PathArray, options?: Partial<PathLengthFactoryOptions>): PathBBox;
getPathBBoxTotalLength(
  path: PathArray,
  options?: Partial<PathLengthFactoryOptions>,
): PathBBoxTotalLength;

92