format source

This commit is contained in:
Unrud 2018-09-07 09:29:09 +02:00
parent b96247c181
commit cc231211b5
4 changed files with 100 additions and 76 deletions

File diff suppressed because one or more lines are too long

View file

@ -16,12 +16,16 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with Foobar. If not, see <http://www.gnu.org/licenses/>. * along with Foobar. If not, see <http://www.gnu.org/licenses/>.
*/ */
// [1 Touch, 2 Touches, 3 Touches] // [1 Touch, 2 Touches, 3 Touches]
const TOUCH_MOVE_THRESHOLD = [10, 15, 15]; const TOUCH_MOVE_THRESHOLD = [10, 15, 15];
const TOUCH_TIMEOUT = 250; const TOUCH_TIMEOUT = 250;
// [[px/s, mult], ...] // [[px/s, mult], ...]
const POINTER_ACCELERATION = [[0, 0], [87, 1], [173, 1], [553, 2]]; const POINTER_ACCELERATION = [
[0, 0],
[87, 1],
[173, 1],
[553, 2]
];
var ws; var ws;
var pad; var pad;
@ -259,8 +263,11 @@ function handleMove(evt) {
continue; continue;
} }
if (!touchMoved) { if (!touchMoved) {
var dist = Math.sqrt(Math.pow(touches[i].pageX - ongoingTouches[idx].pageXStart, 2) + Math.pow(touches[i].pageY - ongoingTouches[idx].pageYStart, 2)); var dist = Math.sqrt(Math.pow(touches[i].pageX - ongoingTouches[idx].pageXStart, 2) +
if (ongoingTouches.length > TOUCH_MOVE_THRESHOLD.length || dist > TOUCH_MOVE_THRESHOLD[ongoingTouches.length - 1] || evt.timeStamp - touchStart >= TOUCH_TIMEOUT) { Math.pow(touches[i].pageY - ongoingTouches[idx].pageYStart, 2));
if (ongoingTouches.length > TOUCH_MOVE_THRESHOLD.length ||
dist > TOUCH_MOVE_THRESHOLD[ongoingTouches.length - 1] ||
evt.timeStamp - touchStart >= TOUCH_TIMEOUT) {
touchMoved = true; touchMoved = true;
} }
} }

View file

@ -1,5 +1,6 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en"> <html lang="en">
<head> <head>
<meta charset="utf-8" /> <meta charset="utf-8" />
<meta name="viewport" content="width=device-width initial-scale=1, maximum-scale=1, user-scalable=0" /> <meta name="viewport" content="width=device-width initial-scale=1, maximum-scale=1, user-scalable=0" />
@ -10,6 +11,7 @@
<link href="main.css" media="screen" rel="stylesheet" /> <link href="main.css" media="screen" rel="stylesheet" />
<link href="icon.png" type="image/png" rel="shortcut icon" /> <link href="icon.png" type="image/png" rel="shortcut icon" />
</head> </head>
<body> <body>
<div id="opening"> <div id="opening">
<p>Connecting...</p> <p>Connecting...</p>
@ -30,4 +32,5 @@
<button class="icon" id="sendbutton"></button> <button class="icon" id="sendbutton"></button>
</div> </div>
</body> </body>
</html> </html>

View file

@ -1,4 +1,9 @@
html, body, #pad, #keyboard, #opening, #closed { html,
body,
#pad,
#keyboard,
#opening,
#closed {
width: 100%; width: 100%;
height: 100%; height: 100%;
margin: 0; margin: 0;
@ -8,12 +13,16 @@ body {
font-family: sans; font-family: sans;
} }
#pad, #sendbutton, #opening, #closed { #pad,
#sendbutton,
#opening,
#closed {
background-color: #404040 !important; background-color: #404040 !important;
background-image: url(tex.png); background-image: url(tex.png);
} }
#opening, #closed { #opening,
#closed {
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
@ -44,7 +53,10 @@ body {
word-wrap: break-word; word-wrap: break-word;
} }
#fullscreenbutton, #keyboardbutton, #sendbutton, #reloadbutton { #fullscreenbutton,
#keyboardbutton,
#sendbutton,
#reloadbutton {
background-color: transparent; background-color: transparent;
border: 1px solid black; border: 1px solid black;
height: 1.5em; height: 1.5em;
@ -53,7 +65,9 @@ body {
color: white; color: white;
} }
#fullscreenbutton, #keyboardbutton, #sendbutton { #fullscreenbutton,
#keyboardbutton,
#sendbutton {
border-bottom: none; border-bottom: none;
} }