@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.esm.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { __assign, __read, __extends, __spreadArray, __awaiter, __generator, __values, __rest } from 'tslib';
2
2
  import EventEmitter from 'eventemitter3';
3
3
  import { mat4, vec4, vec3, mat3, quat as quat$1, vec2 } from 'gl-matrix';
4
- import { isNumber, distanceSquareRoot, isString, isNil, clamp, getTotalLength, min, max, isNumberEqual, mod, normalizePath, path2Curve, equalizeSegments, getDrawDirection, reverseCurve, clonePath, getRotatedCurve, isBoolean, isObject, isUndefined, getPointAtLength } from '@antv/util';
4
+ import { isNumber, distanceSquareRoot, isString, isNil, clamp, getTotalLength, min, max, isNumberEqual, mod, normalizePath, path2Curve, equalizeSegments, getDrawDirection, reverseCurve, clonePath, getRotatedCurve, isArray, isBoolean, isObject, isUndefined, getPointAtLength } from '@antv/util';
5
5
  import * as d3 from 'd3-color';
6
6
  import { arcBox, cubicBox, quadBox, polylineLength, lineLength, linePointAt } from '@antv/g-math';
7
7
 
@@ -8167,17 +8167,23 @@ var PolylineUpdater = /** @class */ (function () {
8167
8167
  function PolylineUpdater() {
8168
8168
  }
8169
8169
  PolylineUpdater.prototype.update = function (parsedStyle) {
8170
- var points = parsedStyle.points.points;
8171
- // FIXME: account for miter lineJoin
8172
- var minX = Math.min.apply(Math, __spreadArray([], __read(points.map(function (point) { return point[0]; })), false));
8173
- var maxX = Math.max.apply(Math, __spreadArray([], __read(points.map(function (point) { return point[0]; })), false));
8174
- var minY = Math.min.apply(Math, __spreadArray([], __read(points.map(function (point) { return point[1]; })), false));
8175
- var maxY = Math.max.apply(Math, __spreadArray([], __read(points.map(function (point) { return point[1]; })), false));
8176
- var width = maxX - minX;
8177
- var height = maxY - minY;
8170
+ if (parsedStyle.points && isArray(parsedStyle.points.points)) {
8171
+ var points = parsedStyle.points.points;
8172
+ // FIXME: account for miter lineJoin
8173
+ var minX = Math.min.apply(Math, __spreadArray([], __read(points.map(function (point) { return point[0]; })), false));
8174
+ var maxX = Math.max.apply(Math, __spreadArray([], __read(points.map(function (point) { return point[0]; })), false));
8175
+ var minY = Math.min.apply(Math, __spreadArray([], __read(points.map(function (point) { return point[1]; })), false));
8176
+ var maxY = Math.max.apply(Math, __spreadArray([], __read(points.map(function (point) { return point[1]; })), false));
8177
+ var width = maxX - minX;
8178
+ var height = maxY - minY;
8179
+ return {
8180
+ width: width,
8181
+ height: height,
8182
+ };
8183
+ }
8178
8184
  return {
8179
- width: width,
8180
- height: height,
8185
+ width: 0,
8186
+ height: 0,
8181
8187
  };
8182
8188
  };
8183
8189
  return PolylineUpdater;
@@ -11876,8 +11882,16 @@ var Element = /** @class */ (function (_super) {
11876
11882
  this.appendChild(newChild);
11877
11883
  }
11878
11884
  else {
11885
+ if (newChild.parentElement) {
11886
+ newChild.parentElement.removeChild(newChild);
11887
+ }
11879
11888
  var index = this.childNodes.indexOf(refChild);
11880
- this.appendChild(newChild, index - 1);
11889
+ if (index === -1) {
11890
+ this.appendChild(newChild);
11891
+ }
11892
+ else {
11893
+ this.appendChild(newChild, index);
11894
+ }
11881
11895
  }
11882
11896
  return newChild;
11883
11897
  };
@@ -13629,9 +13643,10 @@ var Polygon = /** @class */ (function (_super) {
13629
13643
  }
13630
13644
  };
13631
13645
  Polygon.prototype.transformMarker = function (isStart) {
13632
- 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;
13646
+ 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;
13647
+ var points = (P || {}).points;
13633
13648
  var marker = isStart ? markerStart : markerEnd;
13634
- if (!marker || !isDisplayObject(marker)) {
13649
+ if (!marker || !isDisplayObject(marker) || !points) {
13635
13650
  return;
13636
13651
  }
13637
13652
  var rad = 0;
@@ -13670,13 +13685,14 @@ var Polygon = /** @class */ (function (_super) {
13670
13685
  marker.setLocalPosition(ox + Math.cos(rad) * offset, oy + Math.sin(rad) * offset);
13671
13686
  };
13672
13687
  Polygon.prototype.placeMarkerMid = function (marker) {
13673
- var _a = this.parsedStyle, points = _a.points.points, defX = _a.defX, defY = _a.defY;
13688
+ var _a = this.parsedStyle, P = _a.points, defX = _a.defX, defY = _a.defY;
13689
+ var points = (P || {}).points;
13674
13690
  // clear all existed markers
13675
13691
  this.markerMidList.forEach(function (marker) {
13676
13692
  marker.remove();
13677
13693
  });
13678
13694
  this.markerMidList = [];
13679
- if (marker && isDisplayObject(marker)) {
13695
+ if (marker && isDisplayObject(marker) && points) {
13680
13696
  for (var i = 1; i < (this.parsedStyle.isClosed ? points.length : points.length - 1); i++) {
13681
13697
  var ox = points[i][0] - defX;
13682
13698
  var oy = points[i][1] - defY;