Skip to content

Commit

Permalink
code passes eslint
Browse files Browse the repository at this point in the history
  • Loading branch information
davidmtech committed May 1, 2017
1 parent 55ba182 commit 372cac7
Show file tree
Hide file tree
Showing 69 changed files with 1,392 additions and 1,447 deletions.
7 changes: 3 additions & 4 deletions src/browser/autopilot/autopilot.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ Autopilot.prototype.flyTo = function(position, options) {


Autopilot.prototype.flyTrajectory = function(trajectory, sampleDuration) {
var options = {};
this.setTrajectory(trajectory, sampleDuration || 10, {});
};

Expand Down Expand Up @@ -115,20 +114,20 @@ Autopilot.prototype.tick = function() {
return;
}

var time = performance.now();
var time = performance.now(), pos;
var timeFactor = (time - this.lastTime) / 1000;
this.lastTime = time;

if (this.autoRotate != 0) {
var pos = map.getPosition();
pos = map.getPosition();
var o = pos.getOrientation();
o[0] = (o[0] + this.autoRotate*timeFactor) % 360;
pos.setOrientation(o);
map.setPosition(pos);
}

if (this.autoPan != 0) {
var pos = map.getPosition();
pos = map.getPosition();
pos = map.movePositionCoordsTo(pos, this.autoPanAzimuth, map.getPositionViewExtent(pos)*(this.autoPan*0.01)*timeFactor, 0);
map.setPosition(pos);
}
Expand Down
8 changes: 4 additions & 4 deletions src/browser/browser.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

import {Core as Core_, getCoreVersion as getCoreVersion_, checkSupport as checkSupport_} from '../core/core';
import {checkSupport as checkSupport_} from '../core/core';
import {CoreInterface as CoreInterface_} from '../core/interface';
import {utils as utils_} from '../core/utils/utils';
import UI_ from './ui/ui';
Expand All @@ -16,7 +16,7 @@ var Autopilot = Autopilot_;
var ControlMode = ControlMode_;
var Presenter = Presenter_;
var Rois = Rois_;
var Core = Core_, getCoreVersion = getCoreVersion_, checkSupport = checkSupport_;
var checkSupport = checkSupport_;


var Browser = function(element, config) {
Expand Down Expand Up @@ -251,7 +251,7 @@ Browser.prototype.onTick = function() {
};


Browser.prototype.initConfig = function(data) {
Browser.prototype.initConfig = function() {
this.config = {
panAllowed : true,
rotationAllowed : true,
Expand Down Expand Up @@ -287,7 +287,7 @@ Browser.prototype.initConfig = function(data) {
Browser.prototype.setConfigParams = function(params, ignoreCore) {
if (typeof params === 'object' && params !== null) {
for (var key in params) {
this.setConfigParam(key, params[key]);
this.setConfigParam(key, params[key], ignoreCore);

/*if (!(key == "pos" || key == "position" || key == "view" ||
key.indexOf("map") == 0 || key.indexOf("renderer") == 0)) {
Expand Down
61 changes: 31 additions & 30 deletions src/browser/control-mode/map-observer.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,10 @@ ControlModeMapObserver.prototype.drag = function(event) {
var pos = map.getPosition();
var coords = pos.getCoords();
var delta = event.getDragDelta();
var zoom = event.getDragZoom();
//var zoom = event.getDragZoom();
var touches = event.getDragTouches();
var azimuthDistance = this.getAzimuthAndDistance(delta[0], delta[1]);
var sensitivity;

var modifierKey = (this.browser.controlMode.altKey
|| this.browser.controlMode.shiftKey
Expand All @@ -54,8 +55,8 @@ ControlModeMapObserver.prototype.drag = function(event) {
}

if (event.getTouchParameter('touchMode') == 'pan' && this.config.rotationAllowed) {
var pan = event.getTouchParameter('touchPanDelta');
var sensitivity = this.config.sensitivity[1] * this.retinaFactor;
//var pan = event.getTouchParameter('touchPanDelta');
sensitivity = this.config.sensitivity[1] * this.retinaFactor;
this.orientationDeltas.push([delta[0] * sensitivity,
-delta[1] * sensitivity, 0]);
this.browser.callListener('map-position-rotated', {});
Expand All @@ -76,7 +77,7 @@ ControlModeMapObserver.prototype.drag = function(event) {
this.setPosition(pos);
}
} else {
var sensitivity = this.config.sensitivity[0] * this.retinaFactor;
sensitivity = this.config.sensitivity[0] * this.retinaFactor;
var fov = pos.getFov();
var fovCorrection = (fov > 0.01 && fov < 179) ? (1.0 / Math.tan(math.radians(fov*0.5))) : 1.0;
var azimuth = math.radians(azimuthDistance[0]);
Expand All @@ -92,7 +93,7 @@ ControlModeMapObserver.prototype.drag = function(event) {
} else if (((touches <= 1 && event.getDragButton('right')) || event.getDragButton('middle') || modifierKey)
&& this.config.rotationAllowed) { //rotate

var sensitivity = this.config.sensitivity[1] * this.retinaFactor;
sensitivity = this.config.sensitivity[1] * this.retinaFactor;
this.orientationDeltas.push([delta[0] * sensitivity,
-delta[1] * sensitivity, 0]);
this.browser.callListener('map-position-rotated', {});
Expand Down Expand Up @@ -164,15 +165,15 @@ ControlModeMapObserver.prototype.doubleclick = function(event) {
};


ControlModeMapObserver.prototype.keyup = function(event) {
ControlModeMapObserver.prototype.keyup = function() {
};


ControlModeMapObserver.prototype.keydown = function(event) {
ControlModeMapObserver.prototype.keydown = function() {
};


ControlModeMapObserver.prototype.keypress = function(event) {
ControlModeMapObserver.prototype.keypress = function() {
};


Expand Down Expand Up @@ -231,31 +232,31 @@ ControlModeMapObserver.prototype.getAzimuthAndDistance = function(dx, dy) {
};


ControlModeMapObserver.prototype.tick = function(event) {
ControlModeMapObserver.prototype.tick = function() {
var map = this.browser.getMap();
if (map == null) {
return;
}

var pos = map.getPosition();
var update = false;
var pos = map.getPosition(), delta, deltas;
var update = false, azimuth, correction, i;
var inertia = this.config.inertia; //[0.83, 0.9, 0.7];
//var inertia = [0.95, 0.8, 0.8];
//var inertia = [0, 0, 0];

//process coords deltas
if (this.coordsDeltas.length > 0) {
var deltas = this.coordsDeltas;
deltas = this.coordsDeltas;
var forward = [0,0];
var coords = pos.getCoords();

//get foward vector form coord deltas
for (var i = 0; i < deltas.length; i++) {
var delta = deltas[i];
for (i = 0; i < deltas.length; i++) {
delta = deltas[i];

var coords2 = [delta[4], delta[5]];
//var coords2 = [delta[4], delta[5]];

var azimuth = delta[3];
azimuth = delta[3];
azimuth += 0;//map.getAzimuthCorrection(coords2, coords);
azimuth = math.radians(azimuth);

Expand All @@ -277,18 +278,18 @@ ControlModeMapObserver.prototype.tick = function(event) {
}

var distance = Math.sqrt(forward[0]*forward[0] + forward[1]*forward[1]);
var azimuth = math.degrees(Math.atan2(forward[0], forward[1]));
azimuth = math.degrees(Math.atan2(forward[0], forward[1]));

//console.log("tick: " + azimuth + " " + distance);

//apply final azimuth and distance
if (this.config.navigationMode == 'free') {
var correction = pos.getOrientation()[0];
correction = pos.getOrientation()[0];
pos = map.movePositionCoordsTo(pos, (this.isNavigationSRSProjected() ? -1 : 1) * azimuth, distance);
correction = pos.getOrientation()[0] - correction;
} else { // "azimuthal"

var correction = pos.getOrientation()[0];
correction = pos.getOrientation()[0];
//pos = map.movePositionCoordsTo(pos, (this.isNavigationSRSProjected() ? -1 : 1) * azimuth, distance, true);


Expand Down Expand Up @@ -341,8 +342,8 @@ ControlModeMapObserver.prototype.tick = function(event) {

//console.log("correction2: " + correction);

for (var i = 0; i < deltas.length; i++) {
var delta = deltas[i];
for (i = 0; i < deltas.length; i++) {
delta = deltas[i];
delta[3] += correction;
}

Expand All @@ -351,12 +352,12 @@ ControlModeMapObserver.prototype.tick = function(event) {

//process coords deltas
if (this.orientationDeltas.length > 0) {
var deltas = this.orientationDeltas;
deltas = this.orientationDeltas;
var orientation = pos.getOrientation();

//apply detals to current orientation
for (var i = 0; i < deltas.length; i++) {
var delta = deltas[i];
for (i = 0; i < deltas.length; i++) {
delta = deltas[i];
orientation[0] += delta[0];
orientation[1] += delta[1];
orientation[2] += delta[2];
Expand All @@ -379,11 +380,11 @@ ControlModeMapObserver.prototype.tick = function(event) {

//process view extents deltas
if (this.viewExtentDeltas.length > 0) {
var deltas = this.viewExtentDeltas;
deltas = this.viewExtentDeltas;
var viewExtent = pos.getViewExtent();

//apply detals to current view extent
for (var i = 0; i < deltas.length; i++) {
for (i = 0; i < deltas.length; i++) {
viewExtent *= deltas[i];
deltas[i] += (1 - deltas[i]) * (1.0 - inertia[2]);

Expand All @@ -408,7 +409,7 @@ ControlModeMapObserver.prototype.tick = function(event) {
};


ControlModeMapObserver.prototype.reset = function(config) {
ControlModeMapObserver.prototype.reset = function() {
this.coordsDeltas = [];
this.orientationDeltas = [];
this.viewExtentDeltas = [];
Expand All @@ -423,7 +424,7 @@ function constrainMapPosition(browser, pos) {
var minVE = browser.config.minViewExtent;
var maxVE = browser.config.maxViewExtent;

var map = browser.getMap();
var map = browser.getMap(), o;

//clamp view extets
var viewExtent = math.clamp(pos.getViewExtent(), minVE, maxVE);
Expand All @@ -442,7 +443,7 @@ function constrainMapPosition(browser, pos) {
var maxTilt = 20 + ((-90) - 20) * factor;
var minTilt = -90;

var o = pos.getOrientation();
o = pos.getOrientation();

if (o[1] > maxTilt) {
o[1] = maxTilt;
Expand All @@ -468,7 +469,7 @@ function constrainMapPosition(browser, pos) {
var cameraHeight = camPos[2]; //this.cameraHeight() - this.cameraHeightOffset - this.cameraHeightOffset2;

if (cameraHeight < hmax) {
var o = pos.getOrientation();
o = pos.getOrientation();

var getFinalOrientation = (function(start, end, level) {
var value = (start + end) * 0.5;
Expand Down
8 changes: 4 additions & 4 deletions src/browser/control-mode/pano.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,19 +75,19 @@ ControlModePano.prototype.wheel = function(event) {
};


ControlModePano.prototype.keyup = function(event) {
ControlModePano.prototype.keyup = function() {
};


ControlModePano.prototype.keydown = function(event) {
ControlModePano.prototype.keydown = function() {
};


ControlModePano.prototype.keypress = function(event) {
ControlModePano.prototype.keypress = function() {
};


ControlModePano.prototype.tick = function(event) {
ControlModePano.prototype.tick = function() {
if (this.velocity[0] == 0.0 && this.velocity[1] == 0.0) {
return;
}
Expand Down
15 changes: 8 additions & 7 deletions src/browser/presenter/presenter.js
Original file line number Diff line number Diff line change
Expand Up @@ -183,8 +183,8 @@ Presenter.prototype.readTextInput = function(id) {
path = path + loc[i] + '/';
}
path = path + this.htmlDataStorage.split(split)[1];
console.log('Final path:');
console.log(path);
//console.log('Final path:');
//console.log(path);
this.htmlDataStorage = path;
return 'url';
} else if (hash.test(this.htmlDataStorage)) {
Expand Down Expand Up @@ -278,7 +278,7 @@ Presenter.prototype.linksDecode = function(obj) {

// parseFloat here
Presenter.prototype.getNumbers = function(obj) {
var obj = obj;
//var obj = obj;
for (var i = 0; i < obj.length; i++){
if (typeof obj == 'string' && parseFloat(obj)) {
obj = parseFloat(obj);
Expand Down Expand Up @@ -333,9 +333,10 @@ Presenter.prototype.useToolbox = function() {
}

var rightPanel = this.container.getElementsByClassName('vts-presenter panelContainer')[0];
var toolboxContainer = this.container.getElementsByClassName('vts-presenter toolboxContainer')[0];
//var toolboxContainer = this.container.getElementsByClassName('vts-presenter toolboxContainer')[0];
var subtitles = this.container.getElementsByClassName('vts-presenter subtitlesContainer')[0];
var swipeControl = this.container.getElementsByClassName('vts-presenter swipeControl');
var i;
this.currentToolbox = type;

subtitles.setAttribute('style', 'opacity: 0;');
Expand All @@ -347,7 +348,7 @@ Presenter.prototype.useToolbox = function() {
}, 20);
swipeControl[0].style.display = 'block';
swipeControl[1].style.display = 'block';
for (var i = 0; i < this.sectionTags.length; i++) { // Set maxHeight back as there is no dynamic rescaling of rightPanel
for (i = 0; i < this.sectionTags.length; i++) { // Set maxHeight back as there is no dynamic rescaling of rightPanel
this.sectionTags[i].style.height = this.maxHeight + 'px';
}
this.nextArticle(0);
Expand All @@ -360,7 +361,7 @@ Presenter.prototype.useToolbox = function() {
rightPanel.style.opacity = 0;
swipeControl[0].style.display = 'none';
swipeControl[1].style.display = 'none';
for (var i = 0; i < this.sectionTags.length; i++) { // Set height to auto so we can dynamicaly adjust subtitles height
for (i = 0; i < this.sectionTags.length; i++) { // Set height to auto so we can dynamicaly adjust subtitles height
this.sectionTags[i].style.height = 'auto';
}
this.handleSubtitlesPosition(0, true);
Expand Down Expand Up @@ -427,7 +428,7 @@ Presenter.prototype.getElementsTrueHeight = function(elems) {
}
}

for (var i = 0; i < elems.length; i++) {
for (i = 0; i < elems.length; i++) {
elems[i].style.height = this.maxHeight + 'px';
}
};
Expand Down
2 changes: 1 addition & 1 deletion src/browser/rois/rois.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ var Rois = function(roiServers) {
* @param clb callback
* @return Response promise object (if ES6 is supported otherwise null)
*/
Rois.prototype.roisAtPosition = function(position, count, clb) {
Rois.prototype.roisAtPosition = function(/*position, count, clb*/) {
// TODO request ROI server
// ROI gravity must be defined before implementation
};
Expand Down
Loading

0 comments on commit 372cac7

Please sign in to comment.