Skip to content

Commit

Permalink
Center the drag zone over the edge of the cell
Browse files Browse the repository at this point in the history
Shift the selection rectangles to the center of the edge, instead of
being outside the cell. This makes for a more intuitive user
experience as the user will try to select the edge, not the outside of
the table cell.
  • Loading branch information
Bart Spiers committed May 9, 2024
1 parent 3dfd2b7 commit 57694ca
Showing 1 changed file with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -333,23 +333,23 @@ function TableCellResizer({editor}: {editor: LexicalEditor}): JSX.Element {
const {height, width, top, left} =
activeCell.elem.getBoundingClientRect();
const zoom = calculateZoomLevel(activeCell.elem);

const zoneWidth = 10; // Pixel width of the zone where you can drag the edge
const styles = {
bottom: {
backgroundColor: 'none',
cursor: 'row-resize',
height: '10px',
height: `${zoneWidth}px`,
left: `${window.pageXOffset + left}px`,
top: `${window.pageYOffset + top + height}px`,
top: `${window.pageYOffset + top + height - zoneWidth / 2}px`,
width: `${width}px`,
},
right: {
backgroundColor: 'none',
cursor: 'col-resize',
height: `${height}px`,
left: `${window.pageXOffset + left + width}px`,
left: `${window.pageXOffset + left + width - zoneWidth / 2}px`,
top: `${window.pageYOffset + top}px`,
width: '10px',
width: `${zoneWidth}px`,
},
};

Expand Down

0 comments on commit 57694ca

Please sign in to comment.