@antv/g-lite 1.0.47 → 1.0.48

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.umd.js CHANGED
@@ -11264,7 +11264,8 @@
11264
11264
  // });
11265
11265
  var parseLengthOrPercentage = function parseLengthOrPercentage(css) {
11266
11266
  if (isNumber(css) || isFinite(Number(css))) {
11267
- return getOrCreateUnitValue(Number(css), 'px');
11267
+ // Number(css) is NaN
11268
+ return getOrCreateUnitValue(Number(css) || 0, 'px');
11268
11269
  // return Number(css);
11269
11270
  }
11270
11271
 
@@ -11630,6 +11631,11 @@
11630
11631
  segments: segments
11631
11632
  };
11632
11633
  }
11634
+ function mergePoints(left, right) {
11635
+ return [left.points, right.points, function (points) {
11636
+ return points;
11637
+ }];
11638
+ }
11633
11639
 
11634
11640
  var _ = null;
11635
11641
  function cast(pattern) {
@@ -12957,6 +12963,7 @@
12957
12963
  var CSSPropertyPoints = /*#__PURE__*/function () {
12958
12964
  function CSSPropertyPoints() {
12959
12965
  this.parser = parsePoints;
12966
+ this.mixer = mergePoints;
12960
12967
  }
12961
12968
  var _proto = CSSPropertyPoints.prototype;
12962
12969
  /**
@@ -14608,7 +14615,6 @@
14608
14615
  renderOrder: 0
14609
14616
  };
14610
14617
  _this.geometry = {
14611
- dirty: false,
14612
14618
  contentBounds: undefined,
14613
14619
  renderBounds: undefined
14614
14620
  };
@@ -15419,6 +15425,7 @@
15419
15425
  }
15420
15426
  // start to process attributes
15421
15427
  _this.initAttributes(_this.config.style);
15428
+ var Proxy = runtime.globalThis.Proxy ? runtime.globalThis.Proxy : function () {};
15422
15429
  _this.dataset = new Proxy({}, {
15423
15430
  get: function get(target, name) {
15424
15431
  var formattedName = "" + DATASET_PREFIX + kebabize(name);
@@ -17054,7 +17061,6 @@
17054
17061
  var _proto = Text.prototype;
17055
17062
  _proto.getComputedTextLength = function getComputedTextLength() {
17056
17063
  var _this$parsedStyle$met;
17057
- this.forceUpdateGeometry();
17058
17064
  return ((_this$parsedStyle$met = this.parsedStyle.metrics) === null || _this$parsedStyle$met === void 0 ? void 0 : _this$parsedStyle$met.maxLineWidth) || 0;
17059
17065
  }
17060
17066
  // getEndPositionOfChar(charnum: number): DOMPoint {
@@ -17081,18 +17087,11 @@
17081
17087
  ;
17082
17088
  _proto.getLineBoundingRects = function getLineBoundingRects() {
17083
17089
  var _this$parsedStyle$met2;
17084
- this.forceUpdateGeometry();
17085
17090
  return ((_this$parsedStyle$met2 = this.parsedStyle.metrics) === null || _this$parsedStyle$met2 === void 0 ? void 0 : _this$parsedStyle$met2.lineMetrics) || [];
17086
17091
  };
17087
17092
  _proto.isOverflowing = function isOverflowing() {
17088
- this.forceUpdateGeometry();
17089
17093
  return !!this.parsedStyle.isOverflowing;
17090
17094
  };
17091
- _proto.forceUpdateGeometry = function forceUpdateGeometry() {
17092
- if (!this.parsedStyle.metrics) {
17093
- runtime.styleValueRegistry.updateGeometry(this);
17094
- }
17095
- };
17096
17095
  return Text;
17097
17096
  }(DisplayObject);
17098
17097
 
@@ -17456,6 +17455,10 @@
17456
17455
  // Polyline & Polygon
17457
17456
  {
17458
17457
  n: 'points',
17458
+ /**
17459
+ * support interpolation
17460
+ */
17461
+ int: true,
17459
17462
  l: true,
17460
17463
  syntax: exports.PropertySyntax.LIST_OF_POINTS,
17461
17464
  p: 50
@@ -17824,8 +17827,7 @@
17824
17827
  runtime.CSSPropertySyntaxFactory['<transform>'].postProcessor(object, _attributeNames);
17825
17828
  }
17826
17829
  if (_needUpdateGeometry) {
17827
- object.geometry.dirty = true;
17828
- runtime.sceneGraphService.dirtifyToRoot(object);
17830
+ this.updateGeometry(object);
17829
17831
  }
17830
17832
  return;
17831
17833
  }
@@ -17891,8 +17893,9 @@
17891
17893
  // }
17892
17894
  // update geometry
17893
17895
  if (needUpdateGeometry) {
17894
- object.geometry.dirty = true;
17895
- runtime.sceneGraphService.dirtifyToRoot(object);
17896
+ // object.geometry.dirty = true;
17897
+ // runtime.sceneGraphService.dirtifyToRoot(object);
17898
+ this.updateGeometry(object);
17896
17899
  }
17897
17900
  attributeNames.forEach(function (name) {
17898
17901
  if (name in object.parsedStyle) {
@@ -18191,7 +18194,6 @@
18191
18194
  }
18192
18195
  });
18193
18196
  anchor = parsedStyle.anchor;
18194
- geometry.dirty = false;
18195
18197
  // if (nodeName === Shape.RECT) {
18196
18198
  // account for negative width / height of Rect
18197
18199
  // @see https://github.com/antvis/g/issues/957
@@ -18206,7 +18208,7 @@
18206
18208
  usedOriginYValue = usedOriginYValue - (flipX ? -1 : 1) * (anchor && anchor[1] || 0) * geometry.contentBounds.halfExtents[1] * 2;
18207
18209
  object.setOrigin(usedOriginXValue, usedOriginYValue);
18208
18210
  // FIXME setOrigin may have already dirtified to root.
18209
- // runtime.sceneGraphService.dirtifyToRoot(object);
18211
+ runtime.sceneGraphService.dirtifyToRoot(object);
18210
18212
  }
18211
18213
  };
18212
18214
  _proto.isPropertyInheritable = function isPropertyInheritable(name) {
@@ -21041,9 +21043,6 @@
21041
21043
  render = false;
21042
21044
  }
21043
21045
  var geometry = element.geometry;
21044
- if (geometry.dirty) {
21045
- runtime.styleValueRegistry.updateGeometry(element);
21046
- }
21047
21046
  var bounds = render ? geometry.renderBounds : geometry.contentBounds || null;
21048
21047
  // return (bounds && new AABB(bounds.center, bounds.halfExtents)) || new AABB();
21049
21048
  return bounds || new AABB();
@@ -21362,19 +21361,19 @@
21362
21361
  leading = _parsedStyle$leading === void 0 ? 0 : _parsedStyle$leading;
21363
21362
  var font = toFontString(parsedStyle);
21364
21363
  var fontProperties;
21365
- if (runtime.enableCSSParsing) {
21366
- fontProperties = this.measureFont(font, offscreenCanvas);
21367
- // fallback in case UA disallow canvas data extraction
21368
- // (toDataURI, getImageData functions)
21369
- if (fontProperties.fontSize === 0) {
21370
- fontProperties.fontSize = fontSize;
21371
- fontProperties.ascent = fontSize;
21372
- }
21373
- } else {
21374
- fontProperties = {
21375
- fontSize: fontSize
21376
- };
21377
- }
21364
+ // if (runtime.enableCSSParsing) {
21365
+ fontProperties = this.measureFont(font, offscreenCanvas);
21366
+ // fallback in case UA disallow canvas data extraction
21367
+ // (toDataURI, getImageData functions)
21368
+ if (fontProperties.fontSize === 0) {
21369
+ fontProperties.fontSize = fontSize;
21370
+ fontProperties.ascent = fontSize;
21371
+ }
21372
+ // } else {
21373
+ // fontProperties = {
21374
+ // fontSize,
21375
+ // };
21376
+ // }
21378
21377
  var context = this.runtime.offscreenCanvas.getOrCreateContext(offscreenCanvas);
21379
21378
  context.font = font;
21380
21379
  // no overflowing by default