mirror of
https://github.com/monkeytypegame/monkeytype.git
synced 2025-02-26 07:44:01 +08:00
Unfocus when mouse moves >5px (#2703)
* Update focus.ts * Update focus.ts * lowered threshold to be slightly more responsive Co-authored-by: Miodec <bartnikjack@gmail.com>
This commit is contained in:
parent
3528ba6c6c
commit
c6de5c98ae
1 changed files with 4 additions and 1 deletions
|
@ -1,6 +1,7 @@
|
|||
import * as Caret from "./caret";
|
||||
import * as ActivePage from "../states/active-page";
|
||||
|
||||
const unfocusPx = 3;
|
||||
let state = false;
|
||||
|
||||
export function set(foc: boolean, withCursor = false): void {
|
||||
|
@ -28,7 +29,9 @@ $(document).mousemove(function (event) {
|
|||
if (
|
||||
$("#top").hasClass("focus") &&
|
||||
event.originalEvent &&
|
||||
(event.originalEvent.movementX > 0 || event.originalEvent.movementY > 0)
|
||||
// To avoid mouse/desk vibration from creating a flashy effect, we'll unfocus @ >5px instead of >0px
|
||||
(event.originalEvent.movementX > unfocusPx ||
|
||||
event.originalEvent.movementY > unfocusPx)
|
||||
) {
|
||||
set(false);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue