@antv/g-lite 1.2.21 → 1.2.23

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
@@ -662,7 +662,7 @@ var AbstractRenderer = /** @class */ (function () {
662
662
  /**
663
663
  * enable dirty rectangle rendering by default
664
664
  */
665
- enableDirtyRectangleRendering: true, enableDirtyRectangleRenderingDebug: false }, config);
665
+ enableDirtyRectangleRendering: true, enableDirtyRectangleRenderingDebug: false, enableSizeAttenuation: true }, config);
666
666
  }
667
667
  AbstractRenderer.prototype.registerPlugin = function (plugin) {
668
668
  var index = this.plugins.findIndex(function (p) { return p === plugin; });
@@ -7194,6 +7194,32 @@ var DefaultStyleValueRegistry = /** @class */ (function () {
7194
7194
  this.runtime.sceneGraphService.dirtifyToRoot(object);
7195
7195
  }
7196
7196
  };
7197
+ DefaultStyleValueRegistry.prototype.updateSizeAttenuation = function (node, zoom) {
7198
+ if (node.style.isSizeAttenuation) {
7199
+ if (!node.style.rawLineWidth) {
7200
+ node.style.rawLineWidth = node.style.lineWidth;
7201
+ }
7202
+ node.style.lineWidth = node.style.rawLineWidth / zoom;
7203
+ if (node.nodeName === exports.Shape.CIRCLE) {
7204
+ if (!node.style.rawR) {
7205
+ node.style.rawR = node.style.r;
7206
+ }
7207
+ node.style.r = node.style.rawR / zoom;
7208
+ }
7209
+ }
7210
+ else {
7211
+ if (node.style.rawLineWidth) {
7212
+ node.style.lineWidth = node.style.rawLineWidth;
7213
+ delete node.style.rawLineWidth;
7214
+ }
7215
+ if (node.nodeName === exports.Shape.CIRCLE) {
7216
+ if (node.style.rawR) {
7217
+ node.style.r = node.style.rawR;
7218
+ delete node.style.rawR;
7219
+ }
7220
+ }
7221
+ }
7222
+ };
7197
7223
  DefaultStyleValueRegistry.prototype.isPropertyInheritable = function (name) {
7198
7224
  var metadata = propertyMetadataCache[name];
7199
7225
  if (!metadata) {
@@ -11125,6 +11151,9 @@ var DefaultSceneGraphService = /** @class */ (function () {
11125
11151
  }
11126
11152
  }
11127
11153
  });
11154
+ if (!aabb) {
11155
+ aabb = new AABB();
11156
+ }
11128
11157
  if (render) {
11129
11158
  // FIXME: account for clip path
11130
11159
  var clipped = findClosestClipPathTarget(element);
@@ -11132,28 +11161,19 @@ var DefaultSceneGraphService = /** @class */ (function () {
11132
11161
  // use bounds under world space
11133
11162
  var clipPathBounds = clipped.parsedStyle.clipPath.getBounds(render);
11134
11163
  if (!aabb) {
11135
- aabb = clipPathBounds;
11164
+ aabb.update(clipPathBounds.center, clipPathBounds.halfExtents);
11136
11165
  }
11137
11166
  else if (clipPathBounds) {
11138
11167
  aabb = clipPathBounds.intersection(aabb);
11139
11168
  }
11140
11169
  }
11141
11170
  }
11142
- if (!aabb) {
11143
- aabb = new AABB();
11144
- }
11145
- if (aabb) {
11146
- if (render) {
11147
- renderable.renderBounds = aabb;
11148
- }
11149
- else {
11150
- renderable.bounds = aabb;
11151
- }
11152
- }
11153
11171
  if (render) {
11172
+ renderable.renderBounds = aabb;
11154
11173
  renderable.renderBoundsDirty = false;
11155
11174
  }
11156
11175
  else {
11176
+ renderable.bounds = aabb;
11157
11177
  renderable.boundsDirty = false;
11158
11178
  }
11159
11179
  return aabb;
@@ -11755,6 +11775,7 @@ runtime.globalThis = getGlobalThis();
11755
11775
  runtime.enableCSSParsing = true;
11756
11776
  runtime.enableDataset = false;
11757
11777
  runtime.enableStyleSyntax = true;
11778
+ runtime.enableSizeAttenuation = false;
11758
11779
 
11759
11780
  var entityCounter = 0;
11760
11781
  function resetEntityCounter() {
@@ -14894,6 +14915,9 @@ var PrepareRendererPlugin = /** @class */ (function () {
14894
14915
  };
14895
14916
  var handleMounted = function (e) {
14896
14917
  var object = e.target;
14918
+ if (runtime.enableSizeAttenuation) {
14919
+ runtime.styleValueRegistry.updateSizeAttenuation(object, canvas.getCamera().getZoom());
14920
+ }
14897
14921
  if (runtime.enableCSSParsing) {
14898
14922
  // recalc style values
14899
14923
  runtime.styleValueRegistry.recalc(object);
@@ -15136,10 +15160,20 @@ var Canvas = /** @class */ (function (_super) {
15136
15160
  // redraw when camera changed
15137
15161
  camera.eventEmitter.on(CameraEvent.UPDATED, function () {
15138
15162
  _this.context.renderingContext.renderReasons.add(exports.RenderReason.CAMERA_CHANGED);
15163
+ if (runtime.enableSizeAttenuation &&
15164
+ _this.getConfig().renderer.getConfig().enableSizeAttenuation) {
15165
+ _this.updateSizeAttenuation();
15166
+ }
15139
15167
  });
15140
15168
  // bind camera
15141
15169
  this.context.camera = camera;
15142
15170
  };
15171
+ Canvas.prototype.updateSizeAttenuation = function () {
15172
+ var zoom = this.getCamera().getZoom();
15173
+ this.document.documentElement.forEach(function (node) {
15174
+ runtime.styleValueRegistry.updateSizeAttenuation(node, zoom);
15175
+ });
15176
+ };
15143
15177
  Canvas.prototype.getConfig = function () {
15144
15178
  return this.context.config;
15145
15179
  };