Skip to content
This repository has been archived by the owner on Jun 24, 2023. It is now read-only.

Commit

Permalink
Release commit
Browse files Browse the repository at this point in the history
  • Loading branch information
milankostak committed Apr 1, 2019
1 parent e94dc6b commit 71b1313
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 29 deletions.
50 changes: 27 additions & 23 deletions controller2.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,15 @@
<link rel="stylesheet" type="text/css" href="/css/controller.css">
<script type="text/javascript" src="/transforms/transforms.js"></script>
<script type="text/javascript" src="/utils/webgl-utils.js"></script>
<!--
<script type="text/javascript" src="/js/sender.js"></script>
-->
<script type="text/javascript" src="/js/detection2.js"></script>
<!--
<script type="text/javascript" src="/js/rotation.js"></script>
<script type="text/javascript" src="/js/motion.js"></script>
<script type="text/javascript" src="/js/helpers.js"></script>
-->
<script type="text/javascript">
"use strict";

Expand All @@ -32,14 +36,14 @@
// set video listener, important for starting animation
video = document.querySelector("video");
video.addEventListener("canplaythrough", setupAfterVideoStreamIsReady, false);
video.addEventListener("click", sendTouch, false);
//video.addEventListener("click", sendTouch, false);

// set change and click listeners
document.querySelector("label#all").addEventListener("click", doAll, false);
document.querySelector("label#none").addEventListener("click", doNone, false);
document.querySelector("label#position input").addEventListener("change", doPosition, false);
document.querySelector("label#rotation input").addEventListener("change", doRotation, false);
document.querySelector("label#motion input").addEventListener("change", doMotion, false);
//document.querySelector("label#rotation input").addEventListener("change", doRotation, false);
//document.querySelector("label#motion input").addEventListener("change", doMotion, false);

// window size listener for changing layout
// checks which one of height or width is bigger and changes the layout appropriately
Expand All @@ -50,20 +54,20 @@
Utils.initRequestAnimationFrame();

// init Rotation object
Rotation.init();
//Rotation.init();
// let the user know that the rotation of device is correct
Rotation.setCustomFunction(function(data) {
/*Rotation.setCustomFunction(function(data) {
Helpers.checkRotation(data, function rotationToRight() {
document.querySelector(".controls").style.backgroundColor = "lightblue";
}, function rotationToLeft() {
document.querySelector(".controls").style.backgroundColor = "lightblue";
}, function noRotation() {
document.querySelector(".controls").style.backgroundColor = "white";
});
});
});*/

// init Motion object
Motion.init();
//Motion.init();

// https://developer.mozilla.org/en-US/docs/Web/API/MediaDevices/getUserMedia
// get access to camera
Expand Down Expand Up @@ -126,8 +130,8 @@
}, 600);

document.querySelector("label#position input").checked = true;
document.querySelector("label#rotation input").checked = true;
document.querySelector("label#motion input").checked = true;
//document.querySelector("label#rotation input").checked = true;
//document.querySelector("label#motion input").checked = true;
doPosition();
doRotation();
doMotion();
Expand All @@ -143,11 +147,11 @@
}, 600);

document.querySelector("label#position input").checked = false;
document.querySelector("label#rotation input").checked = false;
document.querySelector("label#motion input").checked = false;
//document.querySelector("label#rotation input").checked = false;
//document.querySelector("label#motion input").checked = false;
doPosition();
doRotation();
doMotion();
//doRotation();
//doMotion();
}

/**
Expand All @@ -171,28 +175,28 @@
/**
* Event handler when rotation button is clicked
*/
function doRotation() {
/*function doRotation() {
if (document.querySelector("label#rotation input").checked) {
document.querySelector("label#rotation").classList.add("active");
Rotation.start();
} else {
document.querySelector("label#rotation").classList.remove("active");
Rotation.finish();
}
}
}*/

/**
* Event handler when motion button is clicked
*/
function doMotion() {
/*function doMotion() {
if (document.querySelector("label#motion input").checked) {
document.querySelector("label#motion").classList.add("active");
Motion.start();
} else {
document.querySelector("label#motion").classList.remove("active");
Motion.finish();
}
}
}*/

/**
* Resize event handler
Expand All @@ -214,18 +218,18 @@
* Click and touch event handler
* Sends information that the video has been clicked or touched
*/
function sendTouch() {
/*function sendTouch() {
let obj = {
type: "touch",
time: new Date().getTime()
};
Sender.add(obj);
}
}*/

/**
* Helper method for sending test data
*/
function testSend() {
/*function testSend() {
let request = new XMLHttpRequest();
request.open('POST', '/ajax/data');
request.setRequestHeader("Content-Type", "application/json;charset=UTF-8");
Expand All @@ -234,7 +238,7 @@
time: new Date().getTime()
}];
request.send(JSON.stringify(data));
}
}*/

</script>

Expand All @@ -257,8 +261,8 @@
<label id="none">Uncheck all</label><br>
<hr>
<label id="position"><input type="checkbox"> Position</label><br>
<label id="rotation"><input type="checkbox"> Rotation</label><br>
<label id="motion"><input type="checkbox"> Motion</label>
<label id="rotation"><input type="checkbox" disabled> Rotation</label><br>
<label id="motion"><input type="checkbox" disabled> Motion</label>
</div>
</div>
</body>
Expand Down
12 changes: 6 additions & 6 deletions js/detection2.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
* It is assigned by its inner anonymous self-invoking function. By using this approach some variables and functions can remain private.
*
* @public
* @requires transforms3d.js
* @requires transforms.js
* @requires webgl-utils.js
* @requires sender.js
* // @requires sender.js
* @type {Object}
* @author Milan Košťák
* @version 2.0
Expand Down Expand Up @@ -288,7 +288,7 @@ const Detection = (function() {
width = canvas.width = videoWidth;
height = canvas.height = videoHeight;

Sender.add({type: "setup", width: width, height: height});
//Sender.add({type: "setup", width: width, height: height});

// allocate readBuffer for reading pixels
// do it now, because it is time consuming operation
Expand Down Expand Up @@ -557,7 +557,7 @@ const Detection = (function() {
time: new Date().getTime(),
sequence: -1
};
Sender.add(obj)
//Sender.add(obj)
};

/**
Expand All @@ -575,7 +575,7 @@ const Detection = (function() {
y: obj2.y,
count: obj2.count
};
Sender.add(obj);
//Sender.add(obj);
dataSent = true;
}

Expand All @@ -594,7 +594,7 @@ const Detection = (function() {
y: 0,
count: 0
};
Sender.add(obj)
//Sender.add(obj)
}
dataSent = false;
}
Expand Down

0 comments on commit 71b1313

Please sign in to comment.