@antv/g-lite 1.2.21 → 1.2.22

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) {
@@ -11755,6 +11781,7 @@ runtime.globalThis = getGlobalThis();
11755
11781
  runtime.enableCSSParsing = true;
11756
11782
  runtime.enableDataset = false;
11757
11783
  runtime.enableStyleSyntax = true;
11784
+ runtime.enableSizeAttenuation = false;
11758
11785
 
11759
11786
  var entityCounter = 0;
11760
11787
  function resetEntityCounter() {
@@ -14894,6 +14921,9 @@ var PrepareRendererPlugin = /** @class */ (function () {
14894
14921
  };
14895
14922
  var handleMounted = function (e) {
14896
14923
  var object = e.target;
14924
+ if (runtime.enableSizeAttenuation) {
14925
+ runtime.styleValueRegistry.updateSizeAttenuation(object, canvas.getCamera().getZoom());
14926
+ }
14897
14927
  if (runtime.enableCSSParsing) {
14898
14928
  // recalc style values
14899
14929
  runtime.styleValueRegistry.recalc(object);
@@ -15136,10 +15166,20 @@ var Canvas = /** @class */ (function (_super) {
15136
15166
  // redraw when camera changed
15137
15167
  camera.eventEmitter.on(CameraEvent.UPDATED, function () {
15138
15168
  _this.context.renderingContext.renderReasons.add(exports.RenderReason.CAMERA_CHANGED);
15169
+ if (runtime.enableSizeAttenuation &&
15170
+ _this.getConfig().renderer.getConfig().enableSizeAttenuation) {
15171
+ _this.updateSizeAttenuation();
15172
+ }
15139
15173
  });
15140
15174
  // bind camera
15141
15175
  this.context.camera = camera;
15142
15176
  };
15177
+ Canvas.prototype.updateSizeAttenuation = function () {
15178
+ var zoom = this.getCamera().getZoom();
15179
+ this.document.documentElement.forEach(function (node) {
15180
+ runtime.styleValueRegistry.updateSizeAttenuation(node, zoom);
15181
+ });
15182
+ };
15143
15183
  Canvas.prototype.getConfig = function () {
15144
15184
  return this.context.config;
15145
15185
  };