evui 3.4.143 → 3.4.145

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "evui",
3
- "version": "3.4.143",
3
+ "version": "3.4.145",
4
4
  "description": "A EXEM Library project",
5
5
  "author": "exem <dev_client@ex-em.com>",
6
6
  "license": "MIT",
@@ -467,23 +467,60 @@ class HeatMap {
467
467
  ctx.restore();
468
468
  }
469
469
 
470
+ /**
471
+ * 자바스크립트 부동 소수점 오차 때문에 범위를 조정
472
+ * @param {object} params - range information
473
+ * @param {number} params.xp - start x position
474
+ * @param {number} params.yp - start y position
475
+ * @param {number} params.width - width
476
+ * @param {number} params.height - height
477
+ * @returns {object} adjusted range
478
+ */
479
+ getAdjustedBounds({ xp, yp, width, height }) {
480
+ const PRECISION = 100;
481
+
482
+ const adjustedWidth = Math.max(0, width);
483
+ const adjustedHeight = Math.max(0, height);
484
+
485
+ return {
486
+ xsp: Math.floor(xp * PRECISION) / PRECISION,
487
+ xep: Math.ceil((xp + adjustedWidth) * PRECISION) / PRECISION,
488
+ ysp: Math.floor(yp * PRECISION) / PRECISION,
489
+ yep: Math.ceil((yp + adjustedHeight) * PRECISION) / PRECISION,
490
+ };
491
+ }
492
+
470
493
  /**
471
494
  *Returns items in range
472
- * @param {object} params range values
473
- *
474
- * @returns {array}
495
+ * @param {object} params - range information
496
+ * @param {number} params.xsp - start x position
497
+ * @param {number} params.width - width
498
+ * @param {number} params.ysp - start y position
499
+ * @param {number} params.height - height
500
+ * @returns {array} items in range
475
501
  */
476
- findItems({ xsp, ysp, width, height }) {
502
+ findItems(params) {
477
503
  const gdata = this.data;
478
- const xep = xsp + width;
479
- const yep = ysp + height;
504
+
505
+ const { xsp, xep, ysp, yep } = this.getAdjustedBounds({
506
+ xp: params.xsp,
507
+ yp: params.ysp,
508
+ width: params.width,
509
+ height: params.height,
510
+ });
511
+
480
512
  return gdata.filter(({ xp, yp, w, h }) => {
481
- const x1 = xp;
482
- const x2 = xp + w;
483
- const y1 = yp;
484
- const y2 = yp + h;
513
+ const { xsp: x1, xep: x2, ysp: y1, yep: y2 } = this.getAdjustedBounds({
514
+ xp,
515
+ yp,
516
+ width: w,
517
+ height: h,
518
+ });
485
519
 
486
- return ((x1 >= xsp && x2 <= xep) && (y1 >= ysp && y2 <= yep));
520
+ return (
521
+ (x1 >= xsp && x2 <= xep)
522
+ && (y1 >= ysp && y2 <= yep)
523
+ );
487
524
  });
488
525
  }
489
526
 
@@ -655,6 +692,8 @@ class HeatMap {
655
692
 
656
693
  if (findItem > -1) {
657
694
  point[key] = ['xsp', 'ysp'].includes(key) ? itemPoint : itemPoint + gap;
695
+ } else if (target < startPoint) {
696
+ point[key] = startPoint;
658
697
  }
659
698
  };
660
699
 
@@ -931,8 +931,13 @@ const modules = {
931
931
  }
932
932
  this.setLegendColumnHeader();
933
933
  } else if (this.options.legend.virtualScroll) {
934
- this.updateVisibleRowCount();
935
- this.renderVisibleLegends();
934
+ const isHidden = this.legendDOM?.style?.display === 'none';
935
+ if (isHidden) {
936
+ this.legendNeedsUpdate = true;
937
+ } else {
938
+ this.updateVisibleRowCount();
939
+ this.renderVisibleLegends();
940
+ }
936
941
  } else {
937
942
  while (legendBoxDOM.hasChildNodes()) {
938
943
  legendBoxDOM.removeChild(legendBoxDOM.firstChild);
@@ -1487,6 +1492,12 @@ const modules = {
1487
1492
  if (this.legendDOM) {
1488
1493
  this.legendDOM.style.display = 'block';
1489
1494
  }
1495
+
1496
+ if (this.legendNeedsUpdate && this.options.legend.virtualScroll && !this.useTable) {
1497
+ this.legendNeedsUpdate = false;
1498
+ this.updateVisibleRowCount();
1499
+ this.renderVisibleLegends();
1500
+ }
1490
1501
  },
1491
1502
 
1492
1503
  /**