From 06e1cb1fc27315d59acc51a0fa45797dd0187bdb Mon Sep 17 00:00:00 2001 From: Denis Borodin Date: Tue, 4 Dec 2018 10:20:45 +0300 Subject: [PATCH] StyleCode --- .travis.yml | 2 +- app.json | 1 + bower.json | 2 +- gulpfile.js | 2 +- src/css/gallery.styl | 6 +- src/css/markers.styl | 5 +- src/js/Tools/copyDirectionMarker.js | 6 +- src/js/Tools/copyInfoMarker.js | 17 ++- src/js/Tools/copyMarker.js | 14 +-- src/js/Tools/init.js | 17 +-- src/js/Tools/meshEditor.js | 169 ++++++++++++++-------------- src/js/Tools/setPoint.js | 14 ++- src/js/Tour/Image.js | 12 +- src/js/Tour/Video.js | 47 ++++---- src/js/Tour/animate.js | 2 +- src/js/Tour/controls.js | 2 +- src/js/Tour/load.js | 6 +- src/js/Tour/render.js | 8 +- src/js/Tour/sentry.js | 4 +- src/js/Tour/setGallery.js | 13 +-- src/js/Tour/setMarkers.js | 9 +- src/js/Tour/setMesh.js | 31 ++--- src/js/Tour/setPanorama.js | 3 +- src/js/Tour/setVideos.js | 20 ++-- src/js/UI/Gallery.js | 17 +-- src/js/UI/controlPanal.js | 2 +- src/js/UI/popUp.js | 7 +- 27 files changed, 231 insertions(+), 207 deletions(-) diff --git a/.travis.yml b/.travis.yml index 505a479..63caf00 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,3 +1,3 @@ language: node_js node_js: -- '5.4.0' +- '10.0.0' diff --git a/app.json b/app.json index 6165fde..9995829 100644 --- a/app.json +++ b/app.json @@ -1,4 +1,5 @@ { + "stack": "heroku-18", "name": "tour-player", "scripts": {}, "env": {}, diff --git a/bower.json b/bower.json index fef32b5..c74876e 100644 --- a/bower.json +++ b/bower.json @@ -1,7 +1,7 @@ { "name": "tour-player", "dependencies": { - "threejs": "latest" + "threejs": "r93" }, "overrides": { "threejs": { diff --git a/gulpfile.js b/gulpfile.js index d78099e..0378299 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -128,7 +128,7 @@ gulp.task('deploy', function() { })); }); -gulp.task('lint', ['jslint', 'jscs','stylint']); +gulp.task('lint', ['jscs','stylint']); gulp.task('build', ['clean', 'clear', 'mainBowerFiles'], function() { gulp.run(['scripts', 'styles']); }); diff --git a/src/css/gallery.styl b/src/css/gallery.styl index 96ead2e..e1cdc51 100644 --- a/src/css/gallery.styl +++ b/src/css/gallery.styl @@ -3,7 +3,7 @@ width 200px left -200px height 100% - background rgba(0,0,0,.8) + background rgba(0, 0, 0, .8) z-index 2 transition left.3s ease will-change left @@ -14,7 +14,7 @@ .gallery-toggler cursor pointer position absolute - background rgba(0,0,0,.8) + background rgba(0, 0, 0, .8) top 0 bottom 0 margin auto 0 @@ -80,7 +80,7 @@ position absolute bottom 0 margin 0 - background linear-gradient(to top,rgba(0,0,0,0.5) 40%, transparent) + background linear-gradient(to top, rgba(0, 0, 0, .5) 40%, transparent) color white padding 24px 10px 8px white-space nowrap diff --git a/src/css/markers.styl b/src/css/markers.styl index df2d618..ea01774 100644 --- a/src/css/markers.styl +++ b/src/css/markers.styl @@ -8,7 +8,7 @@ $arrow-size = 8px height 100% top 0 left 0 - + .marker position absolute height $marker-size @@ -37,7 +37,7 @@ $arrow-size = 8px &:hover transition transform .2s ease transform scale(1.15) - + &.left background-image embedurl("../img/markers/left.svg", "utf8") &.right @@ -123,7 +123,6 @@ $arrow-size = 8px border-right none border-left $arrow-size solid white -#markers .marker:hover .title $title-padding = $arrow-size * 1.5 diff --git a/src/js/Tools/copyDirectionMarker.js b/src/js/Tools/copyDirectionMarker.js index ec01be8..dbc1a42 100644 --- a/src/js/Tools/copyDirectionMarker.js +++ b/src/js/Tools/copyDirectionMarker.js @@ -1,13 +1,13 @@ /* globals Tools */ Tools.copyDirectionMarker = function(id, lat) { - console.info('Pano id:', Tour.view.id) + console.info('Pano id:', Tour.view.id); var code = JSON.stringify({ lat: lat || parseFloat(Tour.view.lat.value.toFixed(2)), lon: parseFloat(Tour.view.lon.value.toFixed(2)), icon: Tools.point.icon, - action:{type:'panorama', id:id} - }, null, ""); + action: { type: 'panorama', id: id } + }, null, ''); Tour.controls.copyText(code); }; diff --git a/src/js/Tools/copyInfoMarker.js b/src/js/Tools/copyInfoMarker.js index 64a3296..ca3effa 100644 --- a/src/js/Tools/copyInfoMarker.js +++ b/src/js/Tools/copyInfoMarker.js @@ -1,14 +1,21 @@ /* globals Tools */ Tools.copyInfoMarker = function(title, id) { - console.info('Pano id:', Tour.view.id) + console.info('Pano id:', Tour.view.id); + var marker = { lat: parseFloat(Tour.view.lat.value.toFixed(2)), - lon: parseFloat(Tour.view.lon.value.toFixed(2)), + lon: parseFloat(Tour.view.lon.value.toFixed(2)) + }; + + if (title) { + marker.title = title; } - if (title) marker.title = title; - if (id) marker.action = {type:'popup', id:id}; - var code = JSON.stringify(marker, null, ""); + if (id) { + marker.action = { type: 'popup', id: id }; + } + + var code = JSON.stringify(marker, null, ''); Tour.controls.copyText(code); }; diff --git a/src/js/Tools/copyMarker.js b/src/js/Tools/copyMarker.js index 3d43900..b9349d1 100644 --- a/src/js/Tools/copyMarker.js +++ b/src/js/Tools/copyMarker.js @@ -1,12 +1,12 @@ /* globals Tools */ -Tools.copyMarker = function(id) { - if(this.point.icon == 'info'){ - this.copyInfoMarker( - prompt('Enter title for info marker', 'title'), - prompt('Enter popup id', '') - ); +Tools.copyMarker = function() { + if (this.point.icon == 'info') { + this.copyInfoMarker( + prompt('Enter title for info marker', 'title'), + prompt('Enter popup id', '') + ); } else { - this.copyDirectionMarker(prompt('Enter pano id', Tour.view.id)); + this.copyDirectionMarker(prompt('Enter pano id', Tour.view.id)); } }; diff --git a/src/js/Tools/init.js b/src/js/Tools/init.js index 060ee5f..9aa1194 100644 --- a/src/js/Tools/init.js +++ b/src/js/Tools/init.js @@ -3,7 +3,7 @@ Tools.init = function() { this.setPoint(); window.addEventListener('keydown', function(event) { - if(event.keyCode == 13){ //Enter + if (event.keyCode == 13) { //Enter Tools.copyMarker(); } @@ -15,14 +15,15 @@ Tools.init = function() { }); new UI.mouseMenu.Hr(); - new UI.mouseMenu.Item(Tools.copyLon, 'Copy lon', '1') - new UI.mouseMenu.Item(Tools.meshEditor, 'Mesh editor', '2') + new UI.mouseMenu.Item(Tools.copyLon, 'Copy lon', '1'); + new UI.mouseMenu.Item(Tools.meshEditor, 'Mesh editor', '2'); - this.meshEditor() - Tour.view.fov.min = 5; Tour.view.fov.max = 130; -}; + this.meshEditor(); + Tour.view.fov.min = 5; + Tour.view.fov.max = 130; +}; -Tools.copyLon = function(){ +Tools.copyLon = function() { Tour.controls.copyText(parseFloat(Tour.view.get().lon.toFixed(2))); -} +}; diff --git a/src/js/Tools/meshEditor.js b/src/js/Tools/meshEditor.js index f1c9133..640abd2 100644 --- a/src/js/Tools/meshEditor.js +++ b/src/js/Tools/meshEditor.js @@ -1,27 +1,27 @@ /* globals Tools */ -Tools.meshEditor = function(id, lat) { +Tools.meshEditor = function() { this.selectedMesh = false; this.durationCrop = 0; - function onMouseMove( event ) { + function onMouseMove(event) { var mouse = new THREE.Vector2(); - mouse.x = ( event.clientX / window.innerWidth ) * 2 - 1; - mouse.y = - ( event.clientY / window.innerHeight ) * 2 + 1; + mouse.x = (event.clientX / window.innerWidth) * 2 - 1; + mouse.y = -(event.clientY / window.innerHeight) * 2 + 1; var raycaster = new THREE.Raycaster(); - raycaster.setFromCamera( mouse, Tour.camera ); - var intersects = raycaster.intersectObjects( Tour.meshs ); + raycaster.setFromCamera(mouse, Tour.camera); + var intersects = raycaster.intersectObjects(Tour.meshs); - Tour.meshs.forEach(function (n) { - n.material.color && n.material.color.set( 0xffffff ); + Tour.meshs.forEach(function(n) { + n.material.color && n.material.color.set(0xffffff); n.material.opacity = 1; - }) + }); Tools.selectedMesh = false; - for ( var i = 0; i < intersects.length; i++ ) { - if(intersects[ i ].object.material.color){ - intersects[ i ].object.material.color.set( 0xff0000 ); + for (var i = 0; i < intersects.length; i++) { + if (intersects[ i ].object.material.color) { + intersects[ i ].object.material.color.set(0xff0000); intersects[ i ].object.material.opacity = 0.6; Tools.selectedMesh = intersects[ i ].object; } @@ -29,120 +29,119 @@ Tools.meshEditor = function(id, lat) { } window.addEventListener('keydown', function(event) { - var alpha = 0.1 - console.log(event) - if(event.altKey) alpha/=10; - if(event.ctrlKey) alpha/=10; - if(event.shiftKey) alpha*=10; + var alpha = 0.1; + console.log(event); + + if (event.altKey) { alpha /= 10; } + if (event.ctrlKey) { alpha /= 10; } + if (event.shiftKey) { alpha *= 10; } var sm = Tools.selectedMesh; - if(sm){ + if (sm) { console.log(event.keyCode); - if(event.keyCode == 74){ //J - sm.position.z -= 1*alpha; - }else if(event.keyCode == 76){ //L - sm.position.z += 1*alpha; - }else if(event.keyCode == 73){ //K - sm.position.x += 1*alpha; - }else if(event.keyCode == 75){ //K - sm.position.x -= 1*alpha; - }else if(event.keyCode == 85){ //K - sm.position.y += 1*alpha; - }else if(event.keyCode == 79){ //K - sm.position.y -= 1*alpha; - }else if(event.keyCode == 219){ //{ - sm.rotation.y += Math.PI/2*alpha; - }else if(event.keyCode == 221){ // } - sm.rotation.y -= Math.PI/2*alpha; - }else if(event.keyCode == 57){ // ( - sm.rotation.z += Math.PI/2*alpha; - }else if(event.keyCode == 48){ // ) - sm.rotation.z -= Math.PI/2*alpha; - }else if(event.keyCode == 188){ // ( - sm.rotation.x += Math.PI/2*alpha; - }else if(event.keyCode == 190){ // ) - sm.rotation.x -= Math.PI/2*alpha; - }else if(event.keyCode == 84){ // ( - sm.scale.x += 1*alpha; - }else if(event.keyCode == 89){ // ) - sm.scale.x -= 1*alpha - }else if(event.keyCode == 71){ // ( - sm.scale.y += 1*alpha; - }else if(event.keyCode == 72){ // ) - sm.scale.y -= 1*alpha - }else if(event.keyCode == 86){ // v - Tools.durationCrop = ++Tools.durationCrop%4; - UI.notification.show('Set duration crop '+['top', 'right', 'bottom', 'left'][Tools.durationCrop]) - }else if(event.keyCode == 66){ // b - if(Tools.durationCrop == 0){ + if (event.keyCode == 74) { // J + sm.position.z -= 1 * alpha; + } else if (event.keyCode == 76) { // L + sm.position.z += 1 * alpha; + } else if (event.keyCode == 73) { // K + sm.position.x += 1 * alpha; + } else if (event.keyCode == 75) { // K + sm.position.x -= 1 * alpha; + } else if (event.keyCode == 85) { // K + sm.position.y += 1 * alpha; + } else if (event.keyCode == 79) { // K + sm.position.y -= 1 * alpha; + } else if (event.keyCode == 219) { //{ + sm.rotation.y += Math.PI / 2 * alpha; + } else if (event.keyCode == 221) { // } + sm.rotation.y -= Math.PI / 2 * alpha; + } else if (event.keyCode == 57) { // ( + sm.rotation.z += Math.PI / 2 * alpha; + } else if (event.keyCode == 48) { // ) + sm.rotation.z -= Math.PI / 2 * alpha; + } else if (event.keyCode == 188) { // ( + sm.rotation.x += Math.PI / 2 * alpha; + } else if (event.keyCode == 190) { // ) + sm.rotation.x -= Math.PI / 2 * alpha; + } else if (event.keyCode == 84) { // ( + sm.scale.x += 1 * alpha; + } else if (event.keyCode == 89) { // ) + sm.scale.x -= 1 * alpha; + } else if (event.keyCode == 71) { // ( + sm.scale.y += 1 * alpha; + } else if (event.keyCode == 72) { // ) + sm.scale.y -= 1 * alpha; + } else if (event.keyCode == 86) { // v + Tools.durationCrop = ++Tools.durationCrop % 4; + UI.notification.show('Set duration crop ' + ['top', 'right', 'bottom', 'left'][Tools.durationCrop]); + } else if (event.keyCode == 66) { // b + if (Tools.durationCrop == 0) { sm.material.map.repeat.y /= 1.1; sm.material.map.offset.y /= 1.1; Tools.selectedVideo.scale.y /= 1.1; - }else if(Tools.durationCrop == 1){ + } else if (Tools.durationCrop == 1) { sm.material.map.repeat.x /= 1.1; sm.material.map.offset.x /= 1.1; sm.scale.x /= 1.1; - }else if(Tools.durationCrop == 2){ + } else if (Tools.durationCrop == 2) { sm.material.map.repeat.y -= 0.1; sm.scale.y = sm.material.map.repeat.y; - }else if(Tools.durationCrop == 3){ + } else if (Tools.durationCrop == 3) { sm.material.map.repeat.x -= 0.1; sm.scale.x = sm.material.map.repeat.x; } - }else if(event.keyCode == 78){ // n - if(Tools.durationCrop == 0){ + } else if (event.keyCode == 78) { // n + if (Tools.durationCrop == 0) { sm.material.map.repeat.y *= 1.1; sm.material.map.offset.y *= 1.1; sm.scale.y *= 1.1; - }else if(Tools.durationCrop == 1){ + } else if (Tools.durationCrop == 1) { sm.material.map.repeat.x *= 1.1; sm.material.map.offset.x *= 1.1; sm.scale.x *= 1.1; - }else if(Tools.durationCrop == 2){ + } else if (Tools.durationCrop == 2) { sm.material.map.repeat.y += 0.1; sm.scale.y = sm.material.map.repeat.y; - }else if(Tools.durationCrop == 3){ + } else if (Tools.durationCrop == 3) { sm.material.map.repeat.x += 0.1; sm.scale.x = sm.material.map.repeat.x; } - } - - + }; - var fix = function(n){ + var fix = function(n) { return parseFloat(parseFloat(n).toFixed(4)); - } - - if(event.code == 'Digit8' && Tools.selectedMesh){ - var mesh = {} - var sm = Tools.selectedMesh; - mesh.position = {x: fix(sm.position.x), y: fix(sm.position.y), z: fix(sm.position.z)} - mesh.rotation = {x: fix(sm.rotation.x), y: fix(sm.rotation.y), z: fix(sm.rotation.z)} - if(sm._videoId){ - var alpha = Tour.videos[sm._videoId].canvas.height / Tour.videos[sm._videoId].canvas.width; + }; + + if (event.code == 'Digit8' && Tools.selectedMesh) { + var mesh = {}; + sm = Tools.selectedMesh; + mesh.position = {x: fix(sm.position.x), y: fix(sm.position.y), z: fix(sm.position.z)}; + mesh.rotation = {x: fix(sm.rotation.x), y: fix(sm.rotation.y), z: fix(sm.rotation.z)}; + if (sm._videoId) { + alpha = Tour.videos[sm._videoId].canvas.height / Tour.videos[sm._videoId].canvas.width; mesh.scale = { - x: fix(sm.scale.x / Tour.videos[sm._videoId].texture.repeat.x), + x: fix(sm.scale.x / Tour.videos[sm._videoId].texture.repeat.x), y: fix(sm.scale.y / Tour.videos[sm._videoId].texture.repeat.y) / alpha, z: fix(sm.scale.z) - } + }; + mesh.videoId = sm._videoId; - }else{ - var alpha = Tour.images[sm._imageId].height / Tour.images[sm._imageId].width; + } else { + alpha = Tour.images[sm._imageId].height / Tour.images[sm._imageId].width; mesh.scale = { - x: fix(sm.scale.x), + x: fix(sm.scale.x), y: fix(sm.scale.y / alpha), z: fix(sm.scale.z) - } + }; mesh.imageId = sm._imageId; } - Tour.controls.copyText(JSON.stringify(mesh)) + Tour.controls.copyText(JSON.stringify(mesh)); } } }); - - document.body.addEventListener('click', onMouseMove, false ); + document.body.addEventListener('click', onMouseMove, false); }; diff --git a/src/js/Tools/setPoint.js b/src/js/Tools/setPoint.js index 517b107..9cb1f45 100644 --- a/src/js/Tools/setPoint.js +++ b/src/js/Tools/setPoint.js @@ -4,16 +4,20 @@ Tools.setPoint = function() { var directions = ['up', 'right', 'down', 'left', 'point', 'info']; var currentDirection = -1; - var onclick = function(){ - Tools.point = {icon: directions[++currentDirection%directions.length]} + var onclick = function() { + Tools.point = {icon: directions[++currentDirection % directions.length]}; point.setIcon(Tools.point.icon); - } + }; var point = new UI.Marker(onclick, false, false); Object.assign(point.domElement.style, { - top: 0, left: 0, right: 0, bottom: 0, + top: 0, + left: 0, + right: 0, + bottom: 0, margin: 'auto' - }) + }); + onclick(); }; diff --git a/src/js/Tour/Image.js b/src/js/Tour/Image.js index 4e4f558..a8085cc 100644 --- a/src/js/Tour/Image.js +++ b/src/js/Tour/Image.js @@ -3,15 +3,15 @@ Tour.Image = function(options) { this.loader = new THREE.TextureLoader(); this.material = new THREE.MeshBasicMaterial({ - map: this.loader.load(options.src), - transparent: true, - // overdraw: 0.5, - // needsUpdate: true, - depthWrite: false + map: this.loader.load(options.src), + transparent: true, + // overdraw: 0.5, + // needsUpdate: true, + depthWrite: false }); this.width = options.width; this.height = options.height; - }; + //https://stackoverflow.com/questions/15994944/transparent-objects-in-threejs diff --git a/src/js/Tour/Video.js b/src/js/Tour/Video.js index 7d63217..38b218f 100644 --- a/src/js/Tour/Video.js +++ b/src/js/Tour/Video.js @@ -1,24 +1,27 @@ /* globals Tour, THREE*/ -Tour.Video = function (options) { +Tour.Video = function(options) { this.videoElement = document.createElement('video'); this.videoElement.src = options.src; // this.videoElement.autoplay = options.autoplay || true; this.videoElement.loop = options.loop || true; this.videoElement.muted = options.muted || true; - var that = this - var sync = function(){ - if(that.videoElement.duration && that.needsUpdate){ - that.videoElement.currentTime = (Date.now()/1000)%that.videoElement.duration; + var _this = this; + + var sync = function() { + if (_this.videoElement.duration && _this.needsUpdate) { + _this.videoElement.currentTime = (Date.now() / 1000) % _this.videoElement.duration; } - } + }; + + if (options.sync) { + clearTimeout(this.syncTimeout); + + Tour.on('changeView', function() { + _this.syncTimeout = setTimeout(sync, 2000); + }); - if(options.sync){ - clearTimeout(this.syncTimeout) - Tour.on('changeView', function(){ - that.syncTimeout = setTimeout(sync, 2000); - }) this.syncInterval = setInterval(sync, 10000); } @@ -28,28 +31,28 @@ Tour.Video = function (options) { this.videoElement.pause(); this.canvas = document.createElement('canvas'); - this.canvas.width = Math.pow(2 ,Math.ceil(Math.log(options.width) / Math.log(2))); - this.canvas.height = Math.pow(2 ,Math.ceil(Math.log(options.height) / Math.log(2))); + this.canvas.width = Math.pow(2, Math.ceil(Math.log(options.width) / Math.log(2))); + this.canvas.height = Math.pow(2, Math.ceil(Math.log(options.height) / Math.log(2))); - this.ctx = this.canvas.getContext( '2d' ); + this.ctx = this.canvas.getContext('2d'); - this.texture = new THREE.Texture( this.canvas ); - this.texture.repeat.x = options.width/this.canvas.width; - this.texture.repeat.y = options.height/this.canvas.height; + this.texture = new THREE.Texture(this.canvas); + this.texture.repeat.x = options.width / this.canvas.width; + this.texture.repeat.y = options.height / this.canvas.height; this.texture.offset.y = 1 - this.texture.repeat.y; this.texture.needsUpdate = true; this.needsUpdate = false; - this.material = new THREE.MeshBasicMaterial( { map: this.texture, overdraw: 0,transparent: true} ); + this.material = new THREE.MeshBasicMaterial({map: this.texture, overdraw: 0, transparent: true}); }; -Tour.Video.prototype.draw = function(){ - if(this.needsUpdate){ +Tour.Video.prototype.draw = function() { + if (this.needsUpdate) { this.videoElement.play(); this.ctx.drawImage(this.videoElement, 0, 0); this.texture.needsUpdate = true; Tour.needsUpdate = true; - }else{ + } else { this.videoElement.pause(); } -} +}; diff --git a/src/js/Tour/animate.js b/src/js/Tour/animate.js index 4b76877..9872100 100644 --- a/src/js/Tour/animate.js +++ b/src/js/Tour/animate.js @@ -7,7 +7,7 @@ Tour.animate = function() { if (Math.abs(this.view.rotation.lon) < Math.abs(this.options.autorotationSpeed)) { this.view.rotation.lon += this.options.autorotationSpeed / 100; } - if(this.options.autorotationAlign) { + if (this.options.autorotationAlign) { this.view.lat.set(this.view.lat.value / 1.01); this.view.fov.set(90 + ((this.view.fov.value - 90) / 1.005)); } diff --git a/src/js/Tour/controls.js b/src/js/Tour/controls.js index 45d2eca..b4e185f 100644 --- a/src/js/Tour/controls.js +++ b/src/js/Tour/controls.js @@ -183,6 +183,6 @@ Tour.controls = { }, closeWindow: function() { - UI.popUp.set() + UI.popUp.set(); } }; diff --git a/src/js/Tour/load.js b/src/js/Tour/load.js index 7511ad1..d0f21ae 100644 --- a/src/js/Tour/load.js +++ b/src/js/Tour/load.js @@ -13,10 +13,10 @@ Tour.load = function(data, callback) { return; } if (xhr.status != 200) { - var errorText - if(xhr.status == 0 || window.location.protocol == 'file:'){ + var errorText; + if (xhr.status == 0 || window.location.protocol == 'file:') { errorText = Lang.get('notification.error-load-tour-protocol'); - }else{ + } else { errorText = Lang.get('notification.error-load-tour'); } UI.notification.show(errorText, false); diff --git a/src/js/Tour/render.js b/src/js/Tour/render.js index c97bc15..5454040 100644 --- a/src/js/Tour/render.js +++ b/src/js/Tour/render.js @@ -2,12 +2,12 @@ Tour.render = function() { - if(!this.previousCamera || this.needsUpdate || + if (!this.previousCamera || this.needsUpdate || this.previousCamera.x != this.camera.rotation.x || this.previousCamera.y != this.camera.rotation.y || this.previousCamera.z != this.camera.rotation.z || this.previousCamera.w != this.camera.fov - ){ + ) { this.renderer.render(this.scene, this.camera); UI.controlPanel.setOrientation(Math.floor(THREE.Math.radToDeg(Tour.camera.rotation.z))); if (this.markers) { @@ -17,8 +17,8 @@ Tour.render = function() { } this.needsUpdate = false; if (this.videos) { - for(k in this.videos){ - this.videos[k].draw(); + for (k in this.videos) { + this.videos[k].draw(); } } Tour.emmit('render'); diff --git a/src/js/Tour/sentry.js b/src/js/Tour/sentry.js index 04ec05f..f53920f 100644 --- a/src/js/Tour/sentry.js +++ b/src/js/Tour/sentry.js @@ -3,10 +3,10 @@ Tour.sentry = function() { var script = document.createElement('script'); script.src = 'https://browser.sentry-cdn.com/4.2.2/bundle.min.js'; - script.crossorigin = "anonymous"; + script.crossorigin = 'anonymous'; document.getElementsByTagName('head')[0].appendChild(script); script.onload = function() { Sentry.init(Tour.options.sentry); - } + }; }; diff --git a/src/js/Tour/setGallery.js b/src/js/Tour/setGallery.js index c1f0fec..47a0ede 100644 --- a/src/js/Tour/setGallery.js +++ b/src/js/Tour/setGallery.js @@ -3,14 +3,13 @@ Tour.setGallery = function(data, visible) { if (this.options.gallery) { UI.gallery.init(visible); - - data.panorams.map(function(pano){ + data.panorams.map(function(pano) { if (pano.listNumber !== 0) { UI.gallery.addItem({ id: pano.id, - image: 'panorams/'+pano.id+'/thumbnail/mini.jpg', + image: 'panorams/' + pano.id + '/thumbnail/mini.jpg', title: Lang.translate(pano.title), - onclick: function(){ + onclick: function() { Tour.view.set(pano); } }); @@ -19,8 +18,8 @@ Tour.setGallery = function(data, visible) { UI.gallery.setActive(Tour.view.id); - Tour.on('changeView', function(view){ - UI.gallery.setActive(view.id) - }) + Tour.on('changeView', function(view) { + UI.gallery.setActive(view.id); + }); } }; diff --git a/src/js/Tour/setMarkers.js b/src/js/Tour/setMarkers.js index 2df9d30..8a299cc 100644 --- a/src/js/Tour/setMarkers.js +++ b/src/js/Tour/setMarkers.js @@ -30,9 +30,9 @@ Tour.setMarkers = function(id) { manager.onprogress = function(event) { UI.controlPanel.setProgress(event.progress); }; - for(var k in this.planes) { + for (var k in this.planes) { var planeId = this.planes[k][this.click % this.planes[k].length]; - var imgeURL = Tour.options.path + id + '/' + Tour.options.imageType + '/' + planeId+ '.jpg'; + var imgeURL = Tour.options.path + id + '/' + Tour.options.imageType + '/' + planeId + '.jpg'; Tour.setPlane(k, imgeURL, manager); } @@ -46,7 +46,10 @@ Tour.setMarkers = function(id) { (markers[i].action.type == 'panorama' && this.getPanorama(markers[i].action.id).title); marker.setTitle(Lang.translate(title)); - marker.setIcon(markers[i].icon || (markers[i].action && markers[i].action.type == 'panorama' ? 'up' : 'info')); + marker.setIcon( + markers[i].icon || + (markers[i].action && markers[i].action.type == 'panorama' ? 'up' : 'info') + ); this.markers.push(marker); } } diff --git a/src/js/Tour/setMesh.js b/src/js/Tour/setMesh.js index b0d5f89..8f1cfc0 100644 --- a/src/js/Tour/setMesh.js +++ b/src/js/Tour/setMesh.js @@ -3,7 +3,9 @@ Tour.setMesh = function(id) { if (this.meshs) { this.meshs.forEach(function(mesh) { - if(mesh._videoId)Tour.videos[mesh._videoId].needsUpdate = false; + if (mesh._videoId) { + Tour.videos[mesh._videoId].needsUpdate = false; + } Tour.scene.remove(mesh); }); } @@ -11,39 +13,40 @@ Tour.setMesh = function(id) { this.meshs = []; var videos = this.data.panorams && this.data.panorams[id] && this.data.panorams[id].videos; - if(videos){ - for(var i=0; i 90 && deg < 180) {orientation = 'portrait-secondary'; } else if (deg < -90 && deg > -180) {orientation = 'landscape-primary'; } else if (deg > 0 && deg < 90) {orientation = 'landscape-secondary';} - if(this.domElement) { + if (this.domElement) { this.domElement.setAttribute('data-orientation', orientation); } }; diff --git a/src/js/UI/popUp.js b/src/js/UI/popUp.js index 6ac824f..6c540d3 100644 --- a/src/js/UI/popUp.js +++ b/src/js/UI/popUp.js @@ -16,16 +16,15 @@ UI.popUp = { } }, set: function(id) { - - var canAccessIFrame = !!~Object.keys(window.parent.location).indexOf('host') - if(canAccessIFrame){ + var canAccessIFrame = !!~Object.keys(window.parent.location).indexOf('host'); + if (canAccessIFrame) { var scrollY = window.parent.scrollY; var scrollX = window.parent.scrollX; } window.location.hash = id || ''; - if(canAccessIFrame){ + if (canAccessIFrame) { window.parent.scrollTo(scrollX, scrollY); }