@antv/g-lite 1.2.13 → 1.2.15

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
@@ -9622,7 +9622,7 @@ var EventService = /** @class */ (function () {
9622
9622
  };
9623
9623
  EventService.prototype.hitTest = function (position) {
9624
9624
  var viewportX = position.viewportX, viewportY = position.viewportY;
9625
- var _a = this.context.config, width = _a.width, height = _a.height;
9625
+ var _a = this.context.config, width = _a.width, height = _a.height, disableHitTesting = _a.disableHitTesting;
9626
9626
  // outside canvas
9627
9627
  if (viewportX < 0 ||
9628
9628
  viewportY < 0 ||
@@ -9630,7 +9630,7 @@ var EventService = /** @class */ (function () {
9630
9630
  viewportY > height) {
9631
9631
  return null;
9632
9632
  }
9633
- return (this.pickHandler(position) ||
9633
+ return ((!disableHitTesting && this.pickHandler(position)) ||
9634
9634
  this.rootTarget || // return Document
9635
9635
  null);
9636
9636
  };
@@ -10081,13 +10081,24 @@ var RenderingService = /** @class */ (function () {
10081
10081
  this.globalRuntime.sceneGraphService.syncHierarchy(renderingContext.root);
10082
10082
  this.globalRuntime.sceneGraphService.triggerPendingEvents();
10083
10083
  if (renderingContext.renderReasons.size && this.inited) {
10084
- this.renderDisplayObject(renderingContext.root, canvasConfig, renderingContext);
10084
+ // @ts-ignore
10085
+ renderingContext.dirtyRectangleRenderingDisabled =
10086
+ this.disableDirtyRectangleRendering();
10087
+ var onlyCameraChanged = renderingContext.renderReasons.size === 1 &&
10088
+ renderingContext.renderReasons.has(RenderReason.CAMERA_CHANGED);
10089
+ var shouldTriggerRenderHooks = !canvasConfig.disableRenderHooks ||
10090
+ !(canvasConfig.disableRenderHooks && onlyCameraChanged);
10091
+ if (shouldTriggerRenderHooks) {
10092
+ this.renderDisplayObject(renderingContext.root, canvasConfig, renderingContext);
10093
+ }
10085
10094
  this.hooks.beginFrame.call();
10086
- renderingContext.renderListCurrentFrame.forEach(function (object) {
10087
- _this.hooks.beforeRender.call(object);
10088
- _this.hooks.render.call(object);
10089
- _this.hooks.afterRender.call(object);
10090
- });
10095
+ if (shouldTriggerRenderHooks) {
10096
+ renderingContext.renderListCurrentFrame.forEach(function (object) {
10097
+ _this.hooks.beforeRender.call(object);
10098
+ _this.hooks.render.call(object);
10099
+ _this.hooks.afterRender.call(object);
10100
+ });
10101
+ }
10091
10102
  this.hooks.endFrame.call();
10092
10103
  renderingContext.renderListCurrentFrame = [];
10093
10104
  renderingContext.renderReasons.clear();
@@ -10104,8 +10115,12 @@ var RenderingService = /** @class */ (function () {
10104
10115
  }
10105
10116
  // TODO: relayout
10106
10117
  // dirtycheck first
10118
+ var renderable = displayObject.renderable;
10107
10119
  var objectChanged = enableDirtyCheck
10108
- ? this.hooks.dirtycheck.call(displayObject)
10120
+ ? // @ts-ignore
10121
+ renderable.dirty || renderingContext.dirtyRectangleRenderingDisabled
10122
+ ? displayObject
10123
+ : null
10109
10124
  : displayObject;
10110
10125
  if (objectChanged) {
10111
10126
  var objectToRender = enableCulling
@@ -12272,9 +12287,8 @@ var DATASET_PREFIX = 'data-';
12272
12287
  var DisplayObject = /** @class */ (function (_super) {
12273
12288
  __extends(DisplayObject, _super);
12274
12289
  function DisplayObject(config) {
12275
- var _this = this;
12276
12290
  var _a;
12277
- _this = _super.call(this) || this;
12291
+ var _this = _super.call(this) || this;
12278
12292
  _this.isCustomElement = false;
12279
12293
  _this.isMutationObserved = false;
12280
12294
  /**
@@ -13089,8 +13103,8 @@ var CustomElement = /** @class */ (function (_super) {
13089
13103
  __extends(CustomElement, _super);
13090
13104
  // private shadowNodes: DisplayObject[] = [];
13091
13105
  function CustomElement(_a) {
13092
- if (_a === void 0) { _a = {}; }
13093
13106
  var _this = this;
13107
+ if (_a === void 0) { _a = {}; }
13094
13108
  var style = _a.style, rest = __rest(_a, ["style"]);
13095
13109
  _this = _super.call(this, __assign({ style: runtime.enableCSSParsing
13096
13110
  ? __assign({ x: '', y: '' }, style) : __assign({}, style) }, rest)) || this;
@@ -13147,8 +13161,8 @@ var Group = /** @class */ (function (_super) {
13147
13161
  var HTML = /** @class */ (function (_super) {
13148
13162
  __extends(HTML, _super);
13149
13163
  function HTML(_a) {
13150
- if (_a === void 0) { _a = {}; }
13151
13164
  var _this = this;
13165
+ if (_a === void 0) { _a = {}; }
13152
13166
  var style = _a.style, rest = __rest(_a, ["style"]);
13153
13167
  _this = _super.call(this, __assign({ type: Shape.HTML, style: runtime.enableCSSParsing
13154
13168
  ? __assign({ x: '', y: '', width: 'auto', height: 'auto', innerHTML: '' }, style) : __assign({}, style) }, rest)) || this;
@@ -13226,8 +13240,8 @@ var Image = /** @class */ (function (_super) {
13226
13240
  var Line = /** @class */ (function (_super) {
13227
13241
  __extends(Line, _super);
13228
13242
  function Line(_a) {
13229
- if (_a === void 0) { _a = {}; }
13230
13243
  var _this = this;
13244
+ if (_a === void 0) { _a = {}; }
13231
13245
  var style = _a.style, rest = __rest(_a, ["style"]);
13232
13246
  _this = _super.call(this, __assign({ type: Shape.LINE, style: __assign({ x1: 0, y1: 0, x2: 0, y2: 0, z1: 0, z2: 0, isBillboard: false }, style) }, rest)) || this;
13233
13247
  _this.markerStartAngle = 0;
@@ -13337,8 +13351,8 @@ var Line = /** @class */ (function (_super) {
13337
13351
  var Path = /** @class */ (function (_super) {
13338
13352
  __extends(Path, _super);
13339
13353
  function Path(_a) {
13340
- if (_a === void 0) { _a = {}; }
13341
13354
  var _this = this;
13355
+ if (_a === void 0) { _a = {}; }
13342
13356
  var style = _a.style, rest = __rest(_a, ["style"]);
13343
13357
  _this = _super.call(this, __assign({ type: Shape.PATH, style: runtime.enableCSSParsing
13344
13358
  ? __assign({ path: '', miterLimit: '' }, style) : __assign({}, style), initialParsedStyle: runtime.enableCSSParsing
@@ -13538,8 +13552,8 @@ var Path = /** @class */ (function (_super) {
13538
13552
  var Polygon = /** @class */ (function (_super) {
13539
13553
  __extends(Polygon, _super);
13540
13554
  function Polygon(_a) {
13541
- if (_a === void 0) { _a = {}; }
13542
13555
  var _this = this;
13556
+ if (_a === void 0) { _a = {}; }
13543
13557
  var style = _a.style, rest = __rest(_a, ["style"]);
13544
13558
  _this = _super.call(this, __assign({ type: Shape.POLYGON, style: runtime.enableCSSParsing
13545
13559
  ? __assign({ points: '', miterLimit: '', isClosed: true }, style) : __assign({}, style), initialParsedStyle: runtime.enableCSSParsing
@@ -14266,33 +14280,6 @@ var CullingPlugin = /** @class */ (function () {
14266
14280
  return CullingPlugin;
14267
14281
  }());
14268
14282
 
14269
- /**
14270
- * Filter dirty renderables and calculate the "dirty rectangle" which will be clear when frame began
14271
- */
14272
- var DirtyCheckPlugin = /** @class */ (function () {
14273
- function DirtyCheckPlugin() {
14274
- }
14275
- DirtyCheckPlugin.prototype.apply = function (context) {
14276
- var renderingService = context.renderingService;
14277
- renderingService.hooks.dirtycheck.tap(DirtyCheckPlugin.tag, function (object) {
14278
- if (object) {
14279
- var renderable = object.renderable;
14280
- var isDirty = renderable.dirty ||
14281
- renderingService.disableDirtyRectangleRendering();
14282
- if (isDirty) {
14283
- return object;
14284
- }
14285
- else {
14286
- return null;
14287
- }
14288
- }
14289
- return object;
14290
- });
14291
- };
14292
- DirtyCheckPlugin.tag = 'DirtyCheck';
14293
- return DirtyCheckPlugin;
14294
- }());
14295
-
14296
14283
  /**
14297
14284
  * support mouse & touch events
14298
14285
  * @see https://github.com/pixijs/pixi.js/blob/dev/packages/interaction/README.md
@@ -14483,7 +14470,6 @@ var EventPlugin = /** @class */ (function () {
14483
14470
  return { x: x, y: y };
14484
14471
  };
14485
14472
  EventPlugin.prototype.bootstrapEvent = function (event, normalizedEvent, view, nativeEvent) {
14486
- var _a, _b;
14487
14473
  event.view = view;
14488
14474
  event.originalEvent = null;
14489
14475
  event.nativeEvent = nativeEvent;
@@ -14498,10 +14484,10 @@ var EventPlugin = /** @class */ (function () {
14498
14484
  event.tiltY = normalizedEvent.tiltY;
14499
14485
  event.twist = normalizedEvent.twist;
14500
14486
  this.transferMouseData(event, normalizedEvent);
14501
- var x = (_a = this.getViewportXY(normalizedEvent), _a.x), y = _a.y;
14487
+ var _a = this.getViewportXY(normalizedEvent), x = _a.x, y = _a.y;
14502
14488
  event.viewport.x = x;
14503
14489
  event.viewport.y = y;
14504
- var canvasX = (_b = this.context.eventService.viewport2Canvas(event.viewport), _b.x), canvasY = _b.y;
14490
+ var _b = this.context.eventService.viewport2Canvas(event.viewport), canvasX = _b.x, canvasY = _b.y;
14505
14491
  event.canvas.x = canvasX;
14506
14492
  event.canvas.y = canvasY;
14507
14493
  event.global.copyFrom(event.canvas);
@@ -14519,17 +14505,16 @@ var EventPlugin = /** @class */ (function () {
14519
14505
  return event;
14520
14506
  };
14521
14507
  EventPlugin.prototype.normalizeWheelEvent = function (nativeEvent) {
14522
- var _a, _b;
14523
14508
  var event = this.rootWheelEvent;
14524
14509
  this.transferMouseData(event, nativeEvent);
14525
14510
  event.deltaMode = nativeEvent.deltaMode;
14526
14511
  event.deltaX = nativeEvent.deltaX;
14527
14512
  event.deltaY = nativeEvent.deltaY;
14528
14513
  event.deltaZ = nativeEvent.deltaZ;
14529
- var x = (_a = this.getViewportXY(nativeEvent), _a.x), y = _a.y;
14514
+ var _a = this.getViewportXY(nativeEvent), x = _a.x, y = _a.y;
14530
14515
  event.viewport.x = x;
14531
14516
  event.viewport.y = y;
14532
- var canvasX = (_b = this.context.eventService.viewport2Canvas(event.viewport), _b.x), canvasY = _b.y;
14517
+ var _b = this.context.eventService.viewport2Canvas(event.viewport), canvasX = _b.x, canvasY = _b.y;
14533
14518
  event.canvas.x = canvasX;
14534
14519
  event.canvas.y = canvasY;
14535
14520
  event.global.copyFrom(event.canvas);
@@ -14821,7 +14806,6 @@ var PrepareRendererPlugin = /** @class */ (function () {
14821
14806
  // some objects may be removed since last frame
14822
14807
  .filter(function (object) { return object.isConnected; })
14823
14808
  .forEach(function (node) {
14824
- var _a, _b;
14825
14809
  var rBushNode = node.rBushNode;
14826
14810
  // clear dirty node
14827
14811
  if (rBushNode && rBushNode.aabb) {
@@ -14829,8 +14813,8 @@ var PrepareRendererPlugin = /** @class */ (function () {
14829
14813
  }
14830
14814
  var renderBounds = node.getRenderBounds();
14831
14815
  if (renderBounds) {
14832
- var minX = (_a = __read(renderBounds.getMin(), 2), _a[0]), minY = _a[1];
14833
- var maxX = (_b = __read(renderBounds.getMax(), 2), _b[0]), maxY = _b[1];
14816
+ var _a = __read(renderBounds.getMin(), 2), minX = _a[0], minY = _a[1];
14817
+ var _b = __read(renderBounds.getMax(), 2), maxX = _b[0], maxY = _b[1];
14834
14818
  if (!rBushNode.aabb) {
14835
14819
  rBushNode.aabb = {};
14836
14820
  }
@@ -15186,7 +15170,9 @@ var Canvas = /** @class */ (function (_super) {
15186
15170
  this.context.rBushRoot = new RBush();
15187
15171
  // reset rendering plugins
15188
15172
  this.context.renderingPlugins = [];
15189
- this.context.renderingPlugins.push(new EventPlugin(), new PrepareRendererPlugin(), new DirtyCheckPlugin(), new CullingPlugin([new FrustumCullingStrategy()]));
15173
+ this.context.renderingPlugins.push(new EventPlugin(), new PrepareRendererPlugin(),
15174
+ // new DirtyCheckPlugin(),
15175
+ new CullingPlugin([new FrustumCullingStrategy()]));
15190
15176
  //
15191
15177
  this.loadRendererContainerModule(renderer);
15192
15178
  // init context service