@antv/g-lite 1.2.10 → 1.2.12

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
@@ -7724,6 +7752,7 @@ var TOUCH_TO_POINTER = {
7724
7752
  touchmove: 'pointermove',
7725
7753
  touchcancel: 'pointercancel',
7726
7754
  };
7755
+ var clock = typeof performance === 'object' && performance.now ? performance : Date;
7727
7756
 
7728
7757
  function isFillOrStrokeAffected(pointerEvents, fill, stroke) {
7729
7758
  // account for pointerEvents
@@ -9178,7 +9207,7 @@ var EventService = /** @class */ (function () {
9178
9207
  };
9179
9208
  this.onPointerUp = function (from) {
9180
9209
  var _a;
9181
- var now = performance.now();
9210
+ var now = clock.now();
9182
9211
  var e = _this.createPointerEvent(from, undefined, undefined, _this.context.config.alwaysTriggerPointerEventOnCanvas
9183
9212
  ? _this.rootTarget
9184
9213
  : undefined);
@@ -9775,7 +9804,7 @@ var EventService = /** @class */ (function () {
9775
9804
  };
9776
9805
  EventService.prototype.copyData = function (from, to) {
9777
9806
  to.isTrusted = from.isTrusted;
9778
- to.timeStamp = performance.now();
9807
+ to.timeStamp = clock.now();
9779
9808
  to.type = from.type;
9780
9809
  to.detail = from.detail;
9781
9810
  to.view = from.view;
@@ -14515,7 +14544,7 @@ var EventPlugin = /** @class */ (function () {
14515
14544
  EventPlugin.prototype.transferMouseData = function (event, nativeEvent) {
14516
14545
  event.isTrusted = nativeEvent.isTrusted;
14517
14546
  event.srcElement = nativeEvent.srcElement;
14518
- event.timeStamp = performance.now();
14547
+ event.timeStamp = clock.now();
14519
14548
  event.type = nativeEvent.type;
14520
14549
  event.altKey = nativeEvent.altKey;
14521
14550
  event.metaKey = nativeEvent.metaKey;