@visactor/vchart-extension 2.1.0-alpha.17 → 2.1.0-alpha.19

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/build/index.js CHANGED
@@ -6063,7 +6063,7 @@
6063
6063
  };
6064
6064
 
6065
6065
  const DEFAULT_BLOCK_WIDTH = 180;
6066
- const DEFAULT_BLOCK_HEIGHT = 112;
6066
+ const DEFAULT_BLOCK_HEIGHT = 400;
6067
6067
  const DEFAULT_BLOCK_WIDTH_RATIO = 0.24;
6068
6068
  const DEFAULT_BLOCK_GAP = 36;
6069
6069
  const DEFAULT_IMAGE_WIDTH = 48;
@@ -6152,7 +6152,7 @@
6152
6152
  if (count > 0) {
6153
6153
  const padding = normalizePadding((_k = spec.block) === null || _k === void 0 ? void 0 : _k.padding);
6154
6154
  const innerHeight = Math.max(height - padding.top - padding.bottom, 1);
6155
- blockHeight = Math.max(160, Math.floor(innerHeight / count));
6155
+ blockHeight = Math.max(DEFAULT_BLOCK_HEIGHT, Math.floor(innerHeight / count));
6156
6156
  }
6157
6157
  }
6158
6158
  const result = computeStorylineLayout((_l = spec.data) !== null && _l !== void 0 ? _l : [], {
@@ -6957,17 +6957,18 @@
6957
6957
  ]
6958
6958
  };
6959
6959
  };
6960
- const getPortraitMetrics = (spec, blockWidth, _blockHeight, index) => {
6960
+ const getPortraitMetrics = (spec, blockWidth, blockHeight, index) => {
6961
6961
  var _a, _b, _c, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
6962
6962
  const titleFontSize = Number((_c = (_b = (_a = spec.title) === null || _a === void 0 ? void 0 : _a.style) === null || _b === void 0 ? void 0 : _b.fontSize) !== null && _c !== void 0 ? _c : 18);
6963
6963
  const titleLineHeight = Number((_g = (_f = (_e = spec.title) === null || _e === void 0 ? void 0 : _e.style) === null || _f === void 0 ? void 0 : _f.lineHeight) !== null && _g !== void 0 ? _g : Math.max(PORTRAIT_TITLE_LINE_HEIGHT, Math.round(titleFontSize * 1.35)));
6964
6964
  const contentFontSize = Number((_k = (_j = (_h = spec.content) === null || _h === void 0 ? void 0 : _h.style) === null || _j === void 0 ? void 0 : _j.fontSize) !== null && _k !== void 0 ? _k : PORTRAIT_CONTENT_FONT_SIZE);
6965
6965
  const contentLineHeight = Number((_o = (_m = (_l = spec.content) === null || _l === void 0 ? void 0 : _l.style) === null || _m === void 0 ? void 0 : _m.lineHeight) !== null && _o !== void 0 ? _o : PORTRAIT_CONTENT_LINE_HEIGHT);
6966
- const contentHeight = PORTRAIT_CONTENT_LINES * contentLineHeight;
6967
6966
  const titleToContentGap = PORTRAIT_TITLE_TO_CONTENT_GAP;
6968
- const textHeight = titleLineHeight + titleToContentGap + contentHeight;
6969
6967
  const imageWidth = (_q = (_p = spec.image) === null || _p === void 0 ? void 0 : _p.width) !== null && _q !== void 0 ? _q : PORTRAIT_IMAGE_WIDTH;
6970
6968
  const imageHeight = (_s = (_r = spec.image) === null || _r === void 0 ? void 0 : _r.height) !== null && _s !== void 0 ? _s : PORTRAIT_IMAGE_HEIGHT;
6969
+ const minContentHeight = PORTRAIT_CONTENT_LINES * contentLineHeight;
6970
+ const contentHeight = Math.max(minContentHeight, blockHeight - imageHeight / 2 - PORTRAIT_TEXT_GAP_FROM_IMAGE - titleLineHeight - titleToContentGap);
6971
+ const textHeight = titleLineHeight + titleToContentGap + contentHeight;
6971
6972
  const onLeft = index % 2 === 0;
6972
6973
  const axisHalf = PORTRAIT_AXIS_WIDTH / 2;
6973
6974
  const imageX = onLeft
@@ -7816,8 +7817,10 @@
7816
7817
  if (!ladder) {
7817
7818
  return 0;
7818
7819
  }
7819
- const blockHeight = (_b = (_a = spec.block) === null || _a === void 0 ? void 0 : _a.height) !== null && _b !== void 0 ? _b : 132;
7820
- return Math.round(blockHeight * 3);
7820
+ const blockHeight = (_b = (_a = spec.block) === null || _a === void 0 ? void 0 : _a.height) !== null && _b !== void 0 ? _b : DEFAULT_BLOCK_HEIGHT;
7821
+ const chartHeight = spec.height;
7822
+ const heightCap = typeof chartHeight === 'number' && chartHeight > 0 ? Math.max(SMALL, Math.round(chartHeight * 0.18)) : Infinity;
7823
+ return Math.round(Math.min(blockHeight * 3, heightCap));
7821
7824
  })();
7822
7825
  const defaultTop = ladder ? ladderVerticalPadding : arcDown ? LARGE : arcUp ? TEXT_RESERVE : SMALL;
7823
7826
  const defaultBottom = ladder