@antv/g-lite 1.3.0-next.4 → 1.3.0-next.6

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
@@ -4138,8 +4138,7 @@ function convertPercentUnit(valueWithUnit, vec3Index, target) {
4138
4138
  else if (valueWithUnit.unit === exports.UnitType.kPercentage && target) {
4139
4139
  var bounds = target.nodeName === exports.Shape.GROUP
4140
4140
  ? target.getLocalBounds()
4141
- : // : target.getGeometryBounds();
4142
- target.geometry.contentBounds;
4141
+ : target.getGeometryBounds();
4143
4142
  return (valueWithUnit.value / 100) * bounds.halfExtents[vec3Index] * 2;
4144
4143
  }
4145
4144
  return 0;
@@ -6728,7 +6727,9 @@ var DefaultStyleValueRegistry = /** @class */ (function () {
6728
6727
  this.runtime.CSSPropertySyntaxFactory['<transform>'].postProcessor(object, attributeNames_1);
6729
6728
  }
6730
6729
  if (needUpdateGeometry_1) {
6731
- this.updateGeometry(object);
6730
+ object.geometry.dirty = true;
6731
+ // FIXME setOrigin may have already dirtified to root.
6732
+ this.runtime.sceneGraphService.dirtifyToRoot(object);
6732
6733
  }
6733
6734
  return;
6734
6735
  }
@@ -6787,9 +6788,9 @@ var DefaultStyleValueRegistry = /** @class */ (function () {
6787
6788
  // }
6788
6789
  // update geometry
6789
6790
  if (needUpdateGeometry) {
6790
- // object.geometry.dirty = true;
6791
- // runtime.sceneGraphService.dirtifyToRoot(object);
6792
- this.updateGeometry(object);
6791
+ object.geometry.dirty = true;
6792
+ // FIXME setOrigin may have already dirtified to root.
6793
+ this.runtime.sceneGraphService.dirtifyToRoot(object);
6793
6794
  }
6794
6795
  attributeNames.forEach(function (name) {
6795
6796
  if (name in object.parsedStyle) {
@@ -7076,6 +7077,7 @@ var DefaultStyleValueRegistry = /** @class */ (function () {
7076
7077
  geometry_1.renderBounds.setMinMax(min, max);
7077
7078
  }
7078
7079
  });
7080
+ object.geometry.dirty = false;
7079
7081
  // if (nodeName === Shape.RECT) {
7080
7082
  // account for negative width / height of Rect
7081
7083
  // @see https://github.com/antvis/g/issues/957
@@ -7093,8 +7095,6 @@ var DefaultStyleValueRegistry = /** @class */ (function () {
7093
7095
  ? convertPercentUnit(transformOrigin[1], 1, object)
7094
7096
  : 0);
7095
7097
  object.setOrigin(cx - hwidth + usedOriginXValue, cy - hheight + usedOriginYValue);
7096
- // FIXME setOrigin may have already dirtified to root.
7097
- this.runtime.sceneGraphService.dirtifyToRoot(object);
7098
7098
  }
7099
7099
  };
7100
7100
  DefaultStyleValueRegistry.prototype.isPropertyInheritable = function (name) {
@@ -8790,7 +8790,7 @@ var EventTarget = /** @class */ (function () {
8790
8790
  var Node = /** @class */ (function (_super) {
8791
8791
  tslib.__extends(Node, _super);
8792
8792
  function Node() {
8793
- var _this = _super.apply(this, tslib.__spreadArray([], tslib.__read(arguments), false)) || this;
8793
+ var _this = _super.call(this) || this;
8794
8794
  _this.shadow = false;
8795
8795
  /**
8796
8796
  * points to canvas.document
@@ -10567,7 +10567,7 @@ var DefaultSceneGraphService = /** @class */ (function () {
10567
10567
  // .filter((node) => !node.shadow);
10568
10568
  };
10569
10569
  DefaultSceneGraphService.prototype.attach = function (child, parent, index) {
10570
- var _a, _b;
10570
+ var _a;
10571
10571
  var detached = false;
10572
10572
  if (child.parentNode) {
10573
10573
  detached = child.parentNode !== parent;
@@ -10583,7 +10583,7 @@ var DefaultSceneGraphService = /** @class */ (function () {
10583
10583
  // parent needs re-sort
10584
10584
  var sortable = parent.sortable;
10585
10585
  if (((_a = sortable === null || sortable === void 0 ? void 0 : sortable.sorted) === null || _a === void 0 ? void 0 : _a.length) ||
10586
- ((_b = child.style) === null || _b === void 0 ? void 0 : _b.zIndex)) {
10586
+ child.parsedStyle.zIndex) {
10587
10587
  if (sortable.dirtyChildren.indexOf(child) === -1) {
10588
10588
  sortable.dirtyChildren.push(child);
10589
10589
  }
@@ -10893,6 +10893,9 @@ var DefaultSceneGraphService = /** @class */ (function () {
10893
10893
  DefaultSceneGraphService.prototype.getGeometryBounds = function (element, render) {
10894
10894
  if (render === void 0) { render = false; }
10895
10895
  var geometry = element.geometry;
10896
+ if (geometry.dirty) {
10897
+ runtime.styleValueRegistry.updateGeometry(element);
10898
+ }
10896
10899
  var bounds = render
10897
10900
  ? geometry.renderBounds
10898
10901
  : geometry.contentBounds || null;
@@ -11577,7 +11580,7 @@ var destroyEvent = new CustomEvent(exports.ElementEvent.DESTROY);
11577
11580
  var Element = /** @class */ (function (_super) {
11578
11581
  tslib.__extends(Element, _super);
11579
11582
  function Element() {
11580
- var _this = _super.apply(this, tslib.__spreadArray([], tslib.__read(arguments), false)) || this;
11583
+ var _this = _super.call(this) || this;
11581
11584
  /**
11582
11585
  * Unique id.
11583
11586
  */
@@ -11621,6 +11624,7 @@ var Element = /** @class */ (function (_super) {
11621
11624
  _this.geometry = {
11622
11625
  contentBounds: undefined,
11623
11626
  renderBounds: undefined,
11627
+ dirty: true,
11624
11628
  };
11625
11629
  _this.rBushNode = {
11626
11630
  aabb: undefined,
@@ -11804,11 +11808,8 @@ var Element = /** @class */ (function (_super) {
11804
11808
  if ((_a = this.ownerDocument) === null || _a === void 0 ? void 0 : _a.defaultView) {
11805
11809
  this.ownerDocument.defaultView.mountChildren(child);
11806
11810
  }
11807
- // @ts-ignore
11808
- if (child.isMutationObserved) {
11809
- insertedEvent.relatedNode = this;
11810
- child.dispatchEvent(insertedEvent);
11811
- }
11811
+ insertedEvent.relatedNode = this;
11812
+ child.dispatchEvent(insertedEvent);
11812
11813
  return child;
11813
11814
  };
11814
11815
  Element.prototype.insertBefore = function (newChild, refChild) {
@@ -12250,8 +12251,6 @@ var DisplayObject = /** @class */ (function (_super) {
12250
12251
  // assign name, id to config
12251
12252
  // eg. group.get('name')
12252
12253
  _this.config = config;
12253
- // compatible with G 3.0
12254
- // this.config.interactive = this.config.capture ?? this.config.interactive;
12255
12254
  // init scene graph node
12256
12255
  _this.id = _this.config.id || '';
12257
12256
  _this.name = _this.config.name || '';
@@ -12259,23 +12258,6 @@ var DisplayObject = /** @class */ (function (_super) {
12259
12258
  _this.className = _this.config.className || _this.config.class;
12260
12259
  }
12261
12260
  _this.nodeName = _this.config.type || exports.Shape.GROUP;
12262
- // // compatible with G 3.0
12263
- // this.config.style =
12264
- // this.config.style || this.config.attrs || ({} as StyleProps);
12265
- // // Object.assign(this.config.style, this.config.attrs);
12266
- // // this.config.style = {
12267
- // // // ...DEFAULT_STYLE_PROPS,
12268
- // // ...this.config.style,
12269
- // // ...this.config.attrs,
12270
- // // };
12271
- // if (this.config.visible != null) {
12272
- // this.config.style.visibility =
12273
- // this.config.visible === false ? 'hidden' : 'visible';
12274
- // }
12275
- // if (this.config.interactive != null) {
12276
- // this.config.style.pointerEvents =
12277
- // this.config.interactive === false ? 'none' : 'auto';
12278
- // }
12279
12261
  // merge parsed value
12280
12262
  Object.assign(_this.parsedStyle, runtime.enableCSSParsing
12281
12263
  ? DEFAULT_PARSED_STYLE_PROPS
@@ -13035,7 +13017,7 @@ var Circle = /** @class */ (function (_super) {
13035
13017
  if (_a === void 0) { _a = {}; }
13036
13018
  var style = _a.style, rest = tslib.__rest(_a, ["style"]);
13037
13019
  return _super.call(this, tslib.__assign({ type: exports.Shape.CIRCLE, style: runtime.enableCSSParsing
13038
- ? tslib.__assign({ cx: '', cy: '', r: '' }, style) : tslib.__assign({}, style), initialParsedStyle: {
13020
+ ? tslib.__assign({ cx: '', cy: '', r: '' }, style) : style, initialParsedStyle: {
13039
13021
  transformOrigin: runtime.enableCSSParsing
13040
13022
  ? null
13041
13023
  : [PECENTAGE_50, PECENTAGE_50],
@@ -13072,7 +13054,7 @@ var Ellipse = /** @class */ (function (_super) {
13072
13054
  if (_a === void 0) { _a = {}; }
13073
13055
  var style = _a.style, rest = tslib.__rest(_a, ["style"]);
13074
13056
  return _super.call(this, tslib.__assign({ type: exports.Shape.ELLIPSE, style: runtime.enableCSSParsing
13075
- ? tslib.__assign({ cx: '', cy: '', rx: '', ry: '' }, style) : tslib.__assign({}, style), initialParsedStyle: {
13057
+ ? tslib.__assign({ cx: '', cy: '', rx: '', ry: '' }, style) : style, initialParsedStyle: {
13076
13058
  transformOrigin: runtime.enableCSSParsing
13077
13059
  ? null
13078
13060
  : [PECENTAGE_50, PECENTAGE_50],