touch events
This commit is contained in:
parent
429fdcbd0e
commit
2724ba8283
@ -4,7 +4,7 @@
|
|||||||
"description": "",
|
"description": "",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"start": "parcel index.html --port 40080 --no-source-maps",
|
"start": "parcel index.html --host 0.0.0.0 --port 40080 --no-source-maps",
|
||||||
"build": "rm -rf dist && parcel build index.html",
|
"build": "rm -rf dist && parcel build index.html",
|
||||||
"lint": "eslint --fix --ext .jsx src/",
|
"lint": "eslint --fix --ext .jsx src/",
|
||||||
"test": "echo \"Error: no test specified\" && exit 1"
|
"test": "echo \"Error: no test specified\" && exit 1"
|
||||||
|
|||||||
@ -50,10 +50,13 @@ function Vbox(args) {
|
|||||||
function vboxTouchEnd(e, i, j) {
|
function vboxTouchEnd(e, i, j) {
|
||||||
if (vboxTimer) {
|
if (vboxTimer) {
|
||||||
clearTimeout(vboxTimer);
|
clearTimeout(vboxTimer);
|
||||||
if (free[i][j]) setInfo('item', free[i][j]);
|
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
function vboxTouchMove(e) {
|
||||||
|
if (vboxTimer) clearTimeout(vboxTimer);
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
e.preventDefault();
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -63,6 +66,7 @@ function Vbox(args) {
|
|||||||
key={j}
|
key={j}
|
||||||
onTouchStart={e => vboxTouchStart(e, i, j)}
|
onTouchStart={e => vboxTouchStart(e, i, j)}
|
||||||
onTouchEnd={e => vboxTouchEnd(e, i, j)}
|
onTouchEnd={e => vboxTouchEnd(e, i, j)}
|
||||||
|
onTouchMove={e => vboxTouchMove(e)}
|
||||||
|
|
||||||
onClick={() => { if (c) return setInfo('item', c); }}
|
onClick={() => { if (c) return setInfo('item', c); }}
|
||||||
onDblClick={() => sendVboxAccept(j, i) }
|
onDblClick={() => sendVboxAccept(j, i) }
|
||||||
@ -103,14 +107,25 @@ function Vbox(args) {
|
|||||||
if (reclaiming && i) sendVboxReclaim(i);
|
if (reclaiming && i) sendVboxReclaim(i);
|
||||||
else if (vbox.bound[i]) setActiveVar(i);
|
else if (vbox.bound[i]) setActiveVar(i);
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
function boundTouchMove(e) {
|
||||||
|
if (boundTimer) clearTimeout(boundTimer);
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
e.preventDefault();
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
function boundClick(e, i) {
|
function boundClick(e, i) {
|
||||||
if (reclaiming && i) sendVboxReclaim(i);
|
if (reclaiming && i) sendVboxReclaim(i);
|
||||||
else if (vbox.bound[i]) setActiveVar(i);
|
else if (vbox.bound[i]) {
|
||||||
|
const insert = combiner.findIndex(j => j === null);
|
||||||
|
if (insert === -1) return setCombiner([i, null, null]);
|
||||||
|
combiner[insert] = i;
|
||||||
|
boundTimer = null;
|
||||||
|
return setCombiner(combiner);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
const boundTds = range(0, 9).map(i => {
|
const boundTds = range(0, 9).map(i => {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user