targetPreview missle fix

`targetPreview` did not show up when moving the mouse from an empty to a missle field and then back to the empty field.

The cause of the problem was no update of the position when going over the missle field and when going back resultend in no `potisionChange` which reslted into an early return.

Fixed this by adding the dependency `show` for early return caused by no `positionChange` which blocks the early return when `targetPreview` is not being `show`-n.
This commit is contained in:
aronmal 2022-08-16 17:47:53 +02:00
parent e3733b6f7e
commit 0f03753612
Signed by: aronmal
GPG key ID: 816B7707426FC612

View file

@ -22,7 +22,7 @@ function App() {
const {newX, newY, shouldShow, appearOK, eventReady, show, x, y} = targetPreview;
const positionChange = !(x === newX && y === newY);
// if not ready or no new position
if (!eventReady || !positionChange)
if (!eventReady || (!positionChange && show))
return;
if (show) {
// hide preview to change position when hidden