@antv/g 5.6.0-alpha.0 → 5.6.2

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
@@ -9077,6 +9077,10 @@ function mergeTransforms(left, right, target) {
9077
9077
 
9078
9078
  function parseTransformOrigin(value) {
9079
9079
  if (isString(value)) {
9080
+ if (value === 'text-anchor') {
9081
+ return [new CSSUnitValue(0, 'px'), new CSSUnitValue(0, 'px')];
9082
+ }
9083
+
9080
9084
  var values = value.split(' ');
9081
9085
 
9082
9086
  if (values.length === 1) {
@@ -10632,7 +10636,8 @@ var DEFAULT_STYLE_PROPS = {
10632
10636
  textBaseline: '',
10633
10637
  textTransform: '',
10634
10638
  zIndex: '',
10635
- filter: ''
10639
+ filter: '',
10640
+ shadowType: ''
10636
10641
  };
10637
10642
  /**
10638
10643
  * prototype chains: DisplayObject -> Element -> Node -> EventTarget
@@ -11722,7 +11727,7 @@ var Path = /*#__PURE__*/function (_DisplayObject) {
11722
11727
  type: Shape.PATH,
11723
11728
  style: _extends({
11724
11729
  path: '',
11725
- miterLimit: 4
11730
+ miterLimit: ''
11726
11731
  }, style)
11727
11732
  }, rest)) || this;
11728
11733
  }
@@ -11823,7 +11828,7 @@ var Polygon = /*#__PURE__*/function (_DisplayObject) {
11823
11828
  type: Shape.POLYGON,
11824
11829
  style: _extends({
11825
11830
  points: '',
11826
- miterLimit: 4
11831
+ miterLimit: ''
11827
11832
  }, style)
11828
11833
  }, rest)) || this;
11829
11834
  }
@@ -11844,7 +11849,7 @@ var Polyline = /*#__PURE__*/function (_DisplayObject) {
11844
11849
  type: Shape.POLYLINE,
11845
11850
  style: _extends({
11846
11851
  points: '',
11847
- miterLimit: 4
11852
+ miterLimit: ''
11848
11853
  }, style)
11849
11854
  }, rest)) || this;
11850
11855
  }
@@ -11935,14 +11940,15 @@ var Text = /*#__PURE__*/function (_DisplayObject) {
11935
11940
  /**
11936
11941
  * @see https://developer.mozilla.org/en-US/docs/Web/API/SVGTextContentElement#constants
11937
11942
  */
11943
+ // LENGTHADJUST_SPACING: number = 1;
11944
+ // LENGTHADJUST_SPACINGANDGLYPHS: number = 2;
11945
+ // LENGTHADJUST_UNKNOWN: number = 0;
11938
11946
  function Text(_temp) {
11939
- var _this;
11940
-
11941
11947
  var _ref = _temp === void 0 ? {} : _temp,
11942
11948
  style = _ref.style,
11943
11949
  rest = _objectWithoutPropertiesLoose(_ref, _excluded$a);
11944
11950
 
11945
- _this = _DisplayObject.call(this, _extends({
11951
+ return _DisplayObject.call(this, _extends({
11946
11952
  type: Shape.TEXT,
11947
11953
  style: _extends({
11948
11954
  x: '',
@@ -11956,17 +11962,10 @@ var Text = /*#__PURE__*/function (_DisplayObject) {
11956
11962
  textAlign: '',
11957
11963
  textBaseline: '',
11958
11964
  textTransform: '',
11959
- // dropShadow: false,
11960
- // dropShadowAlpha: 1,
11961
- // dropShadowAngle: Math.PI / 6,
11962
- // dropShadowBlur: 0,
11963
- // dropShadowColor: '#000',
11964
- // dropShadowDistance: 5,
11965
11965
  fill: 'black',
11966
- // stroke: 'black',
11967
- letterSpacing: 0,
11968
- lineHeight: 0,
11969
- miterLimit: 10,
11966
+ letterSpacing: '',
11967
+ lineHeight: '',
11968
+ miterLimit: '',
11970
11969
  whiteSpace: 'pre',
11971
11970
  wordWrap: false,
11972
11971
  wordWrapWidth: 0,
@@ -11975,57 +11974,45 @@ var Text = /*#__PURE__*/function (_DisplayObject) {
11975
11974
  dy: ''
11976
11975
  }, style)
11977
11976
  }, rest)) || this;
11978
- _this.LENGTHADJUST_SPACING = 1;
11979
- _this.LENGTHADJUST_SPACINGANDGLYPHS = 2;
11980
- _this.LENGTHADJUST_UNKNOWN = 0;
11981
- _this.lengthAdjust = void 0;
11982
- _this.textLength = void 0;
11983
- return _this;
11984
- }
11985
-
11986
- var _proto = Text.prototype;
11977
+ } // lengthAdjust: SVGAnimatedEnumeration;
11978
+ // textLength: SVGAnimatedLength;
11979
+ // getCharNumAtPosition(point?: DOMPointInit): number {
11980
+ // throw new Error('Method not implemented.');
11981
+ // }
11987
11982
 
11988
- _proto.getCharNumAtPosition = function getCharNumAtPosition(point) {
11989
- throw new Error('Method not implemented.');
11990
- }
11991
11983
  /**
11992
11984
  * @see https://developer.mozilla.org/en-US/docs/Web/API/SVGTextContentElement
11993
11985
  */
11994
- ;
11986
+
11987
+
11988
+ var _proto = Text.prototype;
11995
11989
 
11996
11990
  _proto.getComputedTextLength = function getComputedTextLength() {
11997
11991
  var _this$parsedStyle$met;
11998
11992
 
11999
11993
  return ((_this$parsedStyle$met = this.parsedStyle.metrics) === null || _this$parsedStyle$met === void 0 ? void 0 : _this$parsedStyle$met.maxLineWidth) || 0;
12000
- };
12001
-
12002
- _proto.getEndPositionOfChar = function getEndPositionOfChar(charnum) {
12003
- throw new Error('Method not implemented.');
12004
- };
12005
-
12006
- _proto.getExtentOfChar = function getExtentOfChar(charnum) {
12007
- throw new Error('Method not implemented.');
12008
- };
12009
-
12010
- _proto.getNumberOfChars = function getNumberOfChars() {
12011
- throw new Error('Method not implemented.');
12012
- };
12013
-
12014
- _proto.getRotationOfChar = function getRotationOfChar(charnum) {
12015
- throw new Error('Method not implemented.');
12016
- };
12017
-
12018
- _proto.getStartPositionOfChar = function getStartPositionOfChar(charnum) {
12019
- throw new Error('Method not implemented.');
12020
- };
12021
-
12022
- _proto.getSubStringLength = function getSubStringLength(charnum, nchars) {
12023
- throw new Error('Method not implemented.');
12024
- };
12025
-
12026
- _proto.selectSubString = function selectSubString(charnum, nchars) {
12027
- throw new Error('Method not implemented.');
12028
- };
11994
+ } // getEndPositionOfChar(charnum: number): DOMPoint {
11995
+ // throw new Error('Method not implemented.');
11996
+ // }
11997
+ // getExtentOfChar(charnum: number): DOMRect {
11998
+ // throw new Error('Method not implemented.');
11999
+ // }
12000
+ // getNumberOfChars(): number {
12001
+ // throw new Error('Method not implemented.');
12002
+ // }
12003
+ // getRotationOfChar(charnum: number): number {
12004
+ // throw new Error('Method not implemented.');
12005
+ // }
12006
+ // getStartPositionOfChar(charnum: number): DOMPoint {
12007
+ // throw new Error('Method not implemented.');
12008
+ // }
12009
+ // getSubStringLength(charnum: number, nchars: number): number {
12010
+ // throw new Error('Method not implemented.');
12011
+ // }
12012
+ // selectSubString(charnum: number, nchars: number): void {
12013
+ // throw new Error('Method not implemented.');
12014
+ // }
12015
+ ;
12029
12016
 
12030
12017
  _proto.getLineBoundingRects = function getLineBoundingRects() {
12031
12018
  var _this$parsedStyle$met2;
@@ -12967,7 +12954,9 @@ var Document = /*#__PURE__*/function (_Node) {
12967
12954
  clazz = tagName === 'tspan' ? Text : Group;
12968
12955
  }
12969
12956
 
12970
- return new clazz(options);
12957
+ var shape = new clazz(options);
12958
+ shape.ownerDocument = this;
12959
+ return shape;
12971
12960
  };
12972
12961
 
12973
12962
  _proto.createElementNS = function createElementNS(namespaceURI, tagName, options) {
@@ -13274,6 +13263,16 @@ var FederatedMouseEvent = /*#__PURE__*/function (_FederatedEvent) {
13274
13263
  get: function get() {
13275
13264
  return this.client.y;
13276
13265
  }
13266
+ }, {
13267
+ key: "x",
13268
+ get: function get() {
13269
+ return this.clientX;
13270
+ }
13271
+ }, {
13272
+ key: "y",
13273
+ get: function get() {
13274
+ return this.clientY;
13275
+ }
13277
13276
  /**
13278
13277
  * The movement in this pointer relative to the last `mousemove` event.
13279
13278
  */
@@ -16632,20 +16631,15 @@ var RenderingService = /*#__PURE__*/function () {
16632
16631
 
16633
16632
  if (this.renderingContext.renderReasons.size && this.inited) {
16634
16633
  this.renderDisplayObject(this.renderingContext.root, canvasConfig);
16634
+ this.hooks.beginFrame.call();
16635
+ this.renderingContext.renderListCurrentFrame.forEach(function (object) {
16636
+ _this2.hooks.beforeRender.call(object);
16635
16637
 
16636
- if (this.renderingContext.renderListCurrentFrame.length || this.renderingContext.renderListLastFrame.length !== this.renderingContext.renderListCurrentFrame.length) {
16637
- this.hooks.beginFrame.call();
16638
- this.renderingContext.renderListCurrentFrame.forEach(function (object) {
16639
- _this2.hooks.beforeRender.call(object);
16640
-
16641
- _this2.hooks.render.call(object);
16642
-
16643
- _this2.hooks.afterRender.call(object);
16644
- });
16645
- this.hooks.endFrame.call();
16646
- }
16638
+ _this2.hooks.render.call(object);
16647
16639
 
16648
- this.renderingContext.renderListLastFrame = [].concat(this.renderingContext.renderListCurrentFrame);
16640
+ _this2.hooks.afterRender.call(object);
16641
+ });
16642
+ this.hooks.endFrame.call();
16649
16643
  this.renderingContext.renderListCurrentFrame = [];
16650
16644
  this.renderingContext.renderReasons.clear();
16651
16645
  } // console.log('stats', this.stats);
@@ -16806,7 +16800,7 @@ var EventService = /*#__PURE__*/function (_EventEmitter) {
16806
16800
 
16807
16801
  _this.onPointerUp = /*#__PURE__*/function () {
16808
16802
  var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(from) {
16809
- var now, e, isRightButton, trackingData, pressTarget, clickTarget, currentTarget, _isRightButton, clickEvent, clickHistory;
16803
+ var now, e, isRightButton, trackingData, pressTarget, clickTarget, currentTarget, _isRightButton, _e$detail, clickEvent, clickHistory;
16810
16804
 
16811
16805
  return _regeneratorRuntime().wrap(function _callee2$(_context2) {
16812
16806
  while (1) {
@@ -16892,12 +16886,14 @@ var EventService = /*#__PURE__*/function (_EventEmitter) {
16892
16886
 
16893
16887
  clickHistory.target = clickEvent.target;
16894
16888
  clickHistory.timeStamp = now;
16895
- clickEvent.detail = clickHistory.clickCount;
16889
+ clickEvent.detail = clickHistory.clickCount; // @see https://github.com/antvis/G/issues/1091
16896
16890
 
16897
- if (clickEvent.pointerType === 'mouse' || clickEvent.pointerType === 'touch') {
16898
- _this.dispatchEvent(clickEvent, 'click');
16899
- } else {
16900
- _this.dispatchEvent(clickEvent, 'pointertap');
16891
+ if (!((_e$detail = e.detail) === null || _e$detail === void 0 ? void 0 : _e$detail.preventClick)) {
16892
+ if (clickEvent.pointerType === 'mouse' || clickEvent.pointerType === 'touch') {
16893
+ _this.dispatchEvent(clickEvent, 'click');
16894
+ } else {
16895
+ _this.dispatchEvent(clickEvent, 'pointertap');
16896
+ }
16901
16897
  }
16902
16898
 
16903
16899
  _this.freeEvent(clickEvent);
@@ -18141,13 +18137,11 @@ var TextService = /*#__PURE__*/function () {
18141
18137
  _proto.measureText = function measureText(text, parsedStyle, offscreenCanvas) {
18142
18138
  var fontSize = parsedStyle.fontSize,
18143
18139
  wordWrap = parsedStyle.wordWrap,
18144
- _parsedStyle$lineHeig = parsedStyle.lineHeight,
18145
- strokeHeight = _parsedStyle$lineHeig === void 0 ? 0 : _parsedStyle$lineHeig,
18140
+ strokeHeight = parsedStyle.lineHeight,
18146
18141
  lineWidth = parsedStyle.lineWidth,
18147
18142
  textBaseline = parsedStyle.textBaseline,
18148
18143
  textAlign = parsedStyle.textAlign,
18149
- _parsedStyle$letterSp = parsedStyle.letterSpacing,
18150
- letterSpacing = _parsedStyle$letterSp === void 0 ? 0 : _parsedStyle$letterSp,
18144
+ letterSpacing = parsedStyle.letterSpacing,
18151
18145
  _parsedStyle$leading = parsedStyle.leading,
18152
18146
  leading = _parsedStyle$leading === void 0 ? 0 : _parsedStyle$leading;
18153
18147
  var font = toFontString(parsedStyle);
@@ -18167,7 +18161,7 @@ var TextService = /*#__PURE__*/function () {
18167
18161
  var maxLineWidth = 0;
18168
18162
 
18169
18163
  for (var i = 0; i < lines.length; i++) {
18170
- var _lineWidth = context.measureText(lines[i]).width + (lines[i].length - 1) * letterSpacing;
18164
+ var _lineWidth = context.measureText(lines[i]).width + (lines[i].length - 1) * letterSpacing.value;
18171
18165
 
18172
18166
  lineWidths[i] = _lineWidth;
18173
18167
  maxLineWidth = Math.max(maxLineWidth, _lineWidth);
@@ -18177,7 +18171,7 @@ var TextService = /*#__PURE__*/function () {
18177
18171
  // width += dropShadowDistance;
18178
18172
  // }
18179
18173
 
18180
- var lineHeight = strokeHeight || fontProperties.fontSize + lineWidth.value;
18174
+ var lineHeight = strokeHeight.value || fontProperties.fontSize + lineWidth.value;
18181
18175
  var height = Math.max(lineHeight, fontProperties.fontSize + lineWidth.value) + (lines.length - 1) * (lineHeight + leading); // if (dropShadow) {
18182
18176
  // height += dropShadowDistance;
18183
18177
  // }
@@ -18222,17 +18216,16 @@ var TextService = /*#__PURE__*/function () {
18222
18216
 
18223
18217
  var _ref$wordWrapWidth = _ref.wordWrapWidth,
18224
18218
  wordWrapWidth = _ref$wordWrapWidth === void 0 ? 0 : _ref$wordWrapWidth,
18225
- _ref$letterSpacing = _ref.letterSpacing,
18226
- letterSpacing = _ref$letterSpacing === void 0 ? 0 : _ref$letterSpacing;
18219
+ letterSpacing = _ref.letterSpacing;
18227
18220
  var context = this.offscreenCanvas.getOrCreateContext(offscreenCanvas);
18228
- var maxWidth = wordWrapWidth + letterSpacing;
18221
+ var maxWidth = wordWrapWidth + letterSpacing.value;
18229
18222
  var lines = [];
18230
18223
  var currentIndex = 0;
18231
18224
  var currentWidth = 0;
18232
18225
  var cache = {};
18233
18226
 
18234
18227
  var calcWidth = function calcWidth(char) {
18235
- return _this2.getFromCache(char, letterSpacing, cache, context);
18228
+ return _this2.getFromCache(char, letterSpacing.value, cache, context);
18236
18229
  };
18237
18230
 
18238
18231
  Array.from(text).forEach(function (char, i) {
@@ -18817,7 +18810,7 @@ function getFontSize(object) {
18817
18810
  return fontSize.clone();
18818
18811
  }
18819
18812
 
18820
- return new CSSUnitValue(0, 'px');
18813
+ return null;
18821
18814
  }
18822
18815
  /**
18823
18816
  * <length> & <percentage>
@@ -18845,8 +18838,13 @@ var CSSPropertyLengthOrPercentage = /*#__PURE__*/function () {
18845
18838
  } else if (computed.unit === UnitType.kEms) {
18846
18839
  if (object.parentNode) {
18847
18840
  var fontSize = getFontSize(object.parentNode);
18848
- fontSize.value *= computed.value;
18849
- return fontSize;
18841
+
18842
+ if (fontSize) {
18843
+ fontSize.value *= computed.value;
18844
+ return fontSize;
18845
+ } else {
18846
+ registry.addUnresolveProperty(object, name);
18847
+ }
18850
18848
  }
18851
18849
 
18852
18850
  return new CSSUnitValue(0, 'px');
@@ -18856,8 +18854,12 @@ var CSSPropertyLengthOrPercentage = /*#__PURE__*/function () {
18856
18854
  if (object === null || object === void 0 ? void 0 : (_object$ownerDocument = object.ownerDocument) === null || _object$ownerDocument === void 0 ? void 0 : _object$ownerDocument.documentElement) {
18857
18855
  var _fontSize = getFontSize(object.ownerDocument.documentElement);
18858
18856
 
18859
- _fontSize.value *= computed.value;
18860
- return _fontSize;
18857
+ if (_fontSize) {
18858
+ _fontSize.value *= computed.value;
18859
+ return _fontSize;
18860
+ } else {
18861
+ registry.addUnresolveProperty(object, name);
18862
+ }
18861
18863
  }
18862
18864
 
18863
18865
  return new CSSUnitValue(0, 'px');
@@ -19016,7 +19018,11 @@ var CSSPropertyLocalPosition = /*#__PURE__*/function (_CSSPropertyLengthOrP) {
19016
19018
  z = 0;
19017
19019
  break;
19018
19020
 
19019
- default:
19021
+ case Shape.RECT:
19022
+ case Shape.IMAGE:
19023
+ case Shape.GROUP:
19024
+ case Shape.HTML:
19025
+ case Shape.TEXT:
19020
19026
  if (!isNil(object.parsedStyle.x)) {
19021
19027
  x = object.parsedStyle.x.value;
19022
19028
  }
@@ -19028,15 +19034,21 @@ var CSSPropertyLocalPosition = /*#__PURE__*/function (_CSSPropertyLengthOrP) {
19028
19034
  break;
19029
19035
  }
19030
19036
 
19031
- object.parsedStyle.defX = x || 0;
19032
- object.parsedStyle.defY = y || 0;
19037
+ if (object.nodeName !== Shape.PATH && object.nodeName !== Shape.POLYLINE && object.nodeName !== Shape.POLYGON) {
19038
+ object.parsedStyle.defX = x || 0;
19039
+ object.parsedStyle.defY = y || 0;
19040
+ }
19041
+
19042
+ var needResetLocalPosition = !isNil(x) || !isNil(y) || !isNil(z);
19033
19043
 
19034
- var _object$getLocalPosit = object.getLocalPosition(),
19035
- ox = _object$getLocalPosit[0],
19036
- oy = _object$getLocalPosit[1],
19037
- oz = _object$getLocalPosit[2];
19044
+ if (needResetLocalPosition) {
19045
+ var _object$getLocalPosit = object.getLocalPosition(),
19046
+ ox = _object$getLocalPosit[0],
19047
+ oy = _object$getLocalPosit[1],
19048
+ oz = _object$getLocalPosit[2];
19038
19049
 
19039
- object.setLocalPosition(isNil(x) ? ox : x, isNil(y) ? oy : y, isNil(z) ? oz : z);
19050
+ object.setLocalPosition(isNil(x) ? ox : x, isNil(y) ? oy : y, isNil(z) ? oz : z);
19051
+ }
19040
19052
  };
19041
19053
 
19042
19054
  return CSSPropertyLocalPosition;
@@ -19603,6 +19615,11 @@ var BUILT_IN_PROPERTIES = [{
19603
19615
  keywords: ['none'],
19604
19616
  defaultValue: 'none',
19605
19617
  syntax: PropertySyntax.PAINT
19618
+ }, {
19619
+ name: 'shadowType',
19620
+ keywords: ['inner', 'outer', 'both'],
19621
+ defaultValue: 'outer',
19622
+ layoutDependent: true
19606
19623
  }, {
19607
19624
  name: 'shadowColor',
19608
19625
  interpolable: true,
@@ -19739,6 +19756,10 @@ var BUILT_IN_PROPERTIES = [{
19739
19756
  return 'center';
19740
19757
  }
19741
19758
 
19759
+ if (nodeName === Shape.TEXT) {
19760
+ return 'text-anchor';
19761
+ }
19762
+
19742
19763
  return 'left top';
19743
19764
  },
19744
19765
  layoutDependent: true,
@@ -19869,12 +19890,14 @@ var BUILT_IN_PROPERTIES = [{
19869
19890
  layoutDependent: true,
19870
19891
  defaultValue: '',
19871
19892
  alias: ['d'],
19872
- syntax: PropertySyntax.PATH
19893
+ syntax: PropertySyntax.PATH,
19894
+ parsePriority: 50
19873
19895
  }, // Polyline & Polygon
19874
19896
  {
19875
19897
  name: 'points',
19876
19898
  layoutDependent: true,
19877
- syntax: PropertySyntax.LIST_OF_POINTS
19899
+ syntax: PropertySyntax.LIST_OF_POINTS,
19900
+ parsePriority: 50
19878
19901
  }, // Text
19879
19902
  {
19880
19903
  name: 'text',
@@ -19930,16 +19953,27 @@ var BUILT_IN_PROPERTIES = [{
19930
19953
  defaultValue: 'normal'
19931
19954
  }, {
19932
19955
  name: 'lineHeight',
19933
- layoutDependent: true // interpolable: true,
19934
- // inherited: true,
19935
- // defaultValue: '-100%'
19936
-
19956
+ layoutDependent: true,
19957
+ syntax: PropertySyntax.LENGTH,
19958
+ interpolable: true,
19959
+ defaultValue: '0'
19937
19960
  }, {
19938
19961
  name: 'letterSpacing',
19939
- layoutDependent: true // interpolable: true,
19940
- // inherited: true,
19941
- // defaultValue: '0',
19962
+ layoutDependent: true,
19963
+ syntax: PropertySyntax.LENGTH,
19964
+ interpolable: true,
19965
+ defaultValue: '0'
19966
+ }, {
19967
+ name: 'miterLimit',
19968
+ layoutDependent: true,
19969
+ syntax: PropertySyntax.NUMBER,
19970
+ defaultValue: function defaultValue(nodeName) {
19971
+ if (nodeName === Shape.PATH || nodeName === Shape.POLYGON || nodeName === Shape.POLYLINE) {
19972
+ return '4';
19973
+ }
19942
19974
 
19975
+ return '10';
19976
+ }
19943
19977
  }, {
19944
19978
  name: 'wordWrap',
19945
19979
  layoutDependent: true
@@ -20335,6 +20369,7 @@ var DefaultStyleValueRegistry = /*#__PURE__*/function () {
20335
20369
  var stroke = parsedStyle.stroke,
20336
20370
  lineWidth = parsedStyle.lineWidth,
20337
20371
  increasedLineWidthForHitTesting = parsedStyle.increasedLineWidthForHitTesting,
20372
+ shadowType = parsedStyle.shadowType,
20338
20373
  shadowColor = parsedStyle.shadowColor,
20339
20374
  _parsedStyle$filter = parsedStyle.filter,
20340
20375
  filter = _parsedStyle$filter === void 0 ? [] : _parsedStyle$filter,
@@ -20366,7 +20401,7 @@ var DefaultStyleValueRegistry = /*#__PURE__*/function () {
20366
20401
 
20367
20402
  geometry.renderBounds.update(center, halfExtents); // account for shadow, only support constant value now
20368
20403
 
20369
- if (shadowColor) {
20404
+ if (shadowColor && (shadowType === null || shadowType === void 0 ? void 0 : shadowType.value) !== 'inner') {
20370
20405
  var _geometry$renderBound = geometry.renderBounds,
20371
20406
  min = _geometry$renderBound.min,
20372
20407
  max = _geometry$renderBound.max;
@@ -20618,6 +20653,9 @@ var containerModule = Module(function (register) {
20618
20653
  });
20619
20654
  });
20620
20655
 
20656
+ var AbstractRendererPlugin = function AbstractRendererPlugin() {
20657
+ this.container = void 0;
20658
+ };
20621
20659
  var AbstractRenderer = /*#__PURE__*/function () {
20622
20660
  function AbstractRenderer(config) {
20623
20661
  this.plugins = [];
@@ -20726,9 +20764,8 @@ var CullingPlugin = CullingPlugin_1 = (_class$1 = /*#__PURE__*/function () {
20726
20764
  if (!cullable.isCulled() && object.isVisible()) {
20727
20765
  return object;
20728
20766
  } else {
20729
- if (_this.renderingContext.renderListLastFrame.indexOf(object) > -1) {
20730
- object.dispatchEvent(new CustomEvent(ElementEvent.CULLED));
20731
- }
20767
+ // if (this.renderingContext.renderListLastFrame.indexOf(object) > -1) {
20768
+ object.dispatchEvent(new CustomEvent(ElementEvent.CULLED)); // }
20732
20769
  }
20733
20770
 
20734
20771
  return null;
@@ -20925,9 +20962,7 @@ var EventPlugin = EventPlugin_1 = (_class$3 = /*#__PURE__*/function () {
20925
20962
  renderingService.hooks.pointerOut.tap(EventPlugin_1.tag, this.onPointerMove);
20926
20963
  };
20927
20964
 
20928
- _proto.bootstrapEvent = function bootstrapEvent(e, nativeEvent, view) {
20929
- e.pointerType = nativeEvent.pointerType;
20930
- var event = e;
20965
+ _proto.bootstrapEvent = function bootstrapEvent(event, nativeEvent, view) {
20931
20966
  event.view = view;
20932
20967
  event.originalEvent = null;
20933
20968
  event.nativeEvent = nativeEvent;
@@ -20935,6 +20970,7 @@ var EventPlugin = EventPlugin_1 = (_class$3 = /*#__PURE__*/function () {
20935
20970
  event.width = nativeEvent.width;
20936
20971
  event.height = nativeEvent.height;
20937
20972
  event.isPrimary = nativeEvent.isPrimary;
20973
+ event.pointerType = nativeEvent.pointerType;
20938
20974
  event.pressure = nativeEvent.pressure;
20939
20975
  event.tangentialPressure = nativeEvent.tangentialPressure;
20940
20976
  event.tiltX = nativeEvent.tiltX;
@@ -21008,6 +21044,7 @@ var EventPlugin = EventPlugin_1 = (_class$3 = /*#__PURE__*/function () {
21008
21044
 
21009
21045
  _proto.transferMouseData = function transferMouseData(event, nativeEvent) {
21010
21046
  event.isTrusted = nativeEvent.isTrusted;
21047
+ event.srcElement = nativeEvent.srcElement;
21011
21048
  event.timeStamp = performance.now();
21012
21049
  event.type = nativeEvent.type;
21013
21050
  event.altKey = nativeEvent.altKey;
@@ -21039,8 +21076,8 @@ var EventPlugin = EventPlugin_1 = (_class$3 = /*#__PURE__*/function () {
21039
21076
  var touch = event.changedTouches[i]; // use changedTouches instead of touches since touchend has no touches
21040
21077
  // @see https://stackoverflow.com/a/10079076
21041
21078
 
21042
- if (isUndefined(touch.button)) touch.button = event.touches.length ? 1 : 0;
21043
- if (isUndefined(touch.buttons)) touch.buttons = event.touches.length ? 1 : 0;
21079
+ if (isUndefined(touch.button)) touch.button = 0;
21080
+ if (isUndefined(touch.buttons)) touch.buttons = 1;
21044
21081
 
21045
21082
  if (isUndefined(touch.isPrimary)) {
21046
21083
  touch.isPrimary = event.touches.length === 1 && event.type === 'touchstart';
@@ -21603,7 +21640,6 @@ var Canvas = /*#__PURE__*/function (_EventTarget) {
21603
21640
  * the root node in scene graph
21604
21641
  */
21605
21642
  root: this.document.documentElement,
21606
- renderListLastFrame: [],
21607
21643
  renderListCurrentFrame: [],
21608
21644
  unculledEntities: [],
21609
21645
  renderReasons: new Set(),
@@ -21884,14 +21920,13 @@ var Canvas = /*#__PURE__*/function (_EventTarget) {
21884
21920
  // load other container modules provided by g-canvas/g-svg/g-webgl
21885
21921
  var plugins = renderer.getPlugins();
21886
21922
  plugins.forEach(function (plugin) {
21887
- plugin.init(_this4.container);
21923
+ plugin.container = _this4.container;
21924
+ plugin.init();
21888
21925
  });
21889
21926
  };
21890
21927
 
21891
21928
  _proto.setRenderer = /*#__PURE__*/function () {
21892
21929
  var _setRenderer = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(renderer) {
21893
- var _this5 = this;
21894
-
21895
21930
  var canvasConfig, oldRenderer;
21896
21931
  return _regeneratorRuntime().wrap(function _callee3$(_context3) {
21897
21932
  while (1) {
@@ -21914,7 +21949,7 @@ var Canvas = /*#__PURE__*/function (_EventTarget) {
21914
21949
  this.destroy(false, true); // destroy all plugins, reverse will mutate origin array
21915
21950
 
21916
21951
  [].concat(oldRenderer === null || oldRenderer === void 0 ? void 0 : oldRenderer.getPlugins()).reverse().forEach(function (plugin) {
21917
- plugin.destroy(_this5.container);
21952
+ plugin.destroy();
21918
21953
  });
21919
21954
  _context3.next = 9;
21920
21955
  return this.initRenderer(renderer);
@@ -21939,7 +21974,7 @@ var Canvas = /*#__PURE__*/function (_EventTarget) {
21939
21974
  };
21940
21975
 
21941
21976
  _proto.unmountChildren = function unmountChildren(parent) {
21942
- var _this6 = this;
21977
+ var _this5 = this;
21943
21978
 
21944
21979
  if (this.inited) {
21945
21980
  var path = [];
@@ -21959,7 +21994,7 @@ var Canvas = /*#__PURE__*/function (_EventTarget) {
21959
21994
 
21960
21995
  child.dispatchEvent(new CustomEvent(ElementEvent.UNMOUNTED)); // skip document.documentElement
21961
21996
 
21962
- if (child !== _this6.document.documentElement) {
21997
+ if (child !== _this5.document.documentElement) {
21963
21998
  child.ownerDocument = null;
21964
21999
  }
21965
22000
 
@@ -21969,12 +22004,12 @@ var Canvas = /*#__PURE__*/function (_EventTarget) {
21969
22004
  };
21970
22005
 
21971
22006
  _proto.mountChildren = function mountChildren(parent) {
21972
- var _this7 = this;
22007
+ var _this6 = this;
21973
22008
 
21974
22009
  if (this.inited) {
21975
22010
  parent.forEach(function (child) {
21976
22011
  if (!child.isConnected) {
21977
- child.ownerDocument = _this7.document;
22012
+ child.ownerDocument = _this6.document;
21978
22013
  child.isConnected = true;
21979
22014
  child.dispatchEvent(new CustomEvent(ElementEvent.MOUNTED)); // trigger after mounted
21980
22015
 
@@ -22033,12 +22068,12 @@ var Canvas = /*#__PURE__*/function (_EventTarget) {
22033
22068
  _createClass(Canvas, [{
22034
22069
  key: "ready",
22035
22070
  get: function get() {
22036
- var _this8 = this;
22071
+ var _this7 = this;
22037
22072
 
22038
22073
  if (!this.readyPromise) {
22039
22074
  this.readyPromise = new Promise(function (resolve) {
22040
- _this8.resolveReadyPromise = function () {
22041
- resolve(_this8);
22075
+ _this7.resolveReadyPromise = function () {
22076
+ resolve(_this7);
22042
22077
  };
22043
22078
  });
22044
22079
 
@@ -22054,8 +22089,7 @@ var Canvas = /*#__PURE__*/function (_EventTarget) {
22054
22089
  return Canvas;
22055
22090
  }(EventTarget);
22056
22091
 
22057
- // import * as ManaSyringe from 'mana-syringe';
22058
22092
  GlobalContainer.load(containerModule);
22059
22093
  var layoutEngine = GlobalContainer.get(LayoutEngine);
22060
22094
 
22061
- export { AABB, AbstractLayoutDefinition, AbstractRenderer, Animation, AnimationEffectTiming, AnimationEvent, AnimationTimeline, AsyncParallelHook, AsyncSeriesWaterfallHook, BUILT_IN_PROPERTIES, BaseType, BoundingSphere, CSS, CSSColorValue, CSSGradientValue, CSSKeywordValue, CSSMathInvert, CSSMathMax, CSSMathMin, CSSMathNegate, CSSMathOperator, CSSMathProduct, CSSMathSum, CSSMathValue, CSSMathVariadic, CSSNumericValue, CSSNumericValueType, CSSProperty, CSSPropertyAngle, CSSPropertyClipPath, CSSPropertyColor, CSSPropertyFilter, CSSPropertyLengthOrPercentage, CSSPropertyLengthOrPercentage12, CSSPropertyLengthOrPercentage14, CSSPropertyLocalPosition, CSSPropertyNumber, CSSPropertyOffsetDistance, CSSPropertyOffsetPath, CSSPropertyOpacity, CSSPropertyPath, CSSPropertyPoints, CSSPropertyShadowBlur, CSSPropertySyntaxFactory, CSSPropertyText, CSSPropertyTextTransform, CSSPropertyTransform, CSSPropertyTransformOrigin, CSSPropertyZIndex, CSSRGB, CSSStyleValue, CSSStyleValueType, CSSUnitValue, Camera, CameraEvent, CameraProjectionMode, CameraTrackingMode, CameraType, Canvas, CanvasConfig, CanvasEvent, Circle, CircleUpdater, ContextNode, ContextService, Cullable, CustomElement, CustomElementRegistry, CustomEvent, DCHECK, DCHECK_EQ, DCHECK_NE, DELEGATION_SPLITTER, DefaultCamera, DefaultSceneGraphSelector, DefaultSceneGraphService, DefaultStyleValueRegistry, Deferred, DisplayObject, DisplayObjectPool, Document, EasingFunctions, Element, ElementEvent, Ellipse, EllipseUpdater, EventService, EventTarget, FederatedEvent, FederatedMouseEvent, FederatedPointerEvent, FederatedWheelEvent, FragmentResult, FragmentResultFactory, FragmentResultOptions, Frustum, Geometry, GeometryAABBUpdater, GeometryUpdaterFactory, GradientType, Group, HTML, Image, KeyframeEffect, LayoutChildren, LayoutChildrenFactory, LayoutChildrenOptions, LayoutContext, LayoutContextFactory, LayoutContextOptions, LayoutEdges, LayoutEdgesFactory, LayoutEdgesOptions, LayoutEngine, LayoutFragment, LayoutFragmentFactory, LayoutFragmentOptions, LayoutObject, LayoutRegistry, LayoutTaskType, Line, LineUpdater, MOUSE_POINTER_ID, Mask, MutationEvent, MutationObserver, MutationRecord, Nested, Node, ObjectTyped, Odeg, OffscreenCanvasCreator, Opx, ParenLess, Path, PathUpdater, Plane, Point, Polygon, Polyline, PolylineUpdater, PropertyName, PropertySyntax, RBushNode, RBushRoot, Ray, Rect, RectUpdater, Rectangle, Registration, RenderReason, Renderable, RenderingContext, RenderingPluginContribution, RenderingService, SceneGraphSelector, SceneGraphSelectorFactory, SceneGraphService, Shape, Sortable, Strategy, StyleValueRegistry, SyncHook, SyncWaterfallHook, TOUCH_TO_POINTER, Text, TextService, TextUpdater, Transform, UnitCategory, UnitType, ValueRange, baseTypeToString, camelCase, clamp, clampedMergeNumbers, cleanExistedCanvas, colorStopToString, compareAnimations, composeMatrix, computeLinearGradient, computeRadialGradient, convertAngleUnit, convertEffectInput, convertItemToMatrix, convertPercentUnit, convertToDash, convertToPath, createVec3, decompose, deg2rad, deg2turn, equalSet, extractPolygons, formatAttribute, fromRotationTranslationScale, getAngle, getEasingFunction, getEuler, getHeight, getRotationInRadians, getScaling, getStyle, getTranslation, getWidth, grad2deg, hasArcOrBezier, isBoolean, isBrowser, isComparison, isFunction, isNil, isNumber, isObject, isPattern, isString, isUndefined, layoutEngine, makePerspective, makeQuerablePromise, makeTiming, memoize, mergeColors, mergeDimensionList, mergeDimensions, mergeNumberLists, mergeNumbers, mergePaths, mergeTransforms, normalizeKeyframes, normalizeTimingInput, numberToString, numericTimingToObject, parseAngle, parseColor, parseDimension, parseDimensionArray, parseFilter, parseGradient, parseLength, parseLengthOrPercentage, parseNumber, parseNumberList, parseParam, parsePath, parsePoints, parseTransform, parseTransformOrigin, parserPercentage, path2Segments, rad2deg, setDOMSize, sortByZIndex, toFontString, translatePathToString, turn2deg, typeCheck, unitTypeToBaseType };
22095
+ export { AABB, AbstractLayoutDefinition, AbstractRenderer, AbstractRendererPlugin, Animation, AnimationEffectTiming, AnimationEvent, AnimationTimeline, AsyncParallelHook, AsyncSeriesWaterfallHook, BUILT_IN_PROPERTIES, BaseType, BoundingSphere, CSS, CSSColorValue, CSSGradientValue, CSSKeywordValue, CSSMathInvert, CSSMathMax, CSSMathMin, CSSMathNegate, CSSMathOperator, CSSMathProduct, CSSMathSum, CSSMathValue, CSSMathVariadic, CSSNumericValue, CSSNumericValueType, CSSProperty, CSSPropertyAngle, CSSPropertyClipPath, CSSPropertyColor, CSSPropertyFilter, CSSPropertyLengthOrPercentage, CSSPropertyLengthOrPercentage12, CSSPropertyLengthOrPercentage14, CSSPropertyLocalPosition, CSSPropertyNumber, CSSPropertyOffsetDistance, CSSPropertyOffsetPath, CSSPropertyOpacity, CSSPropertyPath, CSSPropertyPoints, CSSPropertyShadowBlur, CSSPropertySyntaxFactory, CSSPropertyText, CSSPropertyTextTransform, CSSPropertyTransform, CSSPropertyTransformOrigin, CSSPropertyZIndex, CSSRGB, CSSStyleValue, CSSStyleValueType, CSSUnitValue, Camera, CameraEvent, CameraProjectionMode, CameraTrackingMode, CameraType, Canvas, CanvasConfig, CanvasEvent, Circle, CircleUpdater, ContextNode, ContextService, Cullable, CustomElement, CustomElementRegistry, CustomEvent, DCHECK, DCHECK_EQ, DCHECK_NE, DELEGATION_SPLITTER, DefaultCamera, DefaultSceneGraphSelector, DefaultSceneGraphService, DefaultStyleValueRegistry, Deferred, DisplayObject, DisplayObjectPool, Document, EasingFunctions, Element, ElementEvent, Ellipse, EllipseUpdater, EventService, EventTarget, FederatedEvent, FederatedMouseEvent, FederatedPointerEvent, FederatedWheelEvent, FragmentResult, FragmentResultFactory, FragmentResultOptions, Frustum, Geometry, GeometryAABBUpdater, GeometryUpdaterFactory, GradientType, Group, HTML, Image, KeyframeEffect, LayoutChildren, LayoutChildrenFactory, LayoutChildrenOptions, LayoutContext, LayoutContextFactory, LayoutContextOptions, LayoutEdges, LayoutEdgesFactory, LayoutEdgesOptions, LayoutEngine, LayoutFragment, LayoutFragmentFactory, LayoutFragmentOptions, LayoutObject, LayoutRegistry, LayoutTaskType, Line, LineUpdater, MOUSE_POINTER_ID, Mask, MutationEvent, MutationObserver, MutationRecord, Nested, Node, ObjectTyped, Odeg, OffscreenCanvasCreator, Opx, ParenLess, Path, PathUpdater, Plane, Point, Polygon, Polyline, PolylineUpdater, PropertyName, PropertySyntax, RBushNode, RBushRoot, Ray, Rect, RectUpdater, Rectangle, Registration, RenderReason, Renderable, RenderingContext, RenderingPluginContribution, RenderingService, SceneGraphSelector, SceneGraphSelectorFactory, SceneGraphService, Shape, Sortable, Strategy, StyleValueRegistry, SyncHook, SyncWaterfallHook, TOUCH_TO_POINTER, Text, TextService, TextUpdater, Transform, UnitCategory, UnitType, ValueRange, baseTypeToString, camelCase, clamp, clampedMergeNumbers, cleanExistedCanvas, colorStopToString, compareAnimations, composeMatrix, computeLinearGradient, computeRadialGradient, convertAngleUnit, convertEffectInput, convertItemToMatrix, convertPercentUnit, convertToDash, convertToPath, createVec3, decompose, deg2rad, deg2turn, equalSet, extractPolygons, formatAttribute, fromRotationTranslationScale, getAngle, getEasingFunction, getEuler, getHeight, getRotationInRadians, getScaling, getStyle, getTranslation, getWidth, grad2deg, hasArcOrBezier, isBoolean, isBrowser, isComparison, isFunction, isNil, isNumber, isObject, isPattern, isString, isUndefined, layoutEngine, makePerspective, makeQuerablePromise, makeTiming, memoize, mergeColors, mergeDimensionList, mergeDimensions, mergeNumberLists, mergeNumbers, mergePaths, mergeTransforms, normalizeKeyframes, normalizeTimingInput, numberToString, numericTimingToObject, parseAngle, parseColor, parseDimension, parseDimensionArray, parseFilter, parseGradient, parseLength, parseLengthOrPercentage, parseNumber, parseNumberList, parseParam, parsePath, parsePoints, parseTransform, parseTransformOrigin, parserPercentage, path2Segments, rad2deg, setDOMSize, sortByZIndex, toFontString, translatePathToString, turn2deg, typeCheck, unitTypeToBaseType };