Add files via upload
diff --git a/js/camera.js b/js/camera.js
index ac4894f..44e9f5d 100644
--- a/js/camera.js
+++ b/js/camera.js
@@ -1,3 +1,6 @@
+// *********** HERE STARTS camera.js *************
+
+
window.addEventListener('load', initCamera);
function cameraGoto(nodeX, nodeY) {
@@ -7,16 +10,44 @@
);
}
-function initCamera() {
- document.querySelector("#zoomin").addEventListener("click", function() {
- s.camera.goTo({
- ratio: Math.max(s.camera.settings("zoomMin"), s.camera.ratio / Math.sqrt(2))
- });
- });
+function is_touch_device() {
+ var prefixes = ' -webkit- -moz- -o- -ms- '.split(' ');
+ var mq = function(query) {
+ return window.matchMedia(query).matches;
+ }
- document.querySelector("#zoomout").addEventListener("click", function() {
- s.camera.goTo({
- ratio: Math.min(s.camera.settings("zoomMax"), s.camera.ratio * Math.sqrt(2))
+ if (('ontouchstart' in window) || window.DocumentTouch && document instanceof DocumentTouch) {
+ return true;
+ }
+
+ // include the 'heartz' as a way to have a non matching MQ to help terminate the join
+ // https://git.io/vznFH
+ var query = ['(', prefixes.join('touch-enabled),('), 'heartz', ')'].join('');
+ return mq(query);
+}
+
+function initCamera() {
+
+ if(!is_touch_device()) {
+
+ document.querySelector("#zoomin").addEventListener("click", function() {
+ s.camera.goTo({
+ ratio: Math.max(s.camera.settings("zoomMin"), s.camera.ratio / Math.sqrt(2))
+ });
});
- });
+
+ document.querySelector("#zoomout").addEventListener("click", function() {
+ s.camera.goTo({
+ ratio: Math.min(s.camera.settings("zoomMax"), s.camera.ratio * Math.sqrt(2))
+ });
+ });
+ }
+ else{
+ document.querySelector("#zoomin").style.display = "none";
+ document.querySelector("#zoomout").style.display = "none";
+
+ document.querySelector("#circle-mode").style.bottom = "110px";
+ document.querySelector("#settings").style.bottom = "60px";
+ document.querySelector("#search").style.bottom = "10px";
+ }
}