Skip to content

Commit

Permalink
fix rerender on pointer move
Browse files Browse the repository at this point in the history
  • Loading branch information
HieronymusLex committed Dec 28, 2020
1 parent 4b7adce commit b8b5214
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"scripts": {
"build": "webpack --mode production"
},
"version": "0.2.0",
"version": "0.2.1",
"devDependencies": {
"@babel/cli": "^7.11.6",
"@babel/core": "^7.11.6",
Expand Down
4 changes: 2 additions & 2 deletions src/HandMatrix.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ function HandMatrix({
showText,
colorize,
}) {
const [currentlyPointingAt, setCurrentlyPointingAt] = useState(undefined);
let currentlyPointingAt;
const getComboForPointerEvent = (e) => document.elementFromPoint(e.clientX, e.clientY).dataset.combo;
const comboEventDispatcher = fn => e => {
if (!fn) return;
Expand All @@ -116,7 +116,7 @@ function HandMatrix({
onPointerMove={comboEventDispatcher((combo) => {
onPointerMove && onPointerMove(combo);
if (combo !== currentlyPointingAt) {
setCurrentlyPointingAt(combo)
currentlyPointingAt = combo;
// Note: This is used instead of onPointerEnter for Safari support
onPointerEnter && onPointerEnter(combo)
}
Expand Down

0 comments on commit b8b5214

Please sign in to comment.