@visactor/vrender 0.17.20 → 0.17.21

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.17.20";
2
+ export declare const version = "0.17.21";
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.17.20", (0, vrender_core_1.preLoadAllModule)(), (0, vrender_core_1.isBrowserEnv)() ? (0,
24
+ exports.version = "0.17.21", (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.17.20\";\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.17.21\";\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
@@ -5293,7 +5293,7 @@
5293
5293
  strokeBoundsBuffer: 0,
5294
5294
  keepDirIn3d: !0
5295
5295
  });
5296
- var DefaultRichTextAttribute = Object.assign(Object.assign({}, DefaultAttribute), {
5296
+ var DefaultRichTextAttribute = Object.assign(Object.assign(Object.assign({}, DefaultAttribute), DefaultTextStyle), {
5297
5297
  width: 300,
5298
5298
  height: 300,
5299
5299
  ellipsis: !0,
@@ -6971,7 +6971,7 @@
6971
6971
  }
6972
6972
  }, {
6973
6973
  key: "removeAllChild",
6974
- value: function removeAllChild() {
6974
+ value: function removeAllChild(deep) {
6975
6975
  if (!this._idMap) return;
6976
6976
  var child = this._firstChild;
6977
6977
  for (; child;) {
@@ -11587,7 +11587,8 @@
11587
11587
  }, {
11588
11588
  key: "tryUpdateGlobalAABBBounds",
11589
11589
  value: function tryUpdateGlobalAABBBounds() {
11590
- return this._globalAABBBounds ? this._globalAABBBounds.setValue(this._AABBBounds.x1, this._AABBBounds.y1, this._AABBBounds.x2, this._AABBBounds.y2) : this._globalAABBBounds = this.AABBBounds.clone(), this.parent && this._globalAABBBounds.transformWithMatrix(this.parent.globalTransMatrix), this._globalAABBBounds;
11590
+ var b = this.AABBBounds;
11591
+ return this._globalAABBBounds ? this._globalAABBBounds.setValue(b.x1, b.y1, b.x2, b.y2) : this._globalAABBBounds = b.clone(), this.parent && this._globalAABBBounds.transformWithMatrix(this.parent.globalTransMatrix), this._globalAABBBounds;
11591
11592
  }
11592
11593
  }, {
11593
11594
  key: "tryUpdateGlobalTransMatrix",
@@ -12893,8 +12894,9 @@
12893
12894
  }, {
12894
12895
  key: "removeAllChild",
12895
12896
  value: function removeAllChild() {
12897
+ var deep = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : !1;
12896
12898
  this.forEachChildren(function (child) {
12897
- application.graphicService.onRemove(child);
12899
+ application.graphicService.onRemove(child), deep && child.isContainer && child.removeAllChild(deep);
12898
12900
  }), _get(_getPrototypeOf(Group.prototype), "removeAllChild", this).call(this), this.addUpdateBoundTag();
12899
12901
  }
12900
12902
  }, {
@@ -16553,28 +16555,47 @@
16553
16555
  value: function getFrameCache() {
16554
16556
  return this.shouldUpdateShape() && (this.doUpdateFrameCache(), this.clearUpdateShapeTag()), this._frameCache;
16555
16557
  }
16558
+ }, {
16559
+ key: "combinedStyleToCharacter",
16560
+ value: function combinedStyleToCharacter(config) {
16561
+ var _this$attribute = this.attribute,
16562
+ fill = _this$attribute.fill,
16563
+ stroke = _this$attribute.stroke,
16564
+ fontSize = _this$attribute.fontSize,
16565
+ fontFamily = _this$attribute.fontFamily,
16566
+ fontStyle = _this$attribute.fontStyle,
16567
+ fontWeight = _this$attribute.fontWeight;
16568
+ return Object.assign({
16569
+ fill: fill,
16570
+ stroke: stroke,
16571
+ fontSize: fontSize,
16572
+ fontFamily: fontFamily,
16573
+ fontStyle: fontStyle,
16574
+ fontWeight: fontWeight
16575
+ }, config);
16576
+ }
16556
16577
  }, {
16557
16578
  key: "doUpdateFrameCache",
16558
16579
  value: function doUpdateFrameCache() {
16559
16580
  var _this2 = this;
16560
16581
  var _a;
16561
- var _this$attribute = this.attribute,
16562
- _this$attribute$textC = _this$attribute.textConfig,
16563
- textConfig = _this$attribute$textC === void 0 ? [] : _this$attribute$textC,
16564
- maxWidth = _this$attribute.maxWidth,
16565
- maxHeight = _this$attribute.maxHeight,
16566
- width = _this$attribute.width,
16567
- height = _this$attribute.height,
16568
- ellipsis = _this$attribute.ellipsis,
16569
- wordBreak = _this$attribute.wordBreak,
16570
- verticalDirection = _this$attribute.verticalDirection,
16571
- textAlign = _this$attribute.textAlign,
16572
- textBaseline = _this$attribute.textBaseline,
16573
- layoutDirection = _this$attribute.layoutDirection,
16574
- singleLine = _this$attribute.singleLine,
16582
+ var _this$attribute2 = this.attribute,
16583
+ _this$attribute2$text = _this$attribute2.textConfig,
16584
+ textConfig = _this$attribute2$text === void 0 ? [] : _this$attribute2$text,
16585
+ maxWidth = _this$attribute2.maxWidth,
16586
+ maxHeight = _this$attribute2.maxHeight,
16587
+ width = _this$attribute2.width,
16588
+ height = _this$attribute2.height,
16589
+ ellipsis = _this$attribute2.ellipsis,
16590
+ wordBreak = _this$attribute2.wordBreak,
16591
+ verticalDirection = _this$attribute2.verticalDirection,
16592
+ textAlign = _this$attribute2.textAlign,
16593
+ textBaseline = _this$attribute2.textBaseline,
16594
+ layoutDirection = _this$attribute2.layoutDirection,
16595
+ singleLine = _this$attribute2.singleLine,
16575
16596
  paragraphs = [];
16576
16597
  for (var i = 0; i < textConfig.length; i++) if ("image" in textConfig[i]) {
16577
- var config = textConfig[i],
16598
+ var config = this.combinedStyleToCharacter(textConfig[i]),
16578
16599
  iconCache = config.id && this._frameCache && this._frameCache.icons && this._frameCache.icons.get(config.id);
16579
16600
  if (iconCache) paragraphs.push(iconCache);else {
16580
16601
  var icon = new RichTextIcon(config);
@@ -16584,7 +16605,7 @@
16584
16605
  }, icon.richtextId = config.id, paragraphs.push(icon);
16585
16606
  }
16586
16607
  } else {
16587
- var richTextConfig = textConfig[i];
16608
+ var richTextConfig = this.combinedStyleToCharacter(textConfig[i]);
16588
16609
  if (isNumber$1(richTextConfig.text) && (richTextConfig.text = "".concat(richTextConfig.text)), richTextConfig.text && richTextConfig.text.includes("\n")) {
16589
16610
  var textParts = richTextConfig.text.split("\n");
16590
16611
  for (var j = 0; j < textParts.length; j++) paragraphs.push(new Paragraph(textParts[j], 0 !== j, richTextConfig));
@@ -23207,6 +23228,8 @@
23207
23228
  var _this = this;
23208
23229
  this.pluginService = context, context.stage.hooks.afterRender.tap(this.key, function (stage) {
23209
23230
  stage && stage === _this.pluginService.stage && _this.drawHTML(context.stage.renderService);
23231
+ }), application.graphicService.hooks.onRemove.tap(this.key, function (graphic) {
23232
+ _this.removeDom(graphic);
23210
23233
  }), application.graphicService.hooks.onRelease.tap(this.key, function (graphic) {
23211
23234
  _this.removeDom(graphic);
23212
23235
  });
@@ -23263,26 +23286,27 @@
23263
23286
  anchorType = _html$anchorType === void 0 ? "boundsLeftTop" : _html$anchorType;
23264
23287
  graphic.bindDom || (graphic.bindDom = new Map());
23265
23288
  var lastDom = graphic.bindDom.get(dom);
23266
- if (lastDom && (!container || container === lastDom.container)) return;
23267
- var nativeDom, nativeContainer;
23268
- graphic.bindDom.forEach(function (_ref) {
23269
- var wrapGroup = _ref.wrapGroup;
23270
- application.global.removeDom(wrapGroup);
23271
- }), "string" == typeof dom ? (nativeDom = new DOMParser().parseFromString(dom, "text/html").firstChild, nativeDom.lastChild && (nativeDom = nativeDom.lastChild.firstChild)) : nativeDom = dom;
23272
- var _container = container || (!0 === stage.params.enableHtmlAttribute ? null : stage.params.enableHtmlAttribute);
23273
- nativeContainer = _container ? "string" == typeof _container ? application.global.getElementById(_container) : _container : graphic.stage.window.getContainer();
23274
- var wrapGroup = application.global.createDom({
23275
- tagName: "div",
23276
- width: width,
23277
- height: height,
23278
- style: style,
23279
- parent: nativeContainer
23280
- });
23281
- wrapGroup && (wrapGroup.appendChild(nativeDom), graphic.bindDom.set(dom, {
23282
- dom: nativeDom,
23283
- container: container,
23284
- wrapGroup: wrapGroup
23285
- })), wrapGroup.style.pointerEvents = "none", wrapGroup.style.position || (wrapGroup.style.position = "absolute", nativeContainer.style.position = "relative");
23289
+ var wrapGroup, nativeContainer;
23290
+ if (!lastDom || container && container !== lastDom.container) {
23291
+ var nativeDom;
23292
+ graphic.bindDom.forEach(function (_ref) {
23293
+ var wrapGroup = _ref.wrapGroup;
23294
+ application.global.removeDom(wrapGroup);
23295
+ }), "string" == typeof dom ? (nativeDom = new DOMParser().parseFromString(dom, "text/html").firstChild, nativeDom.lastChild && (nativeDom = nativeDom.lastChild.firstChild)) : nativeDom = dom;
23296
+ var _container = container || (!0 === stage.params.enableHtmlAttribute ? null : stage.params.enableHtmlAttribute);
23297
+ nativeContainer = _container ? "string" == typeof _container ? application.global.getElementById(_container) : _container : graphic.stage.window.getContainer(), wrapGroup = application.global.createDom({
23298
+ tagName: "div",
23299
+ width: width,
23300
+ height: height,
23301
+ style: style,
23302
+ parent: nativeContainer
23303
+ }), wrapGroup && (wrapGroup.appendChild(nativeDom), graphic.bindDom.set(dom, {
23304
+ dom: nativeDom,
23305
+ container: container,
23306
+ wrapGroup: wrapGroup
23307
+ }));
23308
+ } else wrapGroup = lastDom.wrapGroup, nativeContainer = wrapGroup.parentNode;
23309
+ wrapGroup.style.pointerEvents = "none", wrapGroup.style.position || (wrapGroup.style.position = "absolute", nativeContainer.style.position = "relative");
23286
23310
  var left = 0,
23287
23311
  top = 0;
23288
23312
  var b = graphic.globalAABBBounds;
@@ -35035,7 +35059,7 @@
35035
35059
 
35036
35060
  var roughModule = _roughModule;
35037
35061
 
35038
- const version = "0.17.20";
35062
+ const version = "0.17.21";
35039
35063
  preLoadAllModule();
35040
35064
  if (isBrowserEnv()) {
35041
35065
  loadBrowserEnv(container);