@visactor/vrender-core 0.16.14-alpha.6 → 0.16.14

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.
Files changed (55) hide show
  1. package/cjs/common/utils.d.ts +1 -0
  2. package/cjs/common/utils.js +10 -1
  3. package/cjs/common/utils.js.map +1 -1
  4. package/cjs/core/stage.d.ts +1 -0
  5. package/cjs/core/stage.js +7 -3
  6. package/cjs/core/stage.js.map +1 -1
  7. package/cjs/graphic/builtin-symbol/index.d.ts +1 -0
  8. package/cjs/graphic/builtin-symbol/index.js +8 -2
  9. package/cjs/graphic/builtin-symbol/index.js.map +1 -1
  10. package/cjs/graphic/config.js +4 -1
  11. package/cjs/graphic/config.js.map +1 -1
  12. package/cjs/graphic/richtext/paragraph.js +12 -11
  13. package/cjs/graphic/richtext/paragraph.js.map +1 -1
  14. package/cjs/graphic/symbol.js +3 -2
  15. package/cjs/graphic/symbol.js.map +1 -1
  16. package/cjs/graphic/text.d.ts +1 -0
  17. package/cjs/graphic/text.js +93 -7
  18. package/cjs/graphic/text.js.map +1 -1
  19. package/cjs/graphic/wrap-text.js +6 -5
  20. package/cjs/graphic/wrap-text.js.map +1 -1
  21. package/cjs/interface/graphic/richText.d.ts +1 -1
  22. package/cjs/interface/graphic/richText.js.map +1 -1
  23. package/cjs/interface/graphic/text.d.ts +4 -1
  24. package/cjs/interface/graphic/text.js.map +1 -1
  25. package/cjs/render/contributions/render/text-render.js +2 -2
  26. package/cjs/render/contributions/render/text-render.js.map +1 -1
  27. package/dist/index.js +176 -18
  28. package/dist/index.min.js +1 -1
  29. package/es/common/utils.d.ts +1 -0
  30. package/es/common/utils.js +8 -1
  31. package/es/common/utils.js.map +1 -1
  32. package/es/core/stage.d.ts +1 -0
  33. package/es/core/stage.js +7 -3
  34. package/es/core/stage.js.map +1 -1
  35. package/es/graphic/builtin-symbol/index.d.ts +1 -0
  36. package/es/graphic/builtin-symbol/index.js +8 -0
  37. package/es/graphic/builtin-symbol/index.js.map +1 -1
  38. package/es/graphic/config.js +4 -1
  39. package/es/graphic/config.js.map +1 -1
  40. package/es/graphic/richtext/paragraph.js +5 -2
  41. package/es/graphic/richtext/paragraph.js.map +1 -1
  42. package/es/graphic/symbol.js +4 -3
  43. package/es/graphic/symbol.js.map +1 -1
  44. package/es/graphic/text.d.ts +1 -0
  45. package/es/graphic/text.js +90 -9
  46. package/es/graphic/text.js.map +1 -1
  47. package/es/graphic/wrap-text.js +6 -4
  48. package/es/graphic/wrap-text.js.map +1 -1
  49. package/es/interface/graphic/richText.d.ts +1 -1
  50. package/es/interface/graphic/richText.js.map +1 -1
  51. package/es/interface/graphic/text.d.ts +4 -1
  52. package/es/interface/graphic/text.js.map +1 -1
  53. package/es/render/contributions/render/text-render.js +3 -1
  54. package/es/render/contributions/render/text-render.js.map +1 -1
  55. package/package.json +4 -4
package/dist/index.js CHANGED
@@ -4294,7 +4294,10 @@
4294
4294
  direction: 'horizontal',
4295
4295
  wordBreak: 'break-all',
4296
4296
  ignoreBuf: false,
4297
- verticalMode: 0
4297
+ verticalMode: 0,
4298
+ whiteSpace: 'no-wrap',
4299
+ heightLimit: Infinity,
4300
+ lineClamp: Infinity
4298
4301
  };
4299
4302
  const DefaultStyle = Object.assign(Object.assign(Object.assign({ opacity: 1, background: null, texture: null, textureColor: 'black', textureSize: 10, texturePadding: 2, backgroundMode: 0, blur: 0, cursor: null, html: null }, DefaultFillStyle), DefaultStrokeStyle), DefaultLayout);
4300
4303
  const DefaultConnectAttribute = {
@@ -9013,6 +9016,13 @@
9013
9016
  }
9014
9017
  RafBasedSTO.TimeOut = 1000 / 60;
9015
9018
  const rafBasedSto = new RafBasedSTO();
9019
+ const calculateLineHeight = (lineHeight, fontSize) => {
9020
+ if (vutils.isString(lineHeight) && lineHeight[lineHeight.length - 1] === '%') {
9021
+ const scale = Number.parseFloat(lineHeight.substring(0, lineHeight.length - 1)) / 100;
9022
+ return fontSize * scale;
9023
+ }
9024
+ return lineHeight;
9025
+ };
9016
9026
 
9017
9027
  class IncreaseCount extends ACustomAnimate {
9018
9028
  constructor(from, to, duration, easing, params) {
@@ -14314,6 +14324,8 @@
14314
14324
  const TEXT_UPDATE_TAG_KEY = [
14315
14325
  'text',
14316
14326
  'maxLineWidth',
14327
+ 'heightLimit',
14328
+ 'lineClamp',
14317
14329
  'fontSize',
14318
14330
  'fontFamily',
14319
14331
  'fontWeight',
@@ -14398,6 +14410,113 @@
14398
14410
  this.clearUpdateBoundTag();
14399
14411
  return bounds;
14400
14412
  }
14413
+ updateWrapAABBBounds(text) {
14414
+ var _a, _b, _c, _d;
14415
+ const textTheme = getTheme(this).text;
14416
+ const { fontFamily = textTheme.fontFamily, textAlign = textTheme.textAlign, textBaseline = textTheme.textBaseline, fontSize = textTheme.fontSize, ellipsis = textTheme.ellipsis, maxLineWidth, stroke = textTheme.stroke, lineWidth = textTheme.lineWidth, wordBreak = textTheme.wordBreak, fontWeight = textTheme.fontWeight, ignoreBuf = textTheme.ignoreBuf, heightLimit = 0, lineClamp } = this.attribute;
14417
+ const lineHeight = (_a = calculateLineHeight(this.attribute.lineHeight, this.attribute.fontSize || textTheme.fontSize)) !== null && _a !== void 0 ? _a : (this.attribute.fontSize || textTheme.fontSize);
14418
+ const buf = ignoreBuf ? 0 : 2;
14419
+ if (!this.shouldUpdateShape() && ((_b = this.cache) === null || _b === void 0 ? void 0 : _b.layoutData)) {
14420
+ const bbox = this.cache.layoutData.bbox;
14421
+ this._AABBBounds.set(bbox.xOffset, bbox.yOffset, bbox.xOffset + bbox.width, bbox.yOffset + bbox.height);
14422
+ if (stroke) {
14423
+ this._AABBBounds.expand(lineWidth / 2);
14424
+ }
14425
+ return this._AABBBounds;
14426
+ }
14427
+ const textMeasure = application.graphicUtil.textMeasure;
14428
+ const layoutObj = new CanvasTextLayout(fontFamily, { fontSize, fontWeight, fontFamily }, textMeasure);
14429
+ const lines = vutils.isArray(text) ? text.map(l => l.toString()) : [text.toString()];
14430
+ const linesLayout = [];
14431
+ const bboxWH = [0, 0];
14432
+ let lineCountLimit = Infinity;
14433
+ if (heightLimit > 0) {
14434
+ lineCountLimit = Math.max(Math.floor(heightLimit / lineHeight), 1);
14435
+ }
14436
+ if (lineClamp) {
14437
+ lineCountLimit = Math.min(lineCountLimit, lineClamp);
14438
+ }
14439
+ if (typeof maxLineWidth === 'number' && maxLineWidth !== Infinity) {
14440
+ if (maxLineWidth > 0) {
14441
+ for (let i = 0; i < lines.length; i++) {
14442
+ const str = lines[i];
14443
+ let needCut = true;
14444
+ if (i === lineCountLimit - 1) {
14445
+ const clip = layoutObj.textMeasure.clipTextWithSuffix(str, layoutObj.textOptions, maxLineWidth, ellipsis, false);
14446
+ linesLayout.push({
14447
+ str: clip.str,
14448
+ width: clip.width
14449
+ });
14450
+ break;
14451
+ }
14452
+ const clip = layoutObj.textMeasure.clipText(str, layoutObj.textOptions, maxLineWidth, wordBreak === 'break-word');
14453
+ if (str !== '' && clip.str === '') {
14454
+ if (ellipsis) {
14455
+ const clipEllipsis = layoutObj.textMeasure.clipTextWithSuffix(str, layoutObj.textOptions, maxLineWidth, ellipsis, false);
14456
+ clip.str = (_c = clipEllipsis.str) !== null && _c !== void 0 ? _c : '';
14457
+ clip.width = (_d = clipEllipsis.width) !== null && _d !== void 0 ? _d : 0;
14458
+ }
14459
+ else {
14460
+ clip.str = '';
14461
+ clip.width = 0;
14462
+ }
14463
+ needCut = false;
14464
+ }
14465
+ linesLayout.push({
14466
+ str: clip.str,
14467
+ width: clip.width
14468
+ });
14469
+ if (clip.str.length === str.length) ;
14470
+ else if (needCut) {
14471
+ const newStr = str.substring(clip.str.length);
14472
+ lines.splice(i + 1, 0, newStr);
14473
+ }
14474
+ }
14475
+ }
14476
+ let maxWidth = 0;
14477
+ linesLayout.forEach(layout => {
14478
+ maxWidth = Math.max(maxWidth, layout.width);
14479
+ });
14480
+ bboxWH[0] = maxWidth;
14481
+ }
14482
+ else {
14483
+ let lineWidth = 0;
14484
+ let width;
14485
+ let text;
14486
+ for (let i = 0, len = lines.length; i < len; i++) {
14487
+ if (i === lineCountLimit - 1) {
14488
+ const clip = layoutObj.textMeasure.clipTextWithSuffix(lines[i], layoutObj.textOptions, maxLineWidth, ellipsis, false);
14489
+ linesLayout.push({
14490
+ str: clip.str,
14491
+ width: clip.width
14492
+ });
14493
+ lineWidth = Math.max(lineWidth, clip.width);
14494
+ break;
14495
+ }
14496
+ text = lines[i];
14497
+ width = layoutObj.textMeasure.measureTextWidth(text, layoutObj.textOptions, wordBreak === 'break-word');
14498
+ lineWidth = Math.max(lineWidth, width);
14499
+ linesLayout.push({ str: text, width });
14500
+ }
14501
+ bboxWH[0] = lineWidth;
14502
+ }
14503
+ bboxWH[1] = linesLayout.length * (lineHeight + buf);
14504
+ const bbox = {
14505
+ xOffset: 0,
14506
+ yOffset: 0,
14507
+ width: bboxWH[0],
14508
+ height: bboxWH[1]
14509
+ };
14510
+ layoutObj.LayoutBBox(bbox, textAlign, textBaseline);
14511
+ const layoutData = layoutObj.layoutWithBBox(bbox, linesLayout, textAlign, textBaseline, lineHeight);
14512
+ this.cache.layoutData = layoutData;
14513
+ this.clearUpdateShapeTag();
14514
+ this._AABBBounds.set(bbox.xOffset, bbox.yOffset, bbox.xOffset + bbox.width, bbox.yOffset + bbox.height);
14515
+ if (stroke) {
14516
+ this._AABBBounds.expand(lineWidth / 2);
14517
+ }
14518
+ return this._AABBBounds;
14519
+ }
14401
14520
  updateSingallineAABBBounds(text) {
14402
14521
  const textTheme = getTheme(this).text;
14403
14522
  const { direction = textTheme.direction } = this.attribute;
@@ -14419,9 +14538,13 @@
14419
14538
  let width;
14420
14539
  let str;
14421
14540
  const attribute = this.attribute;
14422
- const { maxLineWidth = textTheme.maxLineWidth, ellipsis = textTheme.ellipsis, textAlign = textTheme.textAlign, textBaseline = textTheme.textBaseline, fontFamily = textTheme.fontFamily, fontSize = textTheme.fontSize, fontWeight = textTheme.fontWeight, stroke = textTheme.stroke, lineWidth = textTheme.lineWidth, wordBreak = textTheme.wordBreak, ignoreBuf = textTheme.ignoreBuf } = attribute;
14541
+ const { maxLineWidth = textTheme.maxLineWidth, ellipsis = textTheme.ellipsis, textAlign = textTheme.textAlign, textBaseline = textTheme.textBaseline, fontFamily = textTheme.fontFamily, fontSize = textTheme.fontSize, fontWeight = textTheme.fontWeight, stroke = textTheme.stroke, lineWidth = textTheme.lineWidth, wordBreak = textTheme.wordBreak, ignoreBuf = textTheme.ignoreBuf, whiteSpace = textTheme.whiteSpace } = attribute;
14542
+ if (whiteSpace === 'normal') {
14543
+ return this.updateWrapAABBBounds(text);
14544
+ }
14423
14545
  const buf = ignoreBuf ? 0 : Math.max(2, fontSize * 0.075);
14424
- const { lineHeight = (_a = attribute.lineHeight) !== null && _a !== void 0 ? _a : (attribute.fontSize || textTheme.fontSize) + buf } = attribute;
14546
+ const textFontSize = attribute.fontSize || textTheme.fontSize;
14547
+ const lineHeight = (_a = calculateLineHeight(attribute.lineHeight, textFontSize)) !== null && _a !== void 0 ? _a : textFontSize + buf;
14425
14548
  if (!this.shouldUpdateShape() && this.cache) {
14426
14549
  width = (_b = this.cache.clipedWidth) !== null && _b !== void 0 ? _b : 0;
14427
14550
  const dx = textDrawOffsetX(textAlign, width);
@@ -14479,7 +14602,8 @@
14479
14602
  const attribute = this.attribute;
14480
14603
  const { ignoreBuf = textTheme.ignoreBuf } = attribute;
14481
14604
  const buf = ignoreBuf ? 0 : 2;
14482
- const { maxLineWidth = textTheme.maxLineWidth, ellipsis = textTheme.ellipsis, fontSize = textTheme.fontSize, fontWeight = textTheme.fontWeight, fontFamily = textTheme.fontFamily, stroke = textTheme.stroke, lineHeight = (_a = attribute.lineHeight) !== null && _a !== void 0 ? _a : (attribute.fontSize || textTheme.fontSize) + buf, lineWidth = textTheme.lineWidth, verticalMode = textTheme.verticalMode } = attribute;
14605
+ const { maxLineWidth = textTheme.maxLineWidth, ellipsis = textTheme.ellipsis, fontSize = textTheme.fontSize, fontWeight = textTheme.fontWeight, fontFamily = textTheme.fontFamily, stroke = textTheme.stroke, lineWidth = textTheme.lineWidth, verticalMode = textTheme.verticalMode } = attribute;
14606
+ const lineHeight = (_a = calculateLineHeight(attribute.lineHeight, attribute.fontSize || textTheme.fontSize)) !== null && _a !== void 0 ? _a : (attribute.fontSize || textTheme.fontSize) + buf;
14483
14607
  let { textAlign = textTheme.textAlign, textBaseline = textTheme.textBaseline } = attribute;
14484
14608
  if (!verticalMode) {
14485
14609
  const t = textAlign;
@@ -14536,11 +14660,15 @@
14536
14660
  return this._AABBBounds;
14537
14661
  }
14538
14662
  updateHorizontalMultilineAABBBounds(text) {
14539
- var _a;
14663
+ var _a, _b;
14540
14664
  const textTheme = getTheme(this).text;
14541
14665
  const attribute = this.attribute;
14542
- const { fontFamily = textTheme.fontFamily, textAlign = textTheme.textAlign, textBaseline = textTheme.textBaseline, fontSize = textTheme.fontSize, fontWeight = textTheme.fontWeight, lineHeight = attribute.lineHeight || attribute.fontSize || textTheme.fontSize, ellipsis = textTheme.ellipsis, maxLineWidth, stroke = textTheme.stroke, lineWidth = textTheme.lineWidth, wordBreak = textTheme.wordBreak } = attribute;
14543
- if (!this.shouldUpdateShape() && ((_a = this.cache) === null || _a === void 0 ? void 0 : _a.layoutData)) {
14666
+ const { fontFamily = textTheme.fontFamily, textAlign = textTheme.textAlign, textBaseline = textTheme.textBaseline, fontSize = textTheme.fontSize, fontWeight = textTheme.fontWeight, ellipsis = textTheme.ellipsis, maxLineWidth, stroke = textTheme.stroke, lineWidth = textTheme.lineWidth, whiteSpace = textTheme.whiteSpace } = attribute;
14667
+ const lineHeight = (_a = calculateLineHeight(attribute.lineHeight, attribute.fontSize || textTheme.fontSize)) !== null && _a !== void 0 ? _a : (attribute.fontSize || textTheme.fontSize);
14668
+ if (whiteSpace === 'normal') {
14669
+ return this.updateWrapAABBBounds(text);
14670
+ }
14671
+ if (!this.shouldUpdateShape() && ((_b = this.cache) === null || _b === void 0 ? void 0 : _b.layoutData)) {
14544
14672
  const bbox = this.cache.layoutData.bbox;
14545
14673
  this._AABBBounds.set(bbox.xOffset, bbox.yOffset, bbox.xOffset + bbox.width, bbox.yOffset + bbox.height);
14546
14674
  if (stroke) {
@@ -14568,7 +14696,8 @@
14568
14696
  const attribute = this.attribute;
14569
14697
  const { ignoreBuf = textTheme.ignoreBuf } = attribute;
14570
14698
  const buf = ignoreBuf ? 0 : 2;
14571
- const { maxLineWidth = textTheme.maxLineWidth, ellipsis = textTheme.ellipsis, fontFamily = textTheme.fontFamily, fontSize = textTheme.fontSize, fontWeight = textTheme.fontWeight, stroke = textTheme.stroke, lineHeight = (_a = attribute.lineHeight) !== null && _a !== void 0 ? _a : (attribute.fontSize || textTheme.fontSize) + buf, lineWidth = textTheme.lineWidth, verticalMode = textTheme.verticalMode } = attribute;
14699
+ const { maxLineWidth = textTheme.maxLineWidth, ellipsis = textTheme.ellipsis, fontFamily = textTheme.fontFamily, fontSize = textTheme.fontSize, fontWeight = textTheme.fontWeight, stroke = textTheme.stroke, lineWidth = textTheme.lineWidth, verticalMode = textTheme.verticalMode } = attribute;
14700
+ const lineHeight = (_a = calculateLineHeight(attribute.lineHeight, attribute.fontSize || textTheme.fontSize)) !== null && _a !== void 0 ? _a : (attribute.fontSize || textTheme.fontSize) + buf;
14572
14701
  let { textAlign = textTheme.textAlign, textBaseline = textTheme.textBaseline } = attribute;
14573
14702
  if (!verticalMode) {
14574
14703
  const t = textAlign;
@@ -14675,11 +14804,12 @@
14675
14804
  return text != null && text !== '';
14676
14805
  }
14677
14806
  updateMultilineAABBBounds(text) {
14678
- var _a, _b, _c;
14807
+ var _a, _b, _c, _d;
14679
14808
  const textTheme = getTheme(this).text;
14680
- const { fontFamily = textTheme.fontFamily, textAlign = textTheme.textAlign, textBaseline = textTheme.textBaseline, fontSize = textTheme.fontSize, lineHeight = this.attribute.lineHeight || this.attribute.fontSize || textTheme.fontSize, ellipsis = textTheme.ellipsis, maxLineWidth, stroke = textTheme.stroke, lineWidth = textTheme.lineWidth, wordBreak = textTheme.wordBreak, fontWeight = textTheme.fontWeight, ignoreBuf = textTheme.ignoreBuf, heightLimit = 0, lineClamp } = this.attribute;
14809
+ const { fontFamily = textTheme.fontFamily, textAlign = textTheme.textAlign, textBaseline = textTheme.textBaseline, fontSize = textTheme.fontSize, ellipsis = textTheme.ellipsis, maxLineWidth, stroke = textTheme.stroke, lineWidth = textTheme.lineWidth, wordBreak = textTheme.wordBreak, fontWeight = textTheme.fontWeight, ignoreBuf = textTheme.ignoreBuf, heightLimit = 0, lineClamp } = this.attribute;
14810
+ const lineHeight = (_a = calculateLineHeight(this.attribute.lineHeight, this.attribute.fontSize || textTheme.fontSize)) !== null && _a !== void 0 ? _a : (this.attribute.fontSize || textTheme.fontSize);
14681
14811
  const buf = ignoreBuf ? 0 : 2;
14682
- if (!this.shouldUpdateShape() && ((_a = this.cache) === null || _a === void 0 ? void 0 : _a.layoutData)) {
14812
+ if (!this.shouldUpdateShape() && ((_b = this.cache) === null || _b === void 0 ? void 0 : _b.layoutData)) {
14683
14813
  const bbox = this.cache.layoutData.bbox;
14684
14814
  this._AABBBounds.set(bbox.xOffset, bbox.yOffset, bbox.xOffset + bbox.width, bbox.yOffset + bbox.height);
14685
14815
  if (stroke) {
@@ -14716,8 +14846,8 @@
14716
14846
  if (str !== '' && clip.str === '') {
14717
14847
  if (ellipsis) {
14718
14848
  const clipEllipsis = layoutObj.textMeasure.clipTextWithSuffix(str, layoutObj.textOptions, maxLineWidth, ellipsis, false);
14719
- clip.str = (_b = clipEllipsis.str) !== null && _b !== void 0 ? _b : '';
14720
- clip.width = (_c = clipEllipsis.width) !== null && _c !== void 0 ? _c : 0;
14849
+ clip.str = (_c = clipEllipsis.str) !== null && _c !== void 0 ? _c : '';
14850
+ clip.width = (_d = clipEllipsis.width) !== null && _d !== void 0 ? _d : 0;
14721
14851
  }
14722
14852
  else {
14723
14853
  clip.str = '';
@@ -15559,6 +15689,13 @@
15559
15689
  builtinSymbols.forEach(symbol => {
15560
15690
  builtinSymbolsMap[symbol.type] = symbol;
15561
15691
  });
15692
+ const builtInSymbolStrMap = {
15693
+ arrowLeft: 'M 0.25 -0.5 L -0.25 0 l 0.5 0.5',
15694
+ arrowRight: 'M -0.25 -0.5 l 0.5 0.5 l -0.5 0.5',
15695
+ rect: 'M -0.5,0.25 L 0.5,0.25 L 0.5,-0.25,L -0.5,-0.25 Z',
15696
+ rectRound: 'M 0.3 -0.5 C 0.41 -0.5 0.5 -0.41 0.5 -0.3 C 0.5 -0.3 0.5 0.3 0.5 0.3 C 0.5 0.41 0.41 0.5 0.3 0.5 C 0.3 0.5 -0.3 0.5 -0.3 0.5 C -0.41 0.5 -0.5 0.41 -0.5 0.3 C -0.5 0.3 -0.5 -0.3 -0.5 -0.3 C -0.5 -0.41 -0.41 -0.5 -0.3 -0.5 C -0.3 -0.5 0.3 -0.5 0.3 -0.5 Z',
15697
+ roundLine: 'M 1.2392 -0.258 L -1.3432 -0.258 C -1.4784 -0.258 -1.588 -0.1436 -1.588 -0.002 c 0 0.1416 0.1096 0.256 0.2448 0.256 l 2.5824 0 c 0.1352 0 0.2448 -0.1144 0.2448 -0.256 C 1.484 -0.1436 1.3744 -0.258 1.2392 -0.258 z'
15698
+ };
15562
15699
 
15563
15700
  const SYMBOL_UPDATE_TAG_KEY = ['symbolType', 'size', ...GRAPHIC_UPDATE_TAG_KEY];
15564
15701
  let Symbol$1 = class Symbol extends Graphic {
@@ -15583,7 +15720,7 @@
15583
15720
  }
15584
15721
  doUpdateParsedPath() {
15585
15722
  const symbolTheme = getTheme(this).symbol;
15586
- const { symbolType = symbolTheme.symbolType } = this.attribute;
15723
+ let { symbolType = symbolTheme.symbolType } = this.attribute;
15587
15724
  let path = builtinSymbolsMap[symbolType];
15588
15725
  if (path) {
15589
15726
  this._parsedPath = path;
@@ -15594,6 +15731,8 @@
15594
15731
  this._parsedPath = path;
15595
15732
  return path;
15596
15733
  }
15734
+ const _symbolType = builtInSymbolStrMap[symbolType];
15735
+ symbolType = _symbolType || symbolType;
15597
15736
  const valid = isSvg(symbolType);
15598
15737
  if (valid === true) {
15599
15738
  const parser = new XMLParser();
@@ -16343,8 +16482,9 @@
16343
16482
  constructor(text, newLine, character) {
16344
16483
  this.fontSize = character.fontSize || 16;
16345
16484
  this.textBaseline = character.textBaseline || 'alphabetic';
16346
- if (typeof character.lineHeight === 'number') {
16347
- this.lineHeight = character.lineHeight > this.fontSize ? character.lineHeight : this.fontSize;
16485
+ const lineHeight = calculateLineHeight(character.lineHeight, this.fontSize);
16486
+ if (typeof lineHeight === 'number') {
16487
+ this.lineHeight = lineHeight > this.fontSize ? lineHeight : this.fontSize;
16348
16488
  }
16349
16489
  else {
16350
16490
  this.lineHeight = Math.floor(1.2 * this.fontSize);
@@ -20861,7 +21001,7 @@
20861
21001
  textAlign = (_a = text.getBaselineMapAlign()[textBaseline]) !== null && _a !== void 0 ? _a : 'left';
20862
21002
  textBaseline = (_b = text.getAlignMapBaseline()[t]) !== null && _b !== void 0 ? _b : 'top';
20863
21003
  }
20864
- const lineHeight = (_c = text.attribute.lineHeight) !== null && _c !== void 0 ? _c : fontSize;
21004
+ const lineHeight = (_c = calculateLineHeight(text.attribute.lineHeight, fontSize)) !== null && _c !== void 0 ? _c : fontSize;
20865
21005
  const data = this.valid(text, textAttribute, fillCb, strokeCb);
20866
21006
  if (!data) {
20867
21007
  return;
@@ -26124,6 +26264,19 @@
26124
26264
  this.setAttributes({ background: this._background });
26125
26265
  }
26126
26266
  }
26267
+ preventRender(prevent) {
26268
+ if (prevent) {
26269
+ this._skipRender = -Infinity;
26270
+ }
26271
+ else {
26272
+ if (this.params && this.params.optimize && this.params.optimize.skipRenderWithOutRange !== false) {
26273
+ this._skipRender = this.window.isVisible() ? 0 : 1;
26274
+ }
26275
+ else {
26276
+ this._skipRender = 0;
26277
+ }
26278
+ }
26279
+ }
26127
26280
  optmize(params) {
26128
26281
  this.optmizeRender(params === null || params === void 0 ? void 0 : params.skipRenderWithOutRange);
26129
26282
  }
@@ -26131,8 +26284,11 @@
26131
26284
  if (!skipRenderWithOutRange) {
26132
26285
  return;
26133
26286
  }
26134
- this._skipRender = this.window.isVisible() ? 0 : 1;
26287
+ this._skipRender = this._skipRender < 0 ? this._skipRender : this.window.isVisible() ? 0 : 1;
26135
26288
  this.window.onVisibleChange(visible => {
26289
+ if (this._skipRender < 0) {
26290
+ return;
26291
+ }
26136
26292
  if (visible) {
26137
26293
  if (this.dirtyBounds) {
26138
26294
  this.dirtyBounds.setValue(0, 0, this._viewBox.width(), this._viewBox.height());
@@ -27497,9 +27653,11 @@
27497
27653
  exports.bindContributionProvider = bindContributionProvider;
27498
27654
  exports.bindContributionProviderNoSingletonScope = bindContributionProviderNoSingletonScope;
27499
27655
  exports.boundStroke = boundStroke;
27656
+ exports.builtInSymbolStrMap = builtInSymbolStrMap;
27500
27657
  exports.builtinSymbols = builtinSymbols;
27501
27658
  exports.builtinSymbolsMap = builtinSymbolsMap;
27502
27659
  exports.calcLineCache = calcLineCache$1;
27660
+ exports.calculateLineHeight = calculateLineHeight;
27503
27661
  exports.centroidOfSubpath = centroidOfSubpath;
27504
27662
  exports.circleBounds = circleBounds;
27505
27663
  exports.clock = clock;