@visactor/vrender 0.19.0 → 0.19.1

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.19.0";
2
+ export declare const version = "0.19.1";
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.19.0", (0, vrender_core_1.preLoadAllModule)(), (0, vrender_core_1.isBrowserEnv)() ? (0,
24
+ exports.version = "0.19.1", (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,QAAQ,CAAC;AAEhC,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.19.0\";\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,QAAQ,CAAC;AAEhC,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.19.1\";\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
@@ -5324,7 +5324,7 @@
5324
5324
  textBaseline: "top",
5325
5325
  layoutDirection: "horizontal",
5326
5326
  textConfig: [],
5327
- forceBreakLine: !1,
5327
+ disableAutoWrapLine: !1,
5328
5328
  maxHeight: void 0,
5329
5329
  maxWidth: void 0,
5330
5330
  singleLine: !1
@@ -15946,7 +15946,8 @@
15946
15946
  top = _this$lines$i2.top,
15947
15947
  _height4 = _this$lines$i2.height;
15948
15948
  if (top + _height4 < this[this.directionKey.top] || top + _height4 > this[this.directionKey.top] + frameHeight) ;else if (this.ellipsis && this.lines[i + 1] && this.lines[i + 1].top + this.lines[i + 1].height > this[this.directionKey.top] + frameHeight) {
15949
- var lineWidth = this.lines[i].getWidthWithEllips();
15949
+ var ellipsis = !0 === this.ellipsis ? "..." : this.ellipsis || "",
15950
+ lineWidth = this.lines[i].getWidthWithEllips(ellipsis);
15950
15951
  lineWidth > widthBound && (widthBound = lineWidth), heightBound += this.lines[i].height;
15951
15952
  } else this.lines[i].actualWidth > widthBound && (widthBound = this.lines[i].actualWidth), heightBound += this.lines[i].height;
15952
15953
  } else {
@@ -15960,7 +15961,8 @@
15960
15961
  y = frameHeight - this.lines[_i5].top - this.lines[_i5].height;
15961
15962
  if (0 === frameHeight) this.lines[_i5].actualWidth > widthBound && (widthBound = this.lines[_i5].actualWidth), heightBound += this.lines[_i5].height;else if (y + _height5 > this[this.directionKey.top] + frameHeight || y < this[this.directionKey.top]) ;else {
15962
15963
  if (this.ellipsis && this.lines[_i5 + 1] && y - this.lines[_i5 + 1].height < this[this.directionKey.top]) {
15963
- var _lineWidth = this.lines[_i5].getWidthWithEllips();
15964
+ var _ellipsis = !0 === this.ellipsis ? "..." : this.ellipsis || "",
15965
+ _lineWidth = this.lines[_i5].getWidthWithEllips(_ellipsis);
15964
15966
  _lineWidth > widthBound && (widthBound = _lineWidth), heightBound += this.lines[_i5].height;
15965
15967
  } else this.lines[_i5].actualWidth > widthBound && (widthBound = this.lines[_i5].actualWidth), heightBound += this.lines[_i5].height;
15966
15968
  }
@@ -15970,7 +15972,8 @@
15970
15972
  _height6 = _this$lines$_i4.height;
15971
15973
  if (0 === frameHeight) this.lines[_i6].actualWidth > widthBound && (widthBound = this.lines[_i6].actualWidth), heightBound += this.lines[_i6].height;else if (_top4 + _height6 < this[this.directionKey.top] || _top4 + _height6 > this[this.directionKey.top] + frameHeight) ;else {
15972
15974
  if (this.ellipsis && this.lines[_i6 + 1] && this.lines[_i6 + 1].top + this.lines[_i6 + 1].height > this[this.directionKey.top] + frameHeight) {
15973
- var _lineWidth2 = this.lines[_i6].getWidthWithEllips();
15975
+ var _ellipsis2 = !0 === this.ellipsis ? "..." : this.ellipsis || "",
15976
+ _lineWidth2 = this.lines[_i6].getWidthWithEllips(_ellipsis2);
15974
15977
  _lineWidth2 > widthBound && (widthBound = _lineWidth2), heightBound += this.lines[_i6].height;
15975
15978
  } else this.lines[_i6].actualWidth > widthBound && (widthBound = this.lines[_i6].actualWidth), heightBound += this.lines[_i6].height;
15976
15979
  }
@@ -15997,7 +16000,7 @@
15997
16000
  var halfDetaHeight = 0,
15998
16001
  deltaAscent = 0,
15999
16002
  deltaDescent = 0;
16000
- this.height > height && (halfDetaHeight = (this.height - height) / 2, deltaAscent = Math.ceil(halfDetaHeight), deltaDescent = Math.floor(halfDetaHeight)), "top" === this.textBaseline ? (this.ascent = halfDetaHeight, this.descent = height - halfDetaHeight) : "bottom" === this.textBaseline ? (this.ascent = height - halfDetaHeight, this.descent = halfDetaHeight) : "middle" === this.textBaseline ? (this.ascent = this.height / 2, this.descent = this.height / 2) : (this.ascent = ascent + deltaAscent, this.descent = descent + deltaDescent), this.length = text.length, this.width = width || 0, this.text = text || "", this.newLine = newLine || !1, this.character = character, this.left = 0, this.top = 0, this.ellipsis = "normal", this.ellipsisWidth = 0, this.ellipsisOtherParagraphWidth = 0, "vertical" === character.direction && (this.direction = character.direction, this.widthOrigin = this.width, this.heightOrigin = this.height, this.width = this.heightOrigin, this.height = this.widthOrigin, this.lineHeight = this.height);
16003
+ this.height > height && (halfDetaHeight = (this.height - height) / 2, deltaAscent = Math.ceil(halfDetaHeight), deltaDescent = Math.floor(halfDetaHeight)), "top" === this.textBaseline ? (this.ascent = halfDetaHeight, this.descent = height - halfDetaHeight) : "bottom" === this.textBaseline ? (this.ascent = height - halfDetaHeight, this.descent = halfDetaHeight) : "middle" === this.textBaseline ? (this.ascent = this.height / 2, this.descent = this.height / 2) : (this.ascent = ascent + deltaAscent, this.descent = descent + deltaDescent), this.length = text.length, this.width = width || 0, this.text = text || "", this.newLine = newLine || !1, this.character = character, this.left = 0, this.top = 0, this.ellipsis = "normal", this.ellipsisWidth = 0, this.ellipsisOtherParagraphWidth = 0, "vertical" === character.direction && (this.direction = character.direction, this.widthOrigin = this.width, this.heightOrigin = this.height, this.width = this.heightOrigin, this.height = this.widthOrigin, this.lineHeight = this.height), this.ellipsisStr = "...";
16001
16004
  }
16002
16005
  return _createClass(Paragraph, [{
16003
16006
  key: "updateWidth",
@@ -16013,11 +16016,11 @@
16013
16016
  left = this.left + deltaLeft;
16014
16017
  baseline += this.top;
16015
16018
  var direction = this.direction;
16016
- if (this.verticalEllipsis) text = "...", direction = "vertical", baseline -= this.ellipsisWidth / 2;else {
16019
+ if (this.verticalEllipsis) text = this.ellipsisStr, direction = "vertical", baseline -= this.ellipsisWidth / 2;else {
16017
16020
  if ("hide" === this.ellipsis) return;
16018
- if ("add" === this.ellipsis) text += "...", "right" !== textAlign && "end" !== textAlign || (left -= this.ellipsisWidth);else if ("replace" === this.ellipsis) {
16021
+ if ("add" === this.ellipsis) text += this.ellipsisStr, "right" !== textAlign && "end" !== textAlign || (left -= this.ellipsisWidth);else if ("replace" === this.ellipsis) {
16019
16022
  var index = getStrByWithCanvas(text, ("vertical" === direction ? this.height : this.width) - this.ellipsisWidth + this.ellipsisOtherParagraphWidth, this.character, text.length - 1);
16020
- if (text = text.slice(0, index), text += "...", "right" === textAlign || "end" === textAlign) {
16023
+ if (text = text.slice(0, index), text += this.ellipsisStr, "right" === textAlign || "end" === textAlign) {
16021
16024
  var _measureTextCanvas3 = measureTextCanvas(this.text.slice(index), this.character),
16022
16025
  width = _measureTextCanvas3.width;
16023
16026
  "vertical" === direction || (left -= this.ellipsisWidth - width);
@@ -16042,7 +16045,7 @@
16042
16045
  if ("add" === this.ellipsis) return width + this.ellipsisWidth;
16043
16046
  if ("replace" === this.ellipsis) {
16044
16047
  var index = getStrByWithCanvas(text, width - this.ellipsisWidth + this.ellipsisOtherParagraphWidth, this.character, text.length - 1);
16045
- text = text.slice(0, index), text += "...";
16048
+ text = text.slice(0, index), text += this.ellipsisStr;
16046
16049
  var _measureTextCanvas4 = measureTextCanvas(this.text.slice(index), this.character),
16047
16050
  measureWidth = _measureTextCanvas4.width;
16048
16051
  return width + this.ellipsisWidth - measureWidth;
@@ -16288,11 +16291,13 @@
16288
16291
  paragraph.verticalEllipsis = !0;
16289
16292
  break;
16290
16293
  }
16291
- var _measureTextCanvas = measureTextCanvas("...", paragraph.character),
16294
+ var ellipsis = !0 === drawEllipsis ? "..." : drawEllipsis || "";
16295
+ paragraph.ellipsisStr = ellipsis;
16296
+ var _measureTextCanvas = measureTextCanvas(ellipsis, paragraph.character),
16292
16297
  width = _measureTextCanvas.width,
16293
16298
  ellipsisWidth = width || 0;
16294
16299
  if (ellipsisWidth <= this.blankWidth + otherParagraphWidth) {
16295
- paragraph.ellipsis = "add";
16300
+ lastLine && (paragraph.ellipsis = "add");
16296
16301
  break;
16297
16302
  }
16298
16303
  if (ellipsisWidth <= this.blankWidth + otherParagraphWidth + paragraph.width) {
@@ -16312,13 +16317,13 @@
16312
16317
  }
16313
16318
  }, {
16314
16319
  key: "getWidthWithEllips",
16315
- value: function getWidthWithEllips() {
16320
+ value: function getWidthWithEllips(ellipsis) {
16316
16321
  var _this3 = this;
16317
16322
  var otherParagraphWidth = 0;
16318
16323
  for (var i = this.paragraphs.length - 1; i >= 0; i--) {
16319
16324
  var paragraph = this.paragraphs[i];
16320
16325
  if (paragraph instanceof RichTextIcon) break;
16321
- var _measureTextCanvas2 = measureTextCanvas("...", paragraph.character),
16326
+ var _measureTextCanvas2 = measureTextCanvas(ellipsis, paragraph.character),
16322
16327
  _width = _measureTextCanvas2.width,
16323
16328
  ellipsisWidth = _width || 0;
16324
16329
  if (ellipsisWidth <= this.blankWidth + otherParagraphWidth) {
@@ -16565,7 +16570,7 @@
16565
16570
  textBaseline = _this$attribute2.textBaseline,
16566
16571
  layoutDirection = _this$attribute2.layoutDirection,
16567
16572
  singleLine = _this$attribute2.singleLine,
16568
- forceBreakLine = _this$attribute2.forceBreakLine,
16573
+ disableAutoWrapLine = _this$attribute2.disableAutoWrapLine,
16569
16574
  paragraphs = [];
16570
16575
  for (var i = 0; i < textConfig.length; i++) if ("image" in textConfig[i]) {
16571
16576
  var config = this.combinedStyleToCharacter(textConfig[i]),
@@ -16590,12 +16595,12 @@
16590
16595
  richTextHeightEnable = "number" == typeof height && Number.isFinite(height) && height > 0 && (!maxHeightFinite || height <= maxHeight),
16591
16596
  frame = new Frame(0, 0, (richTextWidthEnable ? width : maxWidthFinite ? maxWidth : 0) || 0, (richTextHeightEnable ? height : maxHeightFinite ? maxHeight : 0) || 0, ellipsis, wordBreak, verticalDirection, textAlign, textBaseline, layoutDirection || "horizontal", !richTextWidthEnable && maxWidthFinite, !richTextHeightEnable && maxHeightFinite, singleLine || !1, null === (_a = this._frameCache) || void 0 === _a ? void 0 : _a.icons),
16592
16597
  wrapper = new Wrapper(frame);
16593
- if (forceBreakLine) {
16598
+ if (disableAutoWrapLine) {
16594
16599
  var lineCount = 0,
16595
16600
  skip = !1;
16596
16601
  for (var _i = 0; _i < paragraphs.length; _i++) {
16597
16602
  var p = paragraphs[_i];
16598
- skip ? (p.overflow = !0, p.left = 1 / 0, p.top = 1 / 0, !p.newLine && frame.lines[frame.lines.length - 1].paragraphs.push(p)) : wrapper.deal(p), frame.lines.length !== lineCount && (lineCount = frame.lines.length, wrapper.lineBuffer.length = 0, p.overflow = !0, p.left = 1e3, p.top = 1e3, frame.lines[frame.lines.length - 1].paragraphs.push(p), skip = !0), p.newLine && (skip = !1);
16603
+ skip ? (p.overflow = !0, p.left = 1 / 0, p.top = 1 / 0, !p.newLine && frame.lines[frame.lines.length - 1].paragraphs.push(p)) : wrapper.deal(p), frame.lines.length !== lineCount && (lineCount = frame.lines.length, wrapper.lineBuffer.length = 0, p.overflow = !0, p.left = 1e3, p.top = 1e3, frame.lines[frame.lines.length - 1].paragraphs.push(p), skip = !0), p.newLine && (skip = !1, wrapper.lineWidth = 0);
16599
16604
  }
16600
16605
  } else for (var _i2 = 0; _i2 < paragraphs.length; _i2++) wrapper.deal(paragraphs[_i2]);
16601
16606
  wrapper.send();
@@ -21422,6 +21427,13 @@
21422
21427
  key: "beforeDrawInteractive",
21423
21428
  value: function beforeDrawInteractive(graphic, renderService, drawContext, drawContribution, params) {
21424
21429
  var baseGraphic = graphic.baseGraphic;
21430
+ if (!baseGraphic.stage) {
21431
+ var interactiveLayer = drawContext.stage.getLayer("_builtin_interactive");
21432
+ if (interactiveLayer) {
21433
+ this.getShadowRoot(interactiveLayer).removeChild(graphic);
21434
+ }
21435
+ return !0;
21436
+ }
21425
21437
  if (baseGraphic) {
21426
21438
  this.processing = !0;
21427
21439
  var context = drawContext.context;
@@ -35125,7 +35137,7 @@
35125
35137
 
35126
35138
  var roughModule = _roughModule;
35127
35139
 
35128
- const version = "0.19.0";
35140
+ const version = "0.19.1";
35129
35141
  preLoadAllModule();
35130
35142
  if (isBrowserEnv()) {
35131
35143
  loadBrowserEnv(container);