@visactor/vchart 1.13.19-alpha.0 → 1.13.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.es.js CHANGED
@@ -64255,7 +64255,7 @@ const registerVChartCore = () => {
64255
64255
  };
64256
64256
  registerVChartCore();
64257
64257
 
64258
- const version = "1.13.19-alpha.0";
64258
+ const version = "1.13.19";
64259
64259
 
64260
64260
  const addVChartProperty = (data, op) => {
64261
64261
  const context = op.beforeCall();
@@ -81485,11 +81485,11 @@ class CloudLayout extends BaseLayout {
81485
81485
  if (1 === this._placeStatus) {
81486
81486
  const maxSize0 = d.fontSize * this._originSize[0] / this.options.minFontSize,
81487
81487
  distSize0 = Math.max(d.width, d.height);
81488
- if (distSize0 <= maxSize0) this.expandBoard(this._board, this._bounds, distSize0 / this._size[0]);else {
81488
+ if (distSize0 <= maxSize0) this._board = this.expandBoard(this._board, this._bounds, distSize0 / this._size[0]);else {
81489
81489
  if (!this.options.clip) return !0;
81490
- this.expandBoard(this._board, this._bounds, maxSize0 / this._size[0]);
81490
+ this._board = this.expandBoard(this._board, this._bounds, maxSize0 / this._size[0]);
81491
81491
  }
81492
- } else this._placeStatus, this.expandBoard(this._board, this._bounds);
81492
+ } else this._placeStatus, this._board = this.expandBoard(this._board, this._bounds);
81493
81493
  return this.updateBoardExpandStatus(d.fontSize), !1;
81494
81494
  }
81495
81495
  return this._tTemp = null, this._dtTemp = null, !0;
@@ -81500,7 +81500,7 @@ class CloudLayout extends BaseLayout {
81500
81500
  width: 1,
81501
81501
  height: 1
81502
81502
  }));
81503
- this.contextAndRatio = contextAndRatio, this._board = new Array((this._size[0] >> 5) * this._size[1]).fill(0), this._bounds = null;
81503
+ this.contextAndRatio = contextAndRatio, this._board = new Uint32Array((this._size[0] >> 5) * this._size[1]).fill(0), this._bounds = null;
81504
81504
  words.length;
81505
81505
  this.result = [];
81506
81506
  const data = words.map((d, i) => ({
@@ -81567,18 +81567,33 @@ class CloudLayout extends BaseLayout {
81567
81567
  this._size = this._size.map(v => v * (1 - minRatio));
81568
81568
  }
81569
81569
  expandBoard(board, bounds, factor) {
81570
- const expandedLeftWidth = this._size[0] * (factor || 1.1) - this._size[0] >> 5;
81570
+ const oldW = this._size[0],
81571
+ oldH = this._size[1],
81572
+ oldRowStride = oldW >> 5,
81573
+ expandedLeftWidth = oldW * (factor || 1.1) - oldW >> 5;
81571
81574
  let diffWidth = 2 * expandedLeftWidth > 2 ? expandedLeftWidth : 2;
81572
81575
  diffWidth % 2 != 0 && diffWidth++;
81573
- let diffHeight = Math.ceil(this._size[1] * (diffWidth << 5) / this._size[0]);
81576
+ let diffHeight = Math.ceil(oldH * (diffWidth << 5) / oldW);
81574
81577
  diffHeight % 2 != 0 && diffHeight++;
81575
- const w = this._size[0],
81576
- h = this._size[1],
81577
- widthArr = new Array(diffWidth).fill(0),
81578
- heightArr = new Array(diffHeight / 2 * (diffWidth + (w >> 5))).fill(0);
81579
- this.insertZerosToArray(board, h * (w >> 5), heightArr.length + diffWidth / 2);
81580
- for (let i = h - 1; i > 0; i--) this.insertZerosToArray(board, i * (w >> 5), widthArr.length);
81581
- this.insertZerosToArray(board, 0, heightArr.length + diffWidth / 2), this._size = [w + (diffWidth << 5), h + diffHeight], bounds && (bounds[0].x += (diffWidth << 5) / 2, bounds[0].y += diffHeight / 2, bounds[1].x += (diffWidth << 5) / 2, bounds[1].y += diffHeight / 2);
81578
+ const newW = oldW + (diffWidth << 5),
81579
+ newH = oldH + diffHeight,
81580
+ newRowStride = newW >> 5,
81581
+ paddingLeft = diffWidth / 2,
81582
+ paddingTop = diffHeight / 2,
81583
+ newBoard = new Uint32Array(newH * newRowStride).fill(0);
81584
+ for (let y = 0; y < oldH; y++) {
81585
+ const sourceStartIndex = y * oldRowStride,
81586
+ sourceEndIndex = sourceStartIndex + oldRowStride,
81587
+ destStartIndex = (y + paddingTop) * newRowStride + paddingLeft,
81588
+ rowData = board.slice(sourceStartIndex, sourceEndIndex);
81589
+ newBoard.set(rowData, destStartIndex);
81590
+ }
81591
+ if (this._size = [newW, newH], bounds) {
81592
+ const offsetX = (diffWidth << 5) / 2,
81593
+ offsetY = diffHeight / 2;
81594
+ bounds[0].x += offsetX, bounds[0].y += offsetY, bounds[1].x += offsetX, bounds[1].y += offsetY;
81595
+ }
81596
+ return newBoard;
81582
81597
  }
81583
81598
  insertZerosToArray(array, index, length) {
81584
81599
  if (this.options.customInsertZerosToArray) return this.options.customInsertZerosToArray(array, index, length);
package/build/index.js CHANGED
@@ -64261,7 +64261,7 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
64261
64261
  };
64262
64262
  registerVChartCore();
64263
64263
 
64264
- const version = "1.13.19-alpha.0";
64264
+ const version = "1.13.19";
64265
64265
 
64266
64266
  const addVChartProperty = (data, op) => {
64267
64267
  const context = op.beforeCall();
@@ -81491,11 +81491,11 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
81491
81491
  if (1 === this._placeStatus) {
81492
81492
  const maxSize0 = d.fontSize * this._originSize[0] / this.options.minFontSize,
81493
81493
  distSize0 = Math.max(d.width, d.height);
81494
- if (distSize0 <= maxSize0) this.expandBoard(this._board, this._bounds, distSize0 / this._size[0]);else {
81494
+ if (distSize0 <= maxSize0) this._board = this.expandBoard(this._board, this._bounds, distSize0 / this._size[0]);else {
81495
81495
  if (!this.options.clip) return !0;
81496
- this.expandBoard(this._board, this._bounds, maxSize0 / this._size[0]);
81496
+ this._board = this.expandBoard(this._board, this._bounds, maxSize0 / this._size[0]);
81497
81497
  }
81498
- } else this._placeStatus, this.expandBoard(this._board, this._bounds);
81498
+ } else this._placeStatus, this._board = this.expandBoard(this._board, this._bounds);
81499
81499
  return this.updateBoardExpandStatus(d.fontSize), !1;
81500
81500
  }
81501
81501
  return this._tTemp = null, this._dtTemp = null, !0;
@@ -81506,7 +81506,7 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
81506
81506
  width: 1,
81507
81507
  height: 1
81508
81508
  }));
81509
- this.contextAndRatio = contextAndRatio, this._board = new Array((this._size[0] >> 5) * this._size[1]).fill(0), this._bounds = null;
81509
+ this.contextAndRatio = contextAndRatio, this._board = new Uint32Array((this._size[0] >> 5) * this._size[1]).fill(0), this._bounds = null;
81510
81510
  words.length;
81511
81511
  this.result = [];
81512
81512
  const data = words.map((d, i) => ({
@@ -81573,18 +81573,33 @@ C0.3-1.4,0.3-1.4,0.3-1.4z;`;
81573
81573
  this._size = this._size.map(v => v * (1 - minRatio));
81574
81574
  }
81575
81575
  expandBoard(board, bounds, factor) {
81576
- const expandedLeftWidth = this._size[0] * (factor || 1.1) - this._size[0] >> 5;
81576
+ const oldW = this._size[0],
81577
+ oldH = this._size[1],
81578
+ oldRowStride = oldW >> 5,
81579
+ expandedLeftWidth = oldW * (factor || 1.1) - oldW >> 5;
81577
81580
  let diffWidth = 2 * expandedLeftWidth > 2 ? expandedLeftWidth : 2;
81578
81581
  diffWidth % 2 != 0 && diffWidth++;
81579
- let diffHeight = Math.ceil(this._size[1] * (diffWidth << 5) / this._size[0]);
81582
+ let diffHeight = Math.ceil(oldH * (diffWidth << 5) / oldW);
81580
81583
  diffHeight % 2 != 0 && diffHeight++;
81581
- const w = this._size[0],
81582
- h = this._size[1],
81583
- widthArr = new Array(diffWidth).fill(0),
81584
- heightArr = new Array(diffHeight / 2 * (diffWidth + (w >> 5))).fill(0);
81585
- this.insertZerosToArray(board, h * (w >> 5), heightArr.length + diffWidth / 2);
81586
- for (let i = h - 1; i > 0; i--) this.insertZerosToArray(board, i * (w >> 5), widthArr.length);
81587
- this.insertZerosToArray(board, 0, heightArr.length + diffWidth / 2), this._size = [w + (diffWidth << 5), h + diffHeight], bounds && (bounds[0].x += (diffWidth << 5) / 2, bounds[0].y += diffHeight / 2, bounds[1].x += (diffWidth << 5) / 2, bounds[1].y += diffHeight / 2);
81584
+ const newW = oldW + (diffWidth << 5),
81585
+ newH = oldH + diffHeight,
81586
+ newRowStride = newW >> 5,
81587
+ paddingLeft = diffWidth / 2,
81588
+ paddingTop = diffHeight / 2,
81589
+ newBoard = new Uint32Array(newH * newRowStride).fill(0);
81590
+ for (let y = 0; y < oldH; y++) {
81591
+ const sourceStartIndex = y * oldRowStride,
81592
+ sourceEndIndex = sourceStartIndex + oldRowStride,
81593
+ destStartIndex = (y + paddingTop) * newRowStride + paddingLeft,
81594
+ rowData = board.slice(sourceStartIndex, sourceEndIndex);
81595
+ newBoard.set(rowData, destStartIndex);
81596
+ }
81597
+ if (this._size = [newW, newH], bounds) {
81598
+ const offsetX = (diffWidth << 5) / 2,
81599
+ offsetY = diffHeight / 2;
81600
+ bounds[0].x += offsetX, bounds[0].y += offsetY, bounds[1].x += offsetX, bounds[1].y += offsetY;
81601
+ }
81602
+ return newBoard;
81588
81603
  }
81589
81604
  insertZerosToArray(array, index, length) {
81590
81605
  if (this.options.customInsertZerosToArray) return this.options.customInsertZerosToArray(array, index, length);