Skip to content

Commit

Permalink
fix: add mouse feedback on selected bytes
Browse files Browse the repository at this point in the history
Fixes #328
  • Loading branch information
connor4312 committed Dec 9, 2022
1 parent 9273f1a commit 0ac3205
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions media/editor/dataDisplay.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,11 @@ const dataCellSelectedCls = css`
color: var(--vscode-editor-selectionForeground);
`;

const dataCellSelectedHoveredCls = css`
background: var(--vscode-editor-inactiveSelectionBackground);
color: inherit;
`;

const dataCellUnsavedCls = css`
background: var(--vscode-minimapGutter-modifiedBackground);
`;
Expand Down Expand Up @@ -500,6 +505,9 @@ const DataCell: React.FC<{
});
}, [focusedElement]);

const isHovered = useIsHovered(focusedElement);
const isSelected = useIsSelected(byte);

return (
<span
ref={elRef}
Expand All @@ -510,8 +518,9 @@ const DataCell: React.FC<{
isChar && dataCellCharCls,
dataCellCls,
className,
useIsHovered(focusedElement) && dataCellHoveredCls,
useIsSelected(byte) && dataCellSelectedCls,
isHovered && dataCellHoveredCls,
isSelected && dataCellSelectedCls,
(isHovered && isSelected) && dataCellSelectedHoveredCls,
useIsUnsaved(byte) && dataCellUnsavedCls,
)}
onMouseEnter={onMouseEnter}
Expand Down

0 comments on commit 0ac3205

Please sign in to comment.