@visactor/vrender 0.18.11 → 0.18.13

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/cjs/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
1
  import '@visactor/vrender-core';
2
- export declare const version = "0.18.11";
2
+ export declare const version = "0.18.13";
3
3
  export * from '@visactor/vrender-core';
4
4
  export * from '@visactor/vrender-kits';
package/cjs/index.js CHANGED
@@ -21,7 +21,7 @@ Object.defineProperty(exports, "__esModule", {
21
21
 
22
22
  const vrender_core_1 = require("@visactor/vrender-core"), vrender_kits_1 = require("@visactor/vrender-kits"), vrender_kits_2 = require("@visactor/vrender-kits");
23
23
 
24
- exports.version = "0.18.11", (0, vrender_core_1.preLoadAllModule)(), (0, vrender_core_1.isBrowserEnv)() ? (0,
24
+ exports.version = "0.18.13", (0, vrender_core_1.preLoadAllModule)(), (0, vrender_core_1.isBrowserEnv)() ? (0,
25
25
  vrender_kits_1.loadBrowserEnv)(vrender_core_1.container) : (0, vrender_core_1.isNodeEnv)() && (0,
26
26
  vrender_kits_1.loadNodeEnv)(vrender_core_1.container), (0, vrender_kits_2.registerArc)(),
27
27
  (0, vrender_kits_2.registerArc3d)(), (0, vrender_kits_2.registerArea)(), (0, vrender_kits_2.registerCircle)(),
package/cjs/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,kCAAgC;AAChC,yDAA8F;AAC9F,yDAAqE;AACrE,yDAmBgC;AAEnB,QAAA,OAAO,GAAG,SAAS,CAAC;AAEjC,IAAA,+BAAgB,GAAE,CAAC;AAEnB,IAAI,IAAA,2BAAY,GAAE,EAAE;IAClB,IAAA,6BAAc,EAAC,wBAAS,CAAC,CAAC;CAC3B;KAAM,IAAI,IAAA,wBAAS,GAAE,EAAE;IACtB,IAAA,0BAAW,EAAC,wBAAS,CAAC,CAAC;CACxB;AACD,IAAA,0BAAW,GAAE,CAAC;AACd,IAAA,4BAAa,GAAE,CAAC;AAChB,IAAA,2BAAY,GAAE,CAAC;AACf,IAAA,6BAAc,GAAE,CAAC;AACjB,IAAA,4BAAa,GAAE,CAAC;AAChB,IAAA,4BAAa,GAAE,CAAC;AAChB,IAAA,4BAAa,GAAE,CAAC;AAChB,IAAA,2BAAY,GAAE,CAAC;AACf,IAAA,2BAAY,GAAE,CAAC;AACf,IAAA,8BAAe,GAAE,CAAC;AAClB,IAAA,gCAAiB,GAAE,CAAC;AACpB,IAAA,2BAAY,GAAE,CAAC;AACf,IAAA,6BAAc,GAAE,CAAC;AACjB,IAAA,+BAAgB,GAAE,CAAC;AACnB,IAAA,iCAAkB,GAAE,CAAC;AACrB,IAAA,6BAAc,GAAE,CAAC;AACjB,IAAA,2BAAY,GAAE,CAAC;AACf,IAAA,+BAAgB,GAAE,CAAC;AACnB,yDAAuC;AACvC,yDAAuC","file":"index.js","sourcesContent":["import '@visactor/vrender-core';\nimport { container, isBrowserEnv, isNodeEnv, preLoadAllModule } from '@visactor/vrender-core';\nimport { loadBrowserEnv, loadNodeEnv } from '@visactor/vrender-kits';\nimport {\n registerArc,\n registerArc3d,\n registerArea,\n registerCircle,\n registerGlyph,\n registerGroup,\n registerImage,\n registerLine,\n registerPath,\n registerPolygon,\n registerPyramid3d,\n registerRect,\n registerRect3d,\n registerRichtext,\n registerShadowRoot,\n registerSymbol,\n registerText,\n registerWrapText\n} from '@visactor/vrender-kits';\n// 导出版本号\nexport const version = \"0.18.11\";\n\npreLoadAllModule();\n\nif (isBrowserEnv()) {\n loadBrowserEnv(container);\n} else if (isNodeEnv()) {\n loadNodeEnv(container);\n}\nregisterArc();\nregisterArc3d();\nregisterArea();\nregisterCircle();\nregisterGlyph();\nregisterGroup();\nregisterImage();\nregisterLine();\nregisterPath();\nregisterPolygon();\nregisterPyramid3d();\nregisterRect();\nregisterRect3d();\nregisterRichtext();\nregisterShadowRoot();\nregisterSymbol();\nregisterText();\nregisterWrapText();\nexport * from '@visactor/vrender-core';\nexport * from '@visactor/vrender-kits';\n"]}
1
+ {"version":3,"sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,kCAAgC;AAChC,yDAA8F;AAC9F,yDAAqE;AACrE,yDAmBgC;AAEnB,QAAA,OAAO,GAAG,SAAS,CAAC;AAEjC,IAAA,+BAAgB,GAAE,CAAC;AAEnB,IAAI,IAAA,2BAAY,GAAE,EAAE;IAClB,IAAA,6BAAc,EAAC,wBAAS,CAAC,CAAC;CAC3B;KAAM,IAAI,IAAA,wBAAS,GAAE,EAAE;IACtB,IAAA,0BAAW,EAAC,wBAAS,CAAC,CAAC;CACxB;AACD,IAAA,0BAAW,GAAE,CAAC;AACd,IAAA,4BAAa,GAAE,CAAC;AAChB,IAAA,2BAAY,GAAE,CAAC;AACf,IAAA,6BAAc,GAAE,CAAC;AACjB,IAAA,4BAAa,GAAE,CAAC;AAChB,IAAA,4BAAa,GAAE,CAAC;AAChB,IAAA,4BAAa,GAAE,CAAC;AAChB,IAAA,2BAAY,GAAE,CAAC;AACf,IAAA,2BAAY,GAAE,CAAC;AACf,IAAA,8BAAe,GAAE,CAAC;AAClB,IAAA,gCAAiB,GAAE,CAAC;AACpB,IAAA,2BAAY,GAAE,CAAC;AACf,IAAA,6BAAc,GAAE,CAAC;AACjB,IAAA,+BAAgB,GAAE,CAAC;AACnB,IAAA,iCAAkB,GAAE,CAAC;AACrB,IAAA,6BAAc,GAAE,CAAC;AACjB,IAAA,2BAAY,GAAE,CAAC;AACf,IAAA,+BAAgB,GAAE,CAAC;AACnB,yDAAuC;AACvC,yDAAuC","file":"index.js","sourcesContent":["import '@visactor/vrender-core';\nimport { container, isBrowserEnv, isNodeEnv, preLoadAllModule } from '@visactor/vrender-core';\nimport { loadBrowserEnv, loadNodeEnv } from '@visactor/vrender-kits';\nimport {\n registerArc,\n registerArc3d,\n registerArea,\n registerCircle,\n registerGlyph,\n registerGroup,\n registerImage,\n registerLine,\n registerPath,\n registerPolygon,\n registerPyramid3d,\n registerRect,\n registerRect3d,\n registerRichtext,\n registerShadowRoot,\n registerSymbol,\n registerText,\n registerWrapText\n} from '@visactor/vrender-kits';\n// 导出版本号\nexport const version = \"0.18.13\";\n\npreLoadAllModule();\n\nif (isBrowserEnv()) {\n loadBrowserEnv(container);\n} else if (isNodeEnv()) {\n loadNodeEnv(container);\n}\nregisterArc();\nregisterArc3d();\nregisterArea();\nregisterCircle();\nregisterGlyph();\nregisterGroup();\nregisterImage();\nregisterLine();\nregisterPath();\nregisterPolygon();\nregisterPyramid3d();\nregisterRect();\nregisterRect3d();\nregisterRichtext();\nregisterShadowRoot();\nregisterSymbol();\nregisterText();\nregisterWrapText();\nexport * from '@visactor/vrender-core';\nexport * from '@visactor/vrender-kits';\n"]}
package/dist/index.js CHANGED
@@ -5679,13 +5679,14 @@
5679
5679
  }, {
5680
5680
  key: "clipTextWithSuffix",
5681
5681
  value: function clipTextWithSuffix(text, options, width, suffix, wordBreak, position) {
5682
+ var forceSuffix = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : !1;
5682
5683
  if ("" === suffix) return this.clipText(text, options, width, wordBreak);
5683
5684
  if (0 === text.length) return {
5684
5685
  str: "",
5685
5686
  width: 0
5686
5687
  };
5687
5688
  var length = this.measureTextWidth(text, options);
5688
- if (length <= width) return {
5689
+ if (!forceSuffix && length <= width) return {
5689
5690
  str: text,
5690
5691
  width: length
5691
5692
  };
@@ -5694,12 +5695,16 @@
5694
5695
  str: "",
5695
5696
  width: 0
5696
5697
  };
5698
+ if (forceSuffix && length + suffixWidth <= width) return {
5699
+ str: text + suffix,
5700
+ width: length + suffixWidth
5701
+ };
5697
5702
  width -= suffixWidth;
5698
5703
  var data = this._clipText(text, options, width, 0, text.length - 1, position, suffix);
5699
5704
  if (wordBreak && data.str !== text) {
5700
5705
  var index = testLetter(text, data.str.length);
5701
- index !== data.str.length && (data.str = text.substring(0, index), data.width = this.measureTextWidth(data.str, options));
5702
- }
5706
+ index !== data.str.length && (data.result = text.substring(0, index), data.width = this.measureTextWidth(data.str, options));
5707
+ } else forceSuffix && data.str === text && (data.result = text + suffix);
5703
5708
  return data.str = data.result, data.width += suffixWidth, data;
5704
5709
  }
5705
5710
  }]);
@@ -11807,19 +11812,17 @@
11807
11812
  var _a, _b, _c, _d;
11808
11813
  if (hasAnimation) {
11809
11814
  var keys = Object.keys(attrs),
11810
- noWorkAAttr = this.getNoWorkAnimateAttr(),
11815
+ noWorkAttrs = this.getNoWorkAnimateAttr(),
11811
11816
  animateAttrs = {};
11812
11817
  var noAnimateAttrs;
11813
- isClear ? keys.forEach(function (key) {
11814
- noWorkAAttr[key] ? (noAnimateAttrs || (noAnimateAttrs = {}), noAnimateAttrs[key] = attrs[key]) : animateAttrs[key] = void 0 === attrs[key] ? _this3.getDefaultAttribute(key) : attrs[key];
11815
- }) : keys.forEach(function (key) {
11816
- noWorkAAttr[key] ? (noAnimateAttrs || (noAnimateAttrs = {}), noAnimateAttrs[key] = attrs[key]) : animateAttrs[key] = attrs[key];
11818
+ keys.forEach(function (key) {
11819
+ noWorkAttrs[key] ? (noAnimateAttrs || (noAnimateAttrs = {}), noAnimateAttrs[key] = attrs[key]) : animateAttrs[key] = isClear && void 0 === attrs[key] ? _this3.getDefaultAttribute(key) : attrs[key];
11817
11820
  });
11818
11821
  var animate = this.animate();
11819
11822
  animate.stateNames = stateNames, animate.to(animateAttrs, null !== (_b = null === (_a = this.stateAnimateConfig) || void 0 === _a ? void 0 : _a.duration) && void 0 !== _b ? _b : DefaultStateAnimateConfig.duration, null !== (_d = null === (_c = this.stateAnimateConfig) || void 0 === _c ? void 0 : _c.easing) && void 0 !== _d ? _d : DefaultStateAnimateConfig.easing), noAnimateAttrs && this.setAttributes(noAnimateAttrs, !1, {
11820
11823
  type: exports.AttributeUpdateType.STATE
11821
11824
  });
11822
- } else this.setAttributes(attrs, !1, {
11825
+ } else this.stopStateAnimates(), this.setAttributes(attrs, !1, {
11823
11826
  type: exports.AttributeUpdateType.STATE
11824
11827
  });
11825
11828
  }
@@ -11836,6 +11839,14 @@
11836
11839
  newNormalAttrs[key] = _this4.getNormalAttribute(key);
11837
11840
  }), this.normalAttrs = newNormalAttrs;
11838
11841
  }
11842
+ }, {
11843
+ key: "stopStateAnimates",
11844
+ value: function stopStateAnimates() {
11845
+ var type = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "end";
11846
+ this.animates && this.animates.forEach(function (animate) {
11847
+ animate.stateNames && animate.stop(type);
11848
+ });
11849
+ }
11839
11850
  }, {
11840
11851
  key: "getNormalAttribute",
11841
11852
  value: function getNormalAttribute(key) {
@@ -13883,7 +13894,7 @@
13883
13894
  var str = lines[i];
13884
13895
  var needCut = !0;
13885
13896
  if (i === lineCountLimit - 1) {
13886
- var _clip = layoutObj.textMeasure.clipTextWithSuffix(str, layoutObj.textOptions, maxLineWidth, ellipsis, !1, suffixPosition);
13897
+ var _clip = layoutObj.textMeasure.clipTextWithSuffix(str, layoutObj.textOptions, maxLineWidth, ellipsis, !1, suffixPosition, i !== lines.length - 1);
13887
13898
  linesLayout.push({
13888
13899
  str: _clip.str,
13889
13900
  width: _clip.width
@@ -17665,6 +17676,8 @@
17665
17676
  }, {
17666
17677
  key: "updateGroupAABBBounds",
17667
17678
  value: function updateGroupAABBBounds(attribute, groupTheme, aabbBounds, graphic) {
17679
+ var originalAABBBounds = aabbBounds;
17680
+ aabbBounds = aabbBounds.clone();
17668
17681
  var width = attribute.width,
17669
17682
  height = attribute.height,
17670
17683
  path = attribute.path,
@@ -17672,12 +17685,12 @@
17672
17685
  clip = _attribute$clip === void 0 ? groupTheme.clip : _attribute$clip;
17673
17686
  path && path.length ? path.forEach(function (g) {
17674
17687
  aabbBounds.union(g.AABBBounds);
17675
- }) : null != width && null != height && aabbBounds.set(0, 0, width, height), clip || graphic.forEachChildren(function (node) {
17688
+ }) : null != width && null != height && aabbBounds.set(0, 0, Math.max(0, width), Math.max(0, height)), clip || graphic.forEachChildren(function (node) {
17676
17689
  aabbBounds.union(node.AABBBounds);
17677
17690
  });
17678
17691
  var tb1 = this.tempAABBBounds1,
17679
17692
  tb2 = this.tempAABBBounds2;
17680
- return tb1.setValue(aabbBounds.x1, aabbBounds.y1, aabbBounds.x2, aabbBounds.y2), tb2.setValue(aabbBounds.x1, aabbBounds.y1, aabbBounds.x2, aabbBounds.y2), this.transformAABBBounds(attribute, aabbBounds, groupTheme, !1, graphic), aabbBounds;
17693
+ return tb1.setValue(aabbBounds.x1, aabbBounds.y1, aabbBounds.x2, aabbBounds.y2), tb2.setValue(aabbBounds.x1, aabbBounds.y1, aabbBounds.x2, aabbBounds.y2), this.transformAABBBounds(attribute, aabbBounds, groupTheme, !1, graphic), originalAABBBounds.copy(aabbBounds), originalAABBBounds;
17681
17694
  }
17682
17695
  }, {
17683
17696
  key: "updateGlyphAABBBounds",
@@ -20637,9 +20650,14 @@
20637
20650
  backgroundMode = _graphic$attribute$ba === void 0 ? graphicAttribute.backgroundMode : _graphic$attribute$ba,
20638
20651
  _graphic$attribute$ba2 = _graphic$attribute.backgroundFit,
20639
20652
  backgroundFit = _graphic$attribute$ba2 === void 0 ? graphicAttribute.backgroundFit : _graphic$attribute$ba2;
20640
- var b,
20653
+ var matrix,
20641
20654
  background = graphic.attribute.background;
20642
20655
  if (!background) return;
20656
+ var restore = function restore() {
20657
+ "richtext" === graphic.type && (context.restore(), context.save(), matrix && context.setTransformFromMatrix(matrix, !0, 1));
20658
+ };
20659
+ var b;
20660
+ "richtext" === graphic.type && (matrix = context.currentMatrix.clone(), context.restore(), context.save(), context.setTransformForCurrent());
20643
20661
  var shouldReCalBounds = isObject$1(background) && background.background,
20644
20662
  onlyTranslate = graphic.transMatrix.onlyTranslate();
20645
20663
  if (shouldReCalBounds) {
@@ -20664,13 +20682,13 @@
20664
20682
  })).clone());
20665
20683
  if (graphic.backgroundImg && graphic.resources) {
20666
20684
  var res = graphic.resources.get(background);
20667
- if ("success" !== res.state || !res.data) return;
20685
+ if ("success" !== res.state || !res.data) return void restore();
20668
20686
  context.highPerformanceSave(), onlyTranslate && context.setTransformFromMatrix(graphic.parent.globalTransMatrix, !0), context.setCommonStyle(graphic, graphic.attribute, x, y, graphicAttribute), this.doDrawImage(context, res.data, b, backgroundMode, backgroundFit), context.highPerformanceRestore(), context.setTransformForCurrent();
20669
20687
  } else {
20670
20688
  var backgroundCornerRadius = graphic.attribute.backgroundCornerRadius;
20671
20689
  context.highPerformanceSave(), context.setCommonStyle(graphic, graphic.attribute, x, y, graphicAttribute), context.fillStyle = background, backgroundCornerRadius ? (createRectPath(context, b.x1, b.y1, b.width(), b.height(), backgroundCornerRadius), context.fill()) : context.fillRect(b.x1, b.y1, b.width(), b.height()), context.highPerformanceRestore();
20672
20690
  }
20673
- shouldReCalBounds && boundsAllocate.free(b);
20691
+ shouldReCalBounds && boundsAllocate.free(b), restore();
20674
20692
  }
20675
20693
  }]);
20676
20694
  }(DefaultBaseBackgroundRenderContribution);
@@ -21428,7 +21446,7 @@
21428
21446
  value: function render(groups, params) {
21429
21447
  this.renderTreeRoots = groups, this.drawParams = params;
21430
21448
  var updateBounds = params.updateBounds;
21431
- this.prepare(updateBounds), this.prepareRenderList(), this.beforeDraw(params), this.draw(params), this.afterDraw(params), this.drawParams = null, this.renderTreeRoots = [];
21449
+ this.prepare(updateBounds), this.prepareRenderList(), this.beforeDraw(params), this.draw(params), this.afterDraw(params), this.drawParams = null;
21432
21450
  }
21433
21451
  }]);
21434
21452
  }();
@@ -24267,7 +24285,7 @@
24267
24285
  value: function release() {
24268
24286
  _get(_getPrototypeOf(Stage.prototype), "release", this).call(this), this.hooks.beforeRender.unTap("constructor", this.beforeRender), this.hooks.afterRender.unTap("constructor", this.afterRender), this.eventSystem && this.eventSystem.release(), this.layerService.releaseStage(this), this.pluginService.release(), this.forEach(function (layer) {
24269
24287
  layer.release();
24270
- }), this.interactiveLayer && this.interactiveLayer.release(), this.window.release(), this.ticker.remTimeline(this.timeline);
24288
+ }), this.interactiveLayer && this.interactiveLayer.release(), this.window.release(), this.ticker.remTimeline(this.timeline), this.renderService.renderTreeRoots = [];
24271
24289
  }
24272
24290
  }, {
24273
24291
  key: "setStage",
@@ -34891,7 +34909,7 @@
34891
34909
 
34892
34910
  var roughModule = _roughModule;
34893
34911
 
34894
- const version = "0.18.11";
34912
+ const version = "0.18.13";
34895
34913
  preLoadAllModule();
34896
34914
  if (isBrowserEnv()) {
34897
34915
  loadBrowserEnv(container);