@antv/g 5.2.2 → 5.3.1

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.
@@ -1 +1 @@
1
- {"version":3,"file":"path.d.ts","sourceRoot":"","sources":["../src/css/parser/path.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAiB,UAAU,EAAE,MAAM,YAAY,CAAC;AAW5D,OAAO,KAAK,EAAE,aAAa,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AACjF,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAI1C,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,aAAa,GAAG,oBAAoB,CAAC,MAAM,CAAC,CAqC3F;AAED,wBAAgB,UAAU,CACxB,IAAI,EAAE,oBAAoB,CAAC,MAAM,CAAC,EAClC,KAAK,EAAE,oBAAoB,CAAC,MAAM,CAAC,EACnC,MAAM,EAAE,QAAQ,GACf,CAAC,UAAU,EAAE,UAAU,EAAE,CAAC,CAAC,EAAE,UAAU,KAAK,UAAU,CAAC,CAqBzD"}
1
+ {"version":3,"file":"path.d.ts","sourceRoot":"","sources":["../src/css/parser/path.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAiB,UAAU,EAAE,MAAM,YAAY,CAAC;AAY5D,OAAO,KAAK,EAAE,aAAa,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AACjF,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAI1C,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,aAAa,GAAG,oBAAoB,CAAC,MAAM,CAAC,CAqC3F;AAED,wBAAgB,UAAU,CACxB,IAAI,EAAE,oBAAoB,CAAC,MAAM,CAAC,EAClC,KAAK,EAAE,oBAAoB,CAAC,MAAM,CAAC,EACnC,MAAM,EAAE,QAAQ,GACf,CAAC,UAAU,EAAE,UAAU,EAAE,CAAC,CAAC,EAAE,UAAU,KAAK,UAAU,CAAC,CAqBzD"}
package/dist/index.esm.js CHANGED
@@ -2893,6 +2893,37 @@ function convertToPath(object, applyLocalTransform) {
2893
2893
  return commandsToPathString(commands, object, applyLocalTransform);
2894
2894
  }
2895
2895
  }
2896
+ function translatePathToString(pathArray, x, y) {
2897
+ var newValue = pathArray.map(function (params) {
2898
+ var command = params[0];
2899
+
2900
+ switch (command) {
2901
+ case 'M':
2902
+ return "M " + (params[1] - x) + "," + (params[2] - y);
2903
+
2904
+ case 'L':
2905
+ return "L " + (params[1] - x) + "," + (params[2] - y);
2906
+
2907
+ case 'Q':
2908
+ return "Q " + (params[1] - x) + " " + (params[2] - y) + "," + (params[3] - x) + " " + (params[4] - y);
2909
+
2910
+ case 'C':
2911
+ return "C " + (params[1] - x) + " " + (params[2] - y) + "," + (params[3] - x) + " " + (params[4] - y) + "," + (params[5] - x) + " " + (params[6] - y);
2912
+
2913
+ case 'A':
2914
+ return "A " + params[1] + " " + params[2] + " " + params[3] + " " + params[4] + " " + params[5] + " " + (params[6] - x) + " " + (params[7] - y);
2915
+
2916
+ case 'Z':
2917
+ return 'Z';
2918
+ }
2919
+ }).join(' ');
2920
+
2921
+ if (~newValue.indexOf('NaN')) {
2922
+ return '';
2923
+ }
2924
+
2925
+ return newValue;
2926
+ }
2896
2927
 
2897
2928
  // @ts-nocheck
2898
2929
  // interface HookInterceptor<T, R, AdditionalOptions = UnsetAdditionalOptions> {
@@ -21470,4 +21501,4 @@ var Canvas = /*#__PURE__*/function (_EventTarget) {
21470
21501
  GlobalContainer.load(containerModule);
21471
21502
  var layoutEngine = GlobalContainer.get(LayoutEngine);
21472
21503
 
21473
- export { AABB, AbstractLayoutDefinition, AbstractRenderer, Animation, AnimationEffectTiming, AnimationEvent, AnimationTimeline, AsyncParallelHook, AsyncSeriesWaterfallHook, BUILT_IN_PROPERTIES, BaseType, BoundingSphere, CSS, CSSColorValue, CSSGradientValue, CSSKeywordValue, CSSMathInvert, CSSMathMax, CSSMathMin, CSSMathNegate, CSSMathOperator, CSSMathProduct, CSSMathSum, CSSMathValue, CSSMathVariadic, CSSNumericValue, CSSNumericValueType, CSSProperty, CSSPropertyAngle, CSSPropertyClipPath, CSSPropertyColor, CSSPropertyFilter, CSSPropertyLengthOrPercentage, CSSPropertyLengthOrPercentage12, CSSPropertyLengthOrPercentage14, CSSPropertyLocalPosition, CSSPropertyOffsetDistance, CSSPropertyOffsetPath, CSSPropertyOpacity, CSSPropertyPath, CSSPropertyPoints, CSSPropertyShadowBlur, CSSPropertySyntaxFactory, CSSPropertyText, CSSPropertyTextTransform, CSSPropertyTransform, CSSPropertyTransformOrigin, CSSPropertyZIndex, CSSRGB, CSSStyleValue, CSSStyleValueType, CSSUnitValue, Camera, CameraEvent, CameraProjectionMode, CameraTrackingMode, CameraType, Canvas, CanvasConfig, CanvasEvent, Circle, CircleUpdater, ContextNode, ContextService, Cullable, CustomElement, CustomElementRegistry, CustomEvent, DCHECK, DCHECK_EQ, DCHECK_NE, DELEGATION_SPLITTER, DefaultCamera, DefaultSceneGraphSelector, DefaultSceneGraphService, DefaultStyleValueRegistry, Deferred, DisplayObject, DisplayObjectPool, Document, EasingFunctions, Element, ElementEvent, Ellipse, EllipseUpdater, EventService, EventTarget, FederatedEvent, FederatedMouseEvent, FederatedPointerEvent, FederatedWheelEvent, FragmentResult, FragmentResultFactory, FragmentResultOptions, Frustum, Geometry, GeometryAABBUpdater, GeometryUpdaterFactory, GradientType, Group, HTML, Image, KeyframeEffect, LayoutChildren, LayoutChildrenFactory, LayoutChildrenOptions, LayoutContext, LayoutContextFactory, LayoutContextOptions, LayoutEdges, LayoutEdgesFactory, LayoutEdgesOptions, LayoutEngine, LayoutFragment, LayoutFragmentFactory, LayoutFragmentOptions, LayoutObject, LayoutRegistry, LayoutTaskType, Line, LineUpdater, MOUSE_POINTER_ID, Mask, MutationEvent, MutationObserver, MutationRecord, Nested, Node, ObjectTyped, Odeg, OffscreenCanvasCreator, Opx, ParenLess, Path, PathUpdater, Plane, Point, Polygon, Polyline, PolylineUpdater, PropertyName, PropertySyntax, RBushNode, RBushRoot, Ray, Rect, RectUpdater, Rectangle, Registration, RenderReason, Renderable, RenderingContext, RenderingPluginContribution, RenderingService, SceneGraphSelector, SceneGraphSelectorFactory, SceneGraphService, Shape, Sortable, Strategy, StyleValueRegistry, SyncHook, SyncWaterfallHook, TOUCH_TO_POINTER, Text, TextService, TextUpdater, Transform, UnitCategory, UnitType, ValueRange, baseTypeToString, camelCase, clamp, clampedMergeNumbers, cleanExistedCanvas, colorStopToString, compareAnimations, computeLinearGradient, computeRadialGradient, convertAngleUnit, convertEffectInput, convertPercentUnit, convertToDash, convertToPath, createVec3, decompose, deg2rad, deg2turn, dirtifyToRoot, equalSet, extractPolygons, formatAttribute, fromRotationTranslationScale, getAngle, getEasingFunction, getEuler, getHeight, getRotationInRadians, getScaling, getStyle, getTranslation, getWidth, grad2deg, hasArcOrBezier, isBoolean, isBrowser, isComparison, isFunction, isNil, isNumber, isObject, isPattern, isString, isUndefined, layoutEngine, makePerspective, makeQuerablePromise, makeTiming, mergeColors, mergeDimensionList, mergeDimensions, mergeNumberLists, mergeNumbers, mergePaths, mergeTransforms, normalizeKeyframes, normalizeTimingInput, numberToString, numericTimingToObject, parseAngle, parseColor, parseDimension, parseDimensionArray, parseFilter, parseGradient, parseLength, parseLengthOrPercentage, parseNumber, parseNumberList, parseParam, parsePath, parsePoints, parseTransform, parseTransformOrigin, parserPercentage, path2Segments, rad2deg, setDOMSize, sortByZIndex, toFontString, turn2deg, typeCheck, unitTypeToBaseType };
21504
+ export { AABB, AbstractLayoutDefinition, AbstractRenderer, Animation, AnimationEffectTiming, AnimationEvent, AnimationTimeline, AsyncParallelHook, AsyncSeriesWaterfallHook, BUILT_IN_PROPERTIES, BaseType, BoundingSphere, CSS, CSSColorValue, CSSGradientValue, CSSKeywordValue, CSSMathInvert, CSSMathMax, CSSMathMin, CSSMathNegate, CSSMathOperator, CSSMathProduct, CSSMathSum, CSSMathValue, CSSMathVariadic, CSSNumericValue, CSSNumericValueType, CSSProperty, CSSPropertyAngle, CSSPropertyClipPath, CSSPropertyColor, CSSPropertyFilter, CSSPropertyLengthOrPercentage, CSSPropertyLengthOrPercentage12, CSSPropertyLengthOrPercentage14, CSSPropertyLocalPosition, CSSPropertyOffsetDistance, CSSPropertyOffsetPath, CSSPropertyOpacity, CSSPropertyPath, CSSPropertyPoints, CSSPropertyShadowBlur, CSSPropertySyntaxFactory, CSSPropertyText, CSSPropertyTextTransform, CSSPropertyTransform, CSSPropertyTransformOrigin, CSSPropertyZIndex, CSSRGB, CSSStyleValue, CSSStyleValueType, CSSUnitValue, Camera, CameraEvent, CameraProjectionMode, CameraTrackingMode, CameraType, Canvas, CanvasConfig, CanvasEvent, Circle, CircleUpdater, ContextNode, ContextService, Cullable, CustomElement, CustomElementRegistry, CustomEvent, DCHECK, DCHECK_EQ, DCHECK_NE, DELEGATION_SPLITTER, DefaultCamera, DefaultSceneGraphSelector, DefaultSceneGraphService, DefaultStyleValueRegistry, Deferred, DisplayObject, DisplayObjectPool, Document, EasingFunctions, Element, ElementEvent, Ellipse, EllipseUpdater, EventService, EventTarget, FederatedEvent, FederatedMouseEvent, FederatedPointerEvent, FederatedWheelEvent, FragmentResult, FragmentResultFactory, FragmentResultOptions, Frustum, Geometry, GeometryAABBUpdater, GeometryUpdaterFactory, GradientType, Group, HTML, Image, KeyframeEffect, LayoutChildren, LayoutChildrenFactory, LayoutChildrenOptions, LayoutContext, LayoutContextFactory, LayoutContextOptions, LayoutEdges, LayoutEdgesFactory, LayoutEdgesOptions, LayoutEngine, LayoutFragment, LayoutFragmentFactory, LayoutFragmentOptions, LayoutObject, LayoutRegistry, LayoutTaskType, Line, LineUpdater, MOUSE_POINTER_ID, Mask, MutationEvent, MutationObserver, MutationRecord, Nested, Node, ObjectTyped, Odeg, OffscreenCanvasCreator, Opx, ParenLess, Path, PathUpdater, Plane, Point, Polygon, Polyline, PolylineUpdater, PropertyName, PropertySyntax, RBushNode, RBushRoot, Ray, Rect, RectUpdater, Rectangle, Registration, RenderReason, Renderable, RenderingContext, RenderingPluginContribution, RenderingService, SceneGraphSelector, SceneGraphSelectorFactory, SceneGraphService, Shape, Sortable, Strategy, StyleValueRegistry, SyncHook, SyncWaterfallHook, TOUCH_TO_POINTER, Text, TextService, TextUpdater, Transform, UnitCategory, UnitType, ValueRange, baseTypeToString, camelCase, clamp, clampedMergeNumbers, cleanExistedCanvas, colorStopToString, compareAnimations, computeLinearGradient, computeRadialGradient, convertAngleUnit, convertEffectInput, convertPercentUnit, convertToDash, convertToPath, createVec3, decompose, deg2rad, deg2turn, dirtifyToRoot, equalSet, extractPolygons, formatAttribute, fromRotationTranslationScale, getAngle, getEasingFunction, getEuler, getHeight, getRotationInRadians, getScaling, getStyle, getTranslation, getWidth, grad2deg, hasArcOrBezier, isBoolean, isBrowser, isComparison, isFunction, isNil, isNumber, isObject, isPattern, isString, isUndefined, layoutEngine, makePerspective, makeQuerablePromise, makeTiming, mergeColors, mergeDimensionList, mergeDimensions, mergeNumberLists, mergeNumbers, mergePaths, mergeTransforms, normalizeKeyframes, normalizeTimingInput, numberToString, numericTimingToObject, parseAngle, parseColor, parseDimension, parseDimensionArray, parseFilter, parseGradient, parseLength, parseLengthOrPercentage, parseNumber, parseNumberList, parseParam, parsePath, parsePoints, parseTransform, parseTransformOrigin, parserPercentage, path2Segments, rad2deg, setDOMSize, sortByZIndex, toFontString, translatePathToString, turn2deg, typeCheck, unitTypeToBaseType };
package/dist/index.js CHANGED
@@ -2887,6 +2887,37 @@ function convertToPath(object, applyLocalTransform) {
2887
2887
  return commandsToPathString(commands, object, applyLocalTransform);
2888
2888
  }
2889
2889
  }
2890
+ function translatePathToString(pathArray, x, y) {
2891
+ var newValue = pathArray.map(function (params) {
2892
+ var command = params[0];
2893
+
2894
+ switch (command) {
2895
+ case 'M':
2896
+ return "M " + (params[1] - x) + "," + (params[2] - y);
2897
+
2898
+ case 'L':
2899
+ return "L " + (params[1] - x) + "," + (params[2] - y);
2900
+
2901
+ case 'Q':
2902
+ return "Q " + (params[1] - x) + " " + (params[2] - y) + "," + (params[3] - x) + " " + (params[4] - y);
2903
+
2904
+ case 'C':
2905
+ return "C " + (params[1] - x) + " " + (params[2] - y) + "," + (params[3] - x) + " " + (params[4] - y) + "," + (params[5] - x) + " " + (params[6] - y);
2906
+
2907
+ case 'A':
2908
+ return "A " + params[1] + " " + params[2] + " " + params[3] + " " + params[4] + " " + params[5] + " " + (params[6] - x) + " " + (params[7] - y);
2909
+
2910
+ case 'Z':
2911
+ return 'Z';
2912
+ }
2913
+ }).join(' ');
2914
+
2915
+ if (~newValue.indexOf('NaN')) {
2916
+ return '';
2917
+ }
2918
+
2919
+ return newValue;
2920
+ }
2890
2921
 
2891
2922
  // @ts-nocheck
2892
2923
  // interface HookInterceptor<T, R, AdditionalOptions = UnsetAdditionalOptions> {
@@ -21629,6 +21660,7 @@ exports.rad2deg = rad2deg;
21629
21660
  exports.setDOMSize = setDOMSize;
21630
21661
  exports.sortByZIndex = sortByZIndex;
21631
21662
  exports.toFontString = toFontString;
21663
+ exports.translatePathToString = translatePathToString;
21632
21664
  exports.turn2deg = turn2deg;
21633
21665
  exports.typeCheck = typeCheck;
21634
21666
  exports.unitTypeToBaseType = unitTypeToBaseType;
package/dist/index.umd.js CHANGED
@@ -9548,6 +9548,37 @@
9548
9548
  return commandsToPathString(commands, object, applyLocalTransform);
9549
9549
  }
9550
9550
  }
9551
+ function translatePathToString(pathArray, x, y) {
9552
+ var newValue = pathArray.map(function (params) {
9553
+ var command = params[0];
9554
+
9555
+ switch (command) {
9556
+ case 'M':
9557
+ return "M " + (params[1] - x) + "," + (params[2] - y);
9558
+
9559
+ case 'L':
9560
+ return "L " + (params[1] - x) + "," + (params[2] - y);
9561
+
9562
+ case 'Q':
9563
+ return "Q " + (params[1] - x) + " " + (params[2] - y) + "," + (params[3] - x) + " " + (params[4] - y);
9564
+
9565
+ case 'C':
9566
+ return "C " + (params[1] - x) + " " + (params[2] - y) + "," + (params[3] - x) + " " + (params[4] - y) + "," + (params[5] - x) + " " + (params[6] - y);
9567
+
9568
+ case 'A':
9569
+ return "A " + params[1] + " " + params[2] + " " + params[3] + " " + params[4] + " " + params[5] + " " + (params[6] - x) + " " + (params[7] - y);
9570
+
9571
+ case 'Z':
9572
+ return 'Z';
9573
+ }
9574
+ }).join(' ');
9575
+
9576
+ if (~newValue.indexOf('NaN')) {
9577
+ return '';
9578
+ }
9579
+
9580
+ return newValue;
9581
+ }
9551
9582
 
9552
9583
  // @ts-nocheck
9553
9584
  // interface HookInterceptor<T, R, AdditionalOptions = UnsetAdditionalOptions> {
@@ -16831,9 +16862,9 @@
16831
16862
  cx = (k * rx * y) / ry + (x1 + x2) / 2;
16832
16863
  cy = (k * -ry * x) / rx + (y1 + y2) / 2;
16833
16864
  // eslint-disable-next-line no-bitwise -- Impossible to satisfy no-bitwise
16834
- f1 = ((Math.asin((y1 - cy) / ry) * Math.pow(10, 9)) >> 0) / Math.pow(10, 9);
16865
+ f1 = Math.asin(((((y1 - cy) / ry) * Math.pow(10, 9)) >> 0) / Math.pow(10, 9));
16835
16866
  // eslint-disable-next-line no-bitwise -- Impossible to satisfy no-bitwise
16836
- f2 = ((Math.asin((y2 - cy) / ry) * Math.pow(10, 9)) >> 0) / Math.pow(10, 9);
16867
+ f2 = Math.asin(((((y2 - cy) / ry) * Math.pow(10, 9)) >> 0) / Math.pow(10, 9));
16837
16868
  f1 = x1 < cx ? Math.PI - f1 : f1;
16838
16869
  f2 = x2 < cx ? Math.PI - f2 : f2;
16839
16870
  if (f1 < 0)
@@ -17099,9 +17130,8 @@
17099
17130
  function segmentLineFactory(x1, y1, x2, y2, distance) {
17100
17131
  const length = distanceSquareRoot([x1, y1], [x2, y2]);
17101
17132
  let point = { x: 0, y: 0 };
17102
- /* istanbul ignore else */
17103
17133
  if (typeof distance === 'number') {
17104
- if (distance === 0) {
17134
+ if (distance <= 0) {
17105
17135
  point = { x: x1, y: y1 };
17106
17136
  }
17107
17137
  else if (distance >= length) {
@@ -17341,7 +17371,7 @@
17341
17371
  let t = 0;
17342
17372
  let POINT = { x: 0, y: 0 };
17343
17373
  let POINTS = [{ x, y }];
17344
- if (distanceIsNumber && distance === 0) {
17374
+ if (distanceIsNumber && distance <= 0) {
17345
17375
  POINT = { x, y };
17346
17376
  }
17347
17377
  const sampleSize = 300;
@@ -17402,7 +17432,7 @@
17402
17432
  let t = 0;
17403
17433
  let POINT = { x: 0, y: 0 };
17404
17434
  let POINTS = [{ x, y }];
17405
- if (distanceIsNumber && distance === 0) {
17435
+ if (distanceIsNumber && distance <= 0) {
17406
17436
  POINT = { x, y };
17407
17437
  }
17408
17438
  // bad perf when size = 300
@@ -17466,7 +17496,7 @@
17466
17496
  let t = 0;
17467
17497
  let POINT = { x: 0, y: 0 };
17468
17498
  let POINTS = [{ x, y }];
17469
- if (distanceIsNumber && distance === 0) {
17499
+ if (distanceIsNumber && distance <= 0) {
17470
17500
  POINT = { x, y };
17471
17501
  }
17472
17502
  const sampleSize = 300;
@@ -31674,6 +31704,7 @@
31674
31704
  exports.sortByZIndex = sortByZIndex;
31675
31705
  exports.toFontString = toFontString;
31676
31706
  exports.transient = transient;
31707
+ exports.translatePathToString = translatePathToString;
31677
31708
  exports.turn2deg = turn2deg;
31678
31709
  exports.typeCheck = typeCheck;
31679
31710
  exports.unitTypeToBaseType = unitTypeToBaseType;