Project

General

Profile

Feature #3306 » mouse_speed_old_poc.html

This is from old implementation which is #2047 - Ayush Khandelwal, 11/06/2023 12:18 PM

 
1
<html>
2
  <head>
3
    <title>Mouse Speed test</title>
4
  </head>
5
  <body>
6
    <script>
7
	let presentX=0;
8
	let presentY=0;
9
	let isUserGoingToClose=true;	
10
	let xSpeed;
11
	let ySpeed;
12
	document.documentElement.addEventListener('mouseover',(event)=>{
13
		xSpeed = Math.abs(event.clientX-presentX);
14
		ySpeed = presentY-event.clientY;
15
		if ( (ySpeed > 45 || (ySpeed > 0 && xSpeed + ySpeed  > 85)) )
16
		{
17
		 	isUserGoingToClose=true;
18
		}
19
		else{
20
		 	isUserGoingToClose=false;
21
		}
22
		presentX=event.clientX;
23
		presentY=event.clientY;
24
	});
25

    
26
	document.documentElement.addEventListener('mouseleave',(event)=>{
27
		if( event.clientY < 0 && isUserGoingToClose){
28
			alert("leaving");
29
		}
30
	});
31
</script>
32
  </body>
33
</html>
(1-1/3)