@antv/g-lite 1.2.15 → 1.2.17

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/index.js CHANGED
@@ -8188,17 +8188,23 @@ var PolylineUpdater = /** @class */ (function () {
8188
8188
  function PolylineUpdater() {
8189
8189
  }
8190
8190
  PolylineUpdater.prototype.update = function (parsedStyle) {
8191
- var points = parsedStyle.points.points;
8192
- // FIXME: account for miter lineJoin
8193
- var minX = Math.min.apply(Math, tslib.__spreadArray([], tslib.__read(points.map(function (point) { return point[0]; })), false));
8194
- var maxX = Math.max.apply(Math, tslib.__spreadArray([], tslib.__read(points.map(function (point) { return point[0]; })), false));
8195
- var minY = Math.min.apply(Math, tslib.__spreadArray([], tslib.__read(points.map(function (point) { return point[1]; })), false));
8196
- var maxY = Math.max.apply(Math, tslib.__spreadArray([], tslib.__read(points.map(function (point) { return point[1]; })), false));
8197
- var width = maxX - minX;
8198
- var height = maxY - minY;
8191
+ if (parsedStyle.points && util.isArray(parsedStyle.points.points)) {
8192
+ var points = parsedStyle.points.points;
8193
+ // FIXME: account for miter lineJoin
8194
+ var minX = Math.min.apply(Math, tslib.__spreadArray([], tslib.__read(points.map(function (point) { return point[0]; })), false));
8195
+ var maxX = Math.max.apply(Math, tslib.__spreadArray([], tslib.__read(points.map(function (point) { return point[0]; })), false));
8196
+ var minY = Math.min.apply(Math, tslib.__spreadArray([], tslib.__read(points.map(function (point) { return point[1]; })), false));
8197
+ var maxY = Math.max.apply(Math, tslib.__spreadArray([], tslib.__read(points.map(function (point) { return point[1]; })), false));
8198
+ var width = maxX - minX;
8199
+ var height = maxY - minY;
8200
+ return {
8201
+ width: width,
8202
+ height: height,
8203
+ };
8204
+ }
8199
8205
  return {
8200
- width: width,
8201
- height: height,
8206
+ width: 0,
8207
+ height: 0,
8202
8208
  };
8203
8209
  };
8204
8210
  return PolylineUpdater;
@@ -11897,8 +11903,16 @@ var Element = /** @class */ (function (_super) {
11897
11903
  this.appendChild(newChild);
11898
11904
  }
11899
11905
  else {
11906
+ if (newChild.parentElement) {
11907
+ newChild.parentElement.removeChild(newChild);
11908
+ }
11900
11909
  var index = this.childNodes.indexOf(refChild);
11901
- this.appendChild(newChild, index - 1);
11910
+ if (index === -1) {
11911
+ this.appendChild(newChild);
11912
+ }
11913
+ else {
11914
+ this.appendChild(newChild, index);
11915
+ }
11902
11916
  }
11903
11917
  return newChild;
11904
11918
  };
@@ -13650,9 +13664,10 @@ var Polygon = /** @class */ (function (_super) {
13650
13664
  }
13651
13665
  };
13652
13666
  Polygon.prototype.transformMarker = function (isStart) {
13653
- var _a = this.parsedStyle, markerStart = _a.markerStart, markerEnd = _a.markerEnd, markerStartOffset = _a.markerStartOffset, markerEndOffset = _a.markerEndOffset, points = _a.points.points, defX = _a.defX, defY = _a.defY;
13667
+ var _a = this.parsedStyle, markerStart = _a.markerStart, markerEnd = _a.markerEnd, markerStartOffset = _a.markerStartOffset, markerEndOffset = _a.markerEndOffset, P = _a.points, defX = _a.defX, defY = _a.defY;
13668
+ var points = (P || {}).points;
13654
13669
  var marker = isStart ? markerStart : markerEnd;
13655
- if (!marker || !isDisplayObject(marker)) {
13670
+ if (!marker || !isDisplayObject(marker) || !points) {
13656
13671
  return;
13657
13672
  }
13658
13673
  var rad = 0;
@@ -13691,13 +13706,14 @@ var Polygon = /** @class */ (function (_super) {
13691
13706
  marker.setLocalPosition(ox + Math.cos(rad) * offset, oy + Math.sin(rad) * offset);
13692
13707
  };
13693
13708
  Polygon.prototype.placeMarkerMid = function (marker) {
13694
- var _a = this.parsedStyle, points = _a.points.points, defX = _a.defX, defY = _a.defY;
13709
+ var _a = this.parsedStyle, P = _a.points, defX = _a.defX, defY = _a.defY;
13710
+ var points = (P || {}).points;
13695
13711
  // clear all existed markers
13696
13712
  this.markerMidList.forEach(function (marker) {
13697
13713
  marker.remove();
13698
13714
  });
13699
13715
  this.markerMidList = [];
13700
- if (marker && isDisplayObject(marker)) {
13716
+ if (marker && isDisplayObject(marker) && points) {
13701
13717
  for (var i = 1; i < (this.parsedStyle.isClosed ? points.length : points.length - 1); i++) {
13702
13718
  var ox = points[i][0] - defX;
13703
13719
  var oy = points[i][1] - defY;