sheet-happens 0.0.15 → 0.0.17

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/dist/index.js CHANGED
@@ -400,6 +400,11 @@ function findApproxMaxEditDataIndex(editData) {
400
400
  }
401
401
 
402
402
  x += growthIncrement;
403
+
404
+ if (x > maxSearchableRowOrCol) {
405
+ break;
406
+ }
407
+
403
408
  growthIncrement = Math.floor(growthIncrement * growthIncrementFactor);
404
409
  }
405
410
 
@@ -424,6 +429,11 @@ function findApproxMaxEditDataIndex(editData) {
424
429
  }
425
430
 
426
431
  y += growthIncrement;
432
+
433
+ if (y > maxSearchableRowOrCol) {
434
+ break;
435
+ }
436
+
427
437
  growthIncrement = Math.floor(growthIncrement * growthIncrementFactor);
428
438
  }
429
439
 
@@ -570,15 +580,19 @@ function renderOnCanvas(context, rowSizes, columnSizes, cellStyle, cellWidth, ce
570
580
 
571
581
  if (selectionActive) {
572
582
  context.fillStyle = selBackColor;
573
- var p1x = Math.max(-100, p1.x);
574
- var p1y = Math.max(-100, p1.y);
575
583
 
576
584
  if (rowSelectionActive) {
585
+ var p1x = Math.max(-100, p1.x);
586
+ var p1y = Math.max(-100, p1.y);
577
587
  context.fillRect(p1x, p1y, 100000, p2.y - p1.y);
578
588
  } else if (colSelectionActive) {
579
- context.fillRect(p1x, p1y, p2.x - p1.x, 100000);
589
+ var _p1x = Math.max(-100, p1.x);
590
+
591
+ var _p1y = Math.max(-100, p1.y);
592
+
593
+ context.fillRect(_p1x, _p1y, p2.x - p1.x, 100000);
580
594
  } else {
581
- context.fillRect(p1x, p1y, p2.x - p1.x, p2.y - p1.y);
595
+ context.fillRect(p1.x, p1.y, p2.x - p1.x, p2.y - p1.y);
582
596
  }
583
597
  }
584
598
 
@@ -668,19 +682,22 @@ function renderOnCanvas(context, rowSizes, columnSizes, cellStyle, cellWidth, ce
668
682
  if (selectionActive) {
669
683
  context.strokeStyle = selBorderColor;
670
684
  context.lineWidth = 1;
671
-
672
- var _p1x = Math.max(-100, p1.x);
673
-
674
- var _p1y = Math.max(-100, p1.y);
675
-
676
685
  context.beginPath();
677
686
 
678
687
  if (rowSelectionActive) {
679
- context.rect(_p1x, _p1y, 100000, p2.y - p1.y);
688
+ var _p1x2 = Math.max(-100, p1.x);
689
+
690
+ var _p1y2 = Math.max(-100, p1.y);
691
+
692
+ context.rect(_p1x2, _p1y2, 100000, p2.y - p1.y);
680
693
  } else if (colSelectionActive) {
681
- context.rect(_p1x, _p1y, p2.x - p1.x, 100000);
694
+ var _p1x3 = Math.max(-100, p1.x);
695
+
696
+ var _p1y3 = Math.max(-100, p1.y);
697
+
698
+ context.rect(_p1x3, _p1y3, p2.x - p1.x, 100000);
682
699
  } else {
683
- context.rect(_p1x, _p1y, p2.x - p1.x, p2.y - p1.y);
700
+ context.rect(p1.x, p1.y, p2.x - p1.x, p2.y - p1.y);
684
701
  }
685
702
 
686
703
  context.stroke();
@@ -1476,16 +1493,17 @@ function Sheet(props) {
1476
1493
  dx2 = selection.x1;
1477
1494
  }
1478
1495
 
1479
- var max = findApproxMaxEditDataIndex(editData);
1480
-
1481
1496
  if (dx1 === -1 && dx2 === -1) {
1497
+ var max = findApproxMaxEditDataIndex(editData);
1482
1498
  dx1 = 0;
1483
1499
  dx2 = max.x;
1484
1500
  }
1485
1501
 
1486
1502
  if (dy1 === -1 && dy2 === -1) {
1503
+ var _max = findApproxMaxEditDataIndex(editData);
1504
+
1487
1505
  dy1 = 0;
1488
- dy2 = max.y;
1506
+ dy2 = _max.y;
1489
1507
  }
1490
1508
 
1491
1509
  var cptext = '';
@@ -1679,9 +1697,9 @@ function Sheet(props) {
1679
1697
  if (selection.x1 === -1 && selection.x2 === -1 && selection.y1 !== -1 && selection.y2 !== -1) {
1680
1698
  var _min = Math.min(selection.y1, selection.y2);
1681
1699
 
1682
- var _max = Math.max(selection.y1, selection.y2);
1700
+ var _max2 = Math.max(selection.y1, selection.y2);
1683
1701
 
1684
- for (var _i5 = _min; _i5 <= _max; _i5++) {
1702
+ for (var _i5 = _min; _i5 <= _max2; _i5++) {
1685
1703
  _indices.push(_i5);
1686
1704
  }
1687
1705
  }
@@ -1798,8 +1816,9 @@ function Sheet(props) {
1798
1816
  }
1799
1817
 
1800
1818
  if (fx1 === -1 && fx2 === -1) {
1819
+ var max = findApproxMaxEditDataIndex(editData);
1801
1820
  fx1 = 0;
1802
- fx2 = maxSearchableRowOrCol;
1821
+ fx2 = max.x;
1803
1822
  }
1804
1823
 
1805
1824
  var srcY = sy1;
@@ -1828,8 +1847,10 @@ function Sheet(props) {
1828
1847
  }
1829
1848
 
1830
1849
  if (fy1 === -1 && fy2 === -1) {
1850
+ var _max3 = findApproxMaxEditDataIndex(editData);
1851
+
1831
1852
  fy1 = 0;
1832
- fy2 = maxSearchableRowOrCol;
1853
+ fy2 = _max3.y;
1833
1854
  }
1834
1855
 
1835
1856
  var srcX = sx1;