diff --git a/client/src/components/vbox.component.jsx b/client/src/components/vbox.component.jsx
index b0c3a276..ecbc26ec 100644
--- a/client/src/components/vbox.component.jsx
+++ b/client/src/components/vbox.component.jsx
@@ -27,35 +27,36 @@ function Vbox(args) {
const { vbox } = instance;
if (!instance.vbox) return false;
- // lots of rubbish to make it flow nice
- function boundClick(i) {
- if (reclaiming && i) {
- return sendVboxReclaim(i);
- }
-
- const insert = combiner.findIndex(j => j === null);
- if (insert === -1) return setCombiner([i, null, null]);
- combiner[insert] = i;
- return setCombiner(combiner);
- }
-
- function combinerRmv(i) {
- combiner[i] = null;
- return setCombiner(combiner);
- }
-
+ //
+ // VBOX
+ //
const free = [];
for (let i = 0 ; i < 6; i++) {
free.push([vbox.free[0][i], vbox.free[1][i], vbox.free[2][i]]);
}
+ let freeDbl = false;
+ function freeClick(e, i, j) {
+ // touch + double handling
+ if (!freeDbl) {
+ freeDbl = true;
+ setTimeout(() => {
+ freeDbl = false;
+ if (free[i][j]) setInfo('item', free[i][j]);
+ }, 300);
+ return false;
+ }
+ e.preventDefault();
+ freeDbl = false;
+
+ return sendVboxAccept(j, i);
+ }
+
const freeRows = free.map((row, i) => {
const cells = row.map((c, j) => (
{ if (c) return setInfo('item', c)}}
- onDblClick={() => sendVboxAccept(j, i) }
- onTouchStart={() => sendVboxAccept(j, i) }
+ onClick={e => freeClick(e, i, j)}
>
{convertVar(c)}
|
@@ -68,6 +69,32 @@ function Vbox(args) {
);
});
+ //
+ // INVENTORY
+ //
+ // lots of rubbish to make it flow nice
+ let boundDbl = false;
+ function boundClick(e, i) {
+ // touch + double handling
+ if (!boundDbl) {
+ boundDbl = true;
+ setTimeout(() => boundDbl = false, 300);
+ return false;
+ }
+ e.preventDefault();
+ boundDbl = false;
+
+ // action
+ if (reclaiming && i) {
+ return sendVboxReclaim(i);
+ }
+
+ const insert = combiner.findIndex(j => j === null);
+ if (insert === -1) return setCombiner([i, null, null]);
+ combiner[insert] = i;
+ return setCombiner(combiner);
+ }
+
const boundTds = range(0, 9).map(i => {
if (combiner.indexOf(i) > -1) {
return (
@@ -82,7 +109,7 @@ function Vbox(args) {
key={i}
draggable="true"
onDragStart={e => e.dataTransfer.setData('text', i)}
- onClick={() => boundClick(i) }>
+ onClick={e => boundClick(e, i) }>
{convertVar(vbox.bound[i])}
);
@@ -106,6 +133,13 @@ function Vbox(args) {
,
];
+ //
+ // COMBINER
+ //
+ function combinerRmv(i) {
+ combiner[i] = null;
+ return setCombiner(combiner);
+ }
const combinerElement = (
@@ -118,6 +152,9 @@ function Vbox(args) {
);
+ //
+ // EVERYTHING
+ //
return (
setReclaiming(false)} >
@@ -134,7 +171,7 @@ function Vbox(args) {
{freeRows}
- INVENTORY
+ e.target.scrollIntoView(true)}>INVENTORY