sheet-happens 0.0.49 → 0.0.50

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.
@@ -1200,7 +1200,7 @@ var useMouse = function useMouse(hitmapRef, selection, knobArea, editMode, editD
1200
1200
  var _getScrollPosition5 = getScrollPosition(e),
1201
1201
  currentScroll = _getScrollPosition5[0];
1202
1202
 
1203
- var newWidth = Math.max(size + x - anchor + scroll - currentScroll, SIZES.minimumWidth * indices.length);
1203
+ var newWidth = Math.round(Math.max(size + x - anchor + scroll - currentScroll, SIZES.minimumWidth * indices.length));
1204
1204
  onInvalidateColumn === null || onInvalidateColumn === void 0 ? void 0 : onInvalidateColumn(indices[0] - 1);
1205
1205
  onCellWidthChange(indices, indices.map(function (_) {
1206
1206
  return Math.round(newWidth / indices.length);
@@ -1220,7 +1220,7 @@ var useMouse = function useMouse(hitmapRef, selection, knobArea, editMode, editD
1220
1220
  var _getScrollPosition6 = getScrollPosition(e),
1221
1221
  _currentScroll = _getScrollPosition6[1];
1222
1222
 
1223
- var newHeight = Math.max(_size4 + y - _anchor + _scroll4 - _currentScroll, SIZES.minimumHeight * _indices5.length);
1223
+ var newHeight = Math.round(Math.max(_size4 + y - _anchor + _scroll4 - _currentScroll, SIZES.minimumHeight * _indices5.length));
1224
1224
  onInvalidateRow === null || onInvalidateRow === void 0 ? void 0 : onInvalidateRow(_indices5[0] - 1);
1225
1225
  onCellHeightChange(_indices5, _indices5.map(function (_) {
1226
1226
  return newHeight / _indices5.length;
@@ -1641,6 +1641,7 @@ var useKeyboard = function useKeyboard(arrowKeyCommitMode, overlayRef, cellReadO
1641
1641
  return;
1642
1642
  }
1643
1643
 
1644
+ if (e.key === 'Enter') e.preventDefault();
1644
1645
  onEdit === null || onEdit === void 0 ? void 0 : onEdit(cell, e.key !== 'Enter');
1645
1646
  return;
1646
1647
  }
@@ -2842,7 +2843,7 @@ var renderSheet = function renderSheet(context, cellLayout, visibleCells, sheetS
2842
2843
  var clickables = [];
2843
2844
  var freeze = [freezeColumns, freezeRows];
2844
2845
  var indent = [rowHeaderWidth, columnHeaderHeight];
2845
- resizeCanvas(canvas);
2846
+ var pixelRatio = resizeCanvas(canvas);
2846
2847
  context.clearRect(0, 0, width, height);
2847
2848
  context.fillStyle = 'white';
2848
2849
  context.fillRect(0, 0, width, height);
@@ -2987,7 +2988,7 @@ var renderSheet = function renderSheet(context, cellLayout, visibleCells, sheetS
2987
2988
 
2988
2989
  var _bottom2 = rowToPixel(row, 1);
2989
2990
 
2990
- clickables.push.apply(clickables, renderCell(context, content, resolvedStyle, 0, _top2, rowHeaderWidth, _bottom2 - _top2));
2991
+ clickables.push.apply(clickables, renderCell(context, content, resolvedStyle, 0, _top2, rowHeaderWidth, _bottom2 - _top2, pixelRatio));
2991
2992
  }
2992
2993
  }
2993
2994
 
@@ -3017,7 +3018,7 @@ var renderSheet = function renderSheet(context, cellLayout, visibleCells, sheetS
3017
3018
 
3018
3019
  var _content = (_columnHeaders = columnHeaders(column, _style)) != null ? _columnHeaders : excelHeaderString(column + 1);
3019
3020
 
3020
- clickables.push.apply(clickables, renderCell(context, _content, _style, _left2, 0, _right2 - _left2, columnHeaderHeight));
3021
+ clickables.push.apply(clickables, renderCell(context, _content, _style, _left2, 0, _right2 - _left2, columnHeaderHeight, pixelRatio));
3021
3022
  }
3022
3023
  }
3023
3024
 
@@ -3187,14 +3188,14 @@ var renderSheet = function renderSheet(context, cellLayout, visibleCells, sheetS
3187
3188
  var cellContent = displayData(_x, _y, _style2);
3188
3189
 
3189
3190
  if (cellContent !== null && cellContent !== undefined) {
3190
- clickables.push.apply(clickables, renderCell(context, cellContent, _style2, _left9, _top9, _right10 - _left9, _bottom10 - _top9));
3191
+ clickables.push.apply(clickables, renderCell(context, cellContent, _style2, _left9, _top9, _right10 - _left9, _bottom10 - _top9, pixelRatio));
3191
3192
  }
3192
3193
  }
3193
3194
  }
3194
3195
 
3195
3196
  return clickables;
3196
3197
  };
3197
- var renderCell = function renderCell(context, cellContent, style, xCoord, yCoord, cellWidth, cellHeight) {
3198
+ var renderCell = function renderCell(context, cellContent, style, xCoord, yCoord, cellWidth, cellHeight, pixelRatio) {
3198
3199
  var clickables = [];
3199
3200
 
3200
3201
  if (cellContent === null) {
@@ -3204,7 +3205,7 @@ var renderCell = function renderCell(context, cellContent, style, xCoord, yCoord
3204
3205
  context.fillStyle = style.color;
3205
3206
  context.font = style.weight + ' ' + style.fontSize + 'px ' + style.fontFamily;
3206
3207
  context.textAlign = style.textAlign;
3207
- var yy = Math.floor(yCoord + cellHeight * 0.5);
3208
+ var yy = Math.round((yCoord + cellHeight * 0.5) * pixelRatio) / pixelRatio;
3208
3209
  context.save();
3209
3210
  context.beginPath();
3210
3211
  context.rect(xCoord, yCoord, cellWidth, cellHeight);
@@ -3410,11 +3411,9 @@ var resizeCanvas = function resizeCanvas(canvas) {
3410
3411
  canvas.height = newCanvasHeight;
3411
3412
  context.scale(ratio, ratio);
3412
3413
  }
3413
-
3414
- return true;
3415
3414
  }
3416
3415
 
3417
- return false;
3416
+ return ratio;
3418
3417
  };
3419
3418
 
3420
3419
  var excelHeaderString = function excelHeaderString(num) {