From b8b521476fe001b1768078b0b970bd3d34d8883b Mon Sep 17 00:00:00 2001 From: Nick Lee Date: Mon, 28 Dec 2020 18:57:37 +0000 Subject: [PATCH] fix rerender on pointer move --- package.json | 2 +- src/HandMatrix.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index 273469c..69dca72 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/src/HandMatrix.js b/src/HandMatrix.js index a8eedd1..89b9ca8 100644 --- a/src/HandMatrix.js +++ b/src/HandMatrix.js @@ -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; @@ -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) }