Skip to content

Commit

Permalink
feat: goMarkableStream loves revel.js
Browse files Browse the repository at this point in the history
  • Loading branch information
owulveryck committed Nov 24, 2023
1 parent c1e0374 commit 8e22ab5
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
8 changes: 4 additions & 4 deletions client/worker_gesture_processing.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,13 @@ async function fetchStream() {


function checkSwipeDirection(json) {
if (json.left > 200 && json.right < 15 && json.up < 15 && json.down < 15) {
if (json.left > 200 && json.right < 75 && json.up < 100 && json.down < 100) {
return 'left';
} else if (json.right > 200 && json.left < 15 && json.up < 15 && json.down < 15) {
} else if (json.right > 200 && json.left < 75 && json.up < 100 && json.down < 100) {
return 'right';
} else if (json.up > 200 && json.right < 15 && json.left < 15 && json.down < 15) {
} else if (json.up > 200 && json.right < 100 && json.left < 100 && json.down < 75) {
return 'up';
} else if (json.down > 200 && json.right < 15 && json.up < 15 && json.left < 15) {
} else if (json.down > 200 && json.right < 100 && json.up < 75 && json.left < 100) {
return 'down';
} else {
return 'none';
Expand Down
8 changes: 6 additions & 2 deletions client/workersHandling.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,16 @@ gestureWorker.postMessage({
wsURL: wsGestureURL
});

eventWorker.onmessage = (event) => {
gestureWorker.onmessage = (event) => {
const data = event.data;

switch (data.type) {
case 'gesture':
console.error(event.data.message);
if (event.data.value == 'left') {
document.getElementById('content').contentWindow.postMessage( JSON.stringify({ method: 'left' }), '*' );
} else if (event.data.value == 'right') {
document.getElementById('content').contentWindow.postMessage( JSON.stringify({ method: 'right' }), '*' );
}
break;
case 'error':
console.error('Error from worker:', event.data.message);
Expand Down

0 comments on commit 8e22ab5

Please sign in to comment.