@antv/g-lite 1.2.11 → 1.2.13

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.
@@ -21,6 +21,7 @@ export interface PolygonStyleProps extends BaseStyleProps {
21
21
  */
22
22
  markerEndOffset?: number;
23
23
  isClosed?: boolean;
24
+ isBillboard?: boolean;
24
25
  }
25
26
  export interface ParsedPolygonStyleProps extends ParsedBaseStyleProps {
26
27
  points: {
@@ -34,6 +35,7 @@ export interface ParsedPolygonStyleProps extends ParsedBaseStyleProps {
34
35
  markerStartOffset?: number;
35
36
  markerEndOffset?: number;
36
37
  isClosed?: boolean;
38
+ isBillboard?: boolean;
37
39
  }
38
40
  export declare class Polygon extends DisplayObject<PolygonStyleProps, ParsedPolygonStyleProps> {
39
41
  private markerStartAngle;
@@ -22,6 +22,7 @@ export interface PolylineStyleProps extends BaseStyleProps {
22
22
  * offset relative to original position
23
23
  */
24
24
  markerEndOffset?: number;
25
+ isBillboard?: boolean;
25
26
  }
26
27
  export interface ParsedPolylineStyleProps extends ParsedBaseStyleProps {
27
28
  points: {
@@ -34,6 +35,7 @@ export interface ParsedPolylineStyleProps extends ParsedBaseStyleProps {
34
35
  markerEnd?: DisplayObject | null;
35
36
  markerStartOffset?: number;
36
37
  markerEndOffset?: number;
38
+ isBillboard?: boolean;
37
39
  }
38
40
  /**
39
41
  * Polyline inherits the marker-related capabilities of Polygon.
package/dist/index.esm.js CHANGED
@@ -4233,6 +4233,33 @@ function getOrCalculatePathTotalLength(path) {
4233
4233
  }
4234
4234
  return path.parsedStyle.path.totalLength;
4235
4235
  }
4236
+ function removeRedundantMCommand(path) {
4237
+ for (var i = 0; i < path.length; i++) {
4238
+ var prevSegment = path[i - 1];
4239
+ var segment = path[i];
4240
+ var cmd = segment[0];
4241
+ if (cmd === 'M') {
4242
+ if (prevSegment) {
4243
+ var prevCmd = prevSegment[0];
4244
+ var srcPoint = [segment[1], segment[2]];
4245
+ var destPoint = void 0;
4246
+ if (prevCmd === 'L' || prevCmd === 'M') {
4247
+ destPoint = [prevSegment[1], prevSegment[2]];
4248
+ }
4249
+ else if (prevCmd === 'C' || prevCmd === 'A' || prevCmd === 'Q') {
4250
+ destPoint = [
4251
+ prevSegment[prevSegment.length - 2],
4252
+ prevSegment[prevSegment.length - 1],
4253
+ ];
4254
+ }
4255
+ if (destPoint && isSamePoint(srcPoint, destPoint)) {
4256
+ path.splice(i, 1);
4257
+ i--;
4258
+ }
4259
+ }
4260
+ }
4261
+ }
4262
+ }
4236
4263
  function hasArcOrBezier(path) {
4237
4264
  var hasArc = false;
4238
4265
  var count = path.length;
@@ -5003,6 +5030,7 @@ var internalParsePath = function (path) {
5003
5030
  absolutePath = normalizePath('');
5004
5031
  console.error("[g]: Invalid SVG Path definition: ".concat(path));
5005
5032
  }
5033
+ removeRedundantMCommand(absolutePath);
5006
5034
  var hasArc = hasArcOrBezier(absolutePath);
5007
5035
  var _a = extractPolygons(absolutePath), polygons = _a.polygons, polylines = _a.polylines;
5008
5036
  // for later use