Added distance and time calculations. General tweaks.
This commit is contained in:
1 parent
2de0aa215c
commit
a20a24fd76
5 files changed
+191
-27
No files matched your search
+52
-2
@@ -1,3 +1,5 @@
|
|||||||
|
var lastInputBox;
|
||||||
|
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
// Controls menu hide/show
|
// Controls menu hide/show
|
||||||
$('#hotdog').click(function(){
|
$('#hotdog').click(function(){
|
||||||
@@ -10,9 +12,30 @@ $(document).ready(function() {
|
|||||||
var selected = $('#findbyselect option:selected').text();
|
var selected = $('#findbyselect option:selected').text();
|
||||||
zoomfocus(selected);
|
zoomfocus(selected);
|
||||||
});
|
});
|
||||||
|
$('#calctnd').click(function() {
|
||||||
|
$('#cal_start').html( $('#pointa option:selected').text() );
|
||||||
|
$('#cal_end').html( $('#pointb option:selected').text() );
|
||||||
|
$('#cal_speed').html( $('#speed').val() +" " + $('#speedunit option:selected').val() );
|
||||||
|
var dist = calcDist( $('#pointa option:selected').text(), $('#pointb option:selected').text() );
|
||||||
|
var eta = calcETA({'speed': $('#speed').val(), 'unit': $('#speedunit option:selected').val()},dist)
|
||||||
|
$('#cal_eta').html( timeformat(eta) );
|
||||||
|
$('#cal_dist').html( dist.toFixed(2) + " PC");
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$("#pointa").focus(function() {
|
||||||
|
lastInputBox = "pointa";
|
||||||
|
// console.log('Updating last touched box to : ' + lastInputBox)
|
||||||
|
});
|
||||||
|
$("#pointb").focus(function() {
|
||||||
|
lastInputBox = "pointb";
|
||||||
|
// console.log('Updating last touched box to : ' + lastInputBox)
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
function populateUserFields() {
|
function populateUserFields() {
|
||||||
//Populate find by select dropdown
|
//Populate find by select dropdown
|
||||||
var types = [];
|
var types = [];
|
||||||
@@ -31,6 +54,18 @@ function populateUserFields() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$('#findbyselect').html(option);
|
$('#findbyselect').html(option);
|
||||||
|
|
||||||
|
// Populate pointa and pointb dropdowns
|
||||||
|
var types = ['planets','stations'];
|
||||||
|
for (var type in types){
|
||||||
|
for ( var key in listobjects(types[type]) ){
|
||||||
|
option += '<option value="'+ escapeHTML(key) + '">' + escapeHTML(key) + '</option>';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$('#pointa').html(option);
|
||||||
|
$('#pointb').html(option);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function openTab(evt,tabName) {
|
function openTab(evt,tabName) {
|
||||||
@@ -47,8 +82,7 @@ function openTab(evt,tabName) {
|
|||||||
evt.currentTarget.className += " wvg-tab-active";
|
evt.currentTarget.className += " wvg-tab-active";
|
||||||
}
|
}
|
||||||
|
|
||||||
function escapeHTML(text)
|
function escapeHTML(text) {
|
||||||
{
|
|
||||||
var chr = { '"': '"', '&': '&', '<': '[', '>': ']' };
|
var chr = { '"': '"', '&': '&', '<': '[', '>': ']' };
|
||||||
function abc(a)
|
function abc(a)
|
||||||
{
|
{
|
||||||
@@ -56,3 +90,19 @@ function escapeHTML(text)
|
|||||||
}
|
}
|
||||||
return text.replace(/[\"&<>]/g, abc);
|
return text.replace(/[\"&<>]/g, abc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function timeformat(secs) {
|
||||||
|
var s = new Decimal(secs);
|
||||||
|
var hours = new Decimal(secs / 3600);
|
||||||
|
var h = hours.floor(); //Get whole hours
|
||||||
|
s = s - (h * 3600);
|
||||||
|
var m = new Decimal(s / 60); //Get remaining minutes
|
||||||
|
m = m.floor();
|
||||||
|
s = s - (m * 60 );
|
||||||
|
s = Math.round(s,0)
|
||||||
|
console.log("Hours :"+ h);
|
||||||
|
console.log("Minutes :"+ m);
|
||||||
|
console.log("Seconds :"+ s);
|
||||||
|
console.log("Input :"+ secs);
|
||||||
|
return h+":"+(m < 10 ? '0'+m : m)+":"+(s < 10 ? '0'+s : s); //zero padding on minutes and seconds
|
||||||
|
}
|
||||||
Vendored
+3
@@ -0,0 +1,3 @@
|
|||||||
|
/* decimal.js v6.0.0 https://github.com/MikeMcl/decimal.js/LICENCE */
|
||||||
|
!function(n){"use strict";function e(n){var e,i,t,r=n.length-1,s="",o=n[0];if(r>0){for(s+=o,e=1;r>e;e++)t=n[e]+"",i=Rn-t.length,i&&(s+=l(i)),s+=t;o=n[e],t=o+"",i=Rn-t.length,i&&(s+=l(i))}else if(0===o)return"0";for(;o%10===0;)o/=10;return s+o}function i(n,e,i){if(n!==~~n||e>n||n>i)throw Error(Mn+n)}function t(n,e,i,t){var r,s,o,u;for(s=n[0];s>=10;s/=10)--e;return--e<0?(e+=Rn,r=0):(r=Math.ceil((e+1)/Rn),e%=Rn),s=On(10,Rn-e),u=n[r]%s|0,null==t?3>e?(0==e?u=u/100|0:1==e&&(u=u/10|0),o=4>i&&99999==u||i>3&&49999==u||5e4==u||0==u):o=(4>i&&u+1==s||i>3&&u+1==s/2)&&(n[r+1]/s/100|0)==On(10,e-2)-1||(u==s/2||0==u)&&0==(n[r+1]/s/100|0):4>e?(0==e?u=u/1e3|0:1==e?u=u/100|0:2==e&&(u=u/10|0),o=(t||4>i)&&9999==u||!t&&i>3&&4999==u):o=((t||4>i)&&u+1==s||!t&&i>3&&u+1==s/2)&&(n[r+1]/s/1e3|0)==On(10,e-3)-1,o}function r(n,e,i){for(var t,r,s=[0],o=0,u=n.length;u>o;){for(r=s.length;r--;)s[r]*=e;for(s[0]+=wn.indexOf(n.charAt(o++)),t=0;t<s.length;t++)s[t]>i-1&&(void 0===s[t+1]&&(s[t+1]=0),s[t+1]+=s[t]/i|0,s[t]%=i)}return s.reverse()}function s(n,e){var i,t,r=e.d.length;32>r?(i=Math.ceil(r/3),t=Math.pow(4,-i).toString()):(i=16,t="2.3283064365386962890625e-10"),n.precision+=i,e=E(n,1,e.times(t),new n(1));for(var s=i;s--;){var o=e.times(e);e=o.times(o).minus(o).times(8).plus(1)}return n.precision-=i,e}function o(n,e,i,t){var r,s,o,u,c,f,a,h,l,d=n.constructor;n:if(null!=e){if(h=n.d,!h)return n;for(r=1,u=h[0];u>=10;u/=10)r++;if(s=e-r,0>s)s+=Rn,o=e,a=h[l=0],c=a/On(10,r-o-1)%10|0;else if(l=Math.ceil((s+1)/Rn),u=h.length,l>=u){if(!t)break n;for(;u++<=l;)h.push(0);a=c=0,r=1,s%=Rn,o=s-Rn+1}else{for(a=u=h[l],r=1;u>=10;u/=10)r++;s%=Rn,o=s-Rn+r,c=0>o?0:a/On(10,r-o-1)%10|0}if(t=t||0>e||void 0!==h[l+1]||(0>o?a:a%On(10,r-o-1)),f=4>i?(c||t)&&(0==i||i==(n.s<0?3:2)):c>5||5==c&&(4==i||t||6==i&&(s>0?o>0?a/On(10,r-o):0:h[l-1])%10&1||i==(n.s<0?8:7)),1>e||!h[0])return h.length=0,f?(e-=n.e+1,h[0]=On(10,(Rn-e%Rn)%Rn),n.e=-e||0):h[0]=n.e=0,n;if(0==s?(h.length=l,u=1,l--):(h.length=l+1,u=On(10,Rn-s),h[l]=o>0?(a/On(10,r-o)%On(10,o)|0)*u:0),f)for(;;){if(0==l){for(s=1,o=h[0];o>=10;o/=10)s++;for(o=h[0]+=u,u=1;o>=10;o/=10)u++;s!=u&&(n.e++,h[0]==Pn&&(h[0]=1));break}if(h[l]+=u,h[l]!=Pn)break;h[l--]=0,u=1}for(s=h.length;0===h[--s];)h.pop()}return xn&&(n.e>d.maxE?(n.d=null,n.e=NaN):n.e<d.minE&&(n.e=0,n.d=[0])),n}function u(n,i,t){if(!n.isFinite())return v(n);var r,s=n.e,o=e(n.d),u=o.length;return i?(t&&(r=t-u)>0?o=o.charAt(0)+"."+o.slice(1)+l(r):u>1&&(o=o.charAt(0)+"."+o.slice(1)),o=o+(n.e<0?"e":"e+")+n.e):0>s?(o="0."+l(-s-1)+o,t&&(r=t-u)>0&&(o+=l(r))):s>=u?(o+=l(s+1-u),t&&(r=t-s-1)>0&&(o=o+"."+l(r))):((r=s+1)<u&&(o=o.slice(0,r)+"."+o.slice(r)),t&&(r=t-u)>0&&(s+1===u&&(o+="."),o+=l(r))),o}function c(n,e){for(var i=1,t=n[0];t>=10;t/=10)i++;return i+e*Rn-1}function f(n,e,i){if(e>Un)throw xn=!0,i&&(n.precision=i),Error(yn);return o(new n(mn),e,1,!0)}function a(n,e,i){if(e>_n)throw Error(yn);return o(new n(vn),e,i,!0)}function h(n){var e=n.length-1,i=e*Rn+1;if(e=n[e]){for(;e%10==0;e/=10)i--;for(e=n[0];e>=10;e/=10)i++}return i}function l(n){for(var e="";n--;)e+="0";return e}function d(n,e,i,t){var r,s=new n(1),o=Math.ceil(t/Rn+4);for(xn=!1;;){if(i%2&&(s=s.times(e),q(s.d,o)&&(r=!0)),i=qn(i/2),0===i){i=s.d.length-1,r&&0===s.d[i]&&++s.d[i];break}e=e.times(e),q(e.d,o)}return xn=!0,s}function p(n){return 1&n.d[n.d.length-1]}function g(n,e,i){for(var t,r=new n(e[0]),s=0;++s<e.length;){if(t=new n(e[s]),!t.s){r=t;break}r[i](t)&&(r=t)}return r}function w(n,i){var r,s,u,c,f,a,h,l=0,d=0,p=0,g=n.constructor,w=g.rounding,m=g.precision;if(!n.d||!n.d[0]||n.e>17)return new g(n.d?n.d[0]?n.s<0?0:1/0:1:n.s?n.s<0?0:n:NaN);for(null==i?(xn=!1,h=m):h=i,a=new g(.03125);n.e>-2;)n=n.times(a),p+=5;for(s=Math.log(On(2,p))/Math.LN10*2+5|0,h+=s,r=c=f=new g(1),g.precision=h;;){if(c=o(c.times(n),h,1),r=r.times(++d),a=f.plus(Sn(c,r,h,1)),e(a.d).slice(0,h)===e(f.d).slice(0,h)){for(u=p;u--;)f=o(f.times(f),h,1);if(null!=i)return g.precision=m,f;if(!(3>l&&t(f.d,h-s,w,l)))return o(f,g.precision=m,w,xn=!0);g.precision=h+=10,r=c=a=new g(1),d=0,l++}f=a}}function m(n,i){var r,s,u,c,a,h,l,d,p,g,w,v=1,N=10,b=n,x=b.d,E=b.constructor,M=E.rounding,y=E.precision;if(b.s<0||!x||!x[0]||!b.e&&1==x[0]&&1==x.length)return new E(x&&!x[0]?-1/0:1!=b.s?NaN:x?0:b);if(null==i?(xn=!1,p=y):p=i,E.precision=p+=N,r=e(x),s=r.charAt(0),!(Math.abs(c=b.e)<15e14))return d=f(E,p+2,y).times(c+""),b=m(new E(s+"."+r.slice(1)),p-N).plus(d),E.precision=y,null==i?o(b,y,M,xn=!0):b;for(;7>s&&1!=s||1==s&&r.charAt(1)>3;)b=b.times(n),r=e(b.d),s=r.charAt(0),v++;for(c=b.e,s>1?(b=new E("0."+r),c++):b=new E(s+"."+r.slice(1)),g=b,l=a=b=Sn(b.minus(1),b.plus(1),p,1),w=o(b.times(b),p,1),u=3;;){if(a=o(a.times(w),p,1),d=l.plus(Sn(a,new E(u),p,1)),e(d.d).slice(0,p)===e(l.d).slice(0,p)){if(l=l.times(2),0!==c&&(l=l.plus(f(E,p+2,y).times(c+""))),l=Sn(l,new E(v),p,1),null!=i)return E.precision=y,l;if(!t(l.d,p-N,M,h))return o(l,E.precision=y,M,xn=!0);E.precision=p+=N,d=a=b=Sn(g.minus(1),g.plus(1),p,1),w=o(b.times(b),p,1),u=h=1}l=d,u+=2}}function v(n){return String(n.s*n.s/0)Line truncated
|
||||||
|
//# sourceMappingURL=doc/decimal.js.map
|
||||||
+88
-14
@@ -2,12 +2,15 @@ if ( ! Detector.webgl ) Detector.addGetWebGLMessage();
|
|||||||
|
|
||||||
var camera, controls, scene, renderer;
|
var camera, controls, scene, renderer;
|
||||||
var clock = new THREE.Clock();
|
var clock = new THREE.Clock();
|
||||||
|
var raycaster = new THREE.Raycaster();
|
||||||
|
var mouse = new THREE.Vector2(), INTERSECTED;
|
||||||
var WIDTH = window.innerWidth , HEIGHT = window.innerHeight
|
var WIDTH = window.innerWidth , HEIGHT = window.innerHeight
|
||||||
|
|
||||||
window.onload = function() {
|
window.onload = function() {
|
||||||
loadData(function() {
|
loadData(function() {
|
||||||
init();
|
init();
|
||||||
animate();
|
animate();
|
||||||
|
populateUserFields();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -54,18 +57,13 @@ function init() {
|
|||||||
controls.dampingFactor = 0.25;
|
controls.dampingFactor = 0.25;
|
||||||
controls.enableZoom = true;
|
controls.enableZoom = true;
|
||||||
controls.addEventListener( 'change', render );
|
controls.addEventListener( 'change', render );
|
||||||
|
document.addEventListener( 'mousedown', onCanvasClick, false );
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
var Text2D = THREE_Text.Text2D;
|
var Text2D = THREE_Text.Text2D;
|
||||||
var SpriteText2D = THREE_Text.SpriteText2D;
|
var SpriteText2D = THREE_Text.SpriteText2D;
|
||||||
var textAlign = THREE_Text.textAlign
|
var textAlign = THREE_Text.textAlign
|
||||||
var raycaster = new THREE.Raycaster();
|
|
||||||
var mouse = new THREE.Vector2();
|
|
||||||
var b_geometry, b_material, b_mesh, p_geometry, p_material, p_mesh, s_geometry, s_material, s_mesh, l_text;
|
var b_geometry, b_material, b_mesh, p_geometry, p_material, p_mesh, s_geometry, s_material, s_mesh, l_text;
|
||||||
|
|
||||||
|
|
||||||
@@ -83,7 +81,7 @@ for (var key in jsonEmpire) {
|
|||||||
b_mesh.position.x = border.x;
|
b_mesh.position.x = border.x;
|
||||||
b_mesh.position.y = border.y;
|
b_mesh.position.y = border.y;
|
||||||
b_mesh.position.z = border.z;
|
b_mesh.position.z = border.z;
|
||||||
b_mesh.name = border.name;
|
b_mesh.name = escapeHTML(border.name);
|
||||||
scene.add( b_mesh );
|
scene.add( b_mesh );
|
||||||
if (border.radius > 10) {
|
if (border.radius > 10) {
|
||||||
l_text = new Text2D(border.name, { align: textAlign.center, font: '25px Arial', fillStyle: '#777' , antialias: false });
|
l_text = new Text2D(border.name, { align: textAlign.center, font: '25px Arial', fillStyle: '#777' , antialias: false });
|
||||||
@@ -105,9 +103,9 @@ for (var key in jsonEmpire) {
|
|||||||
p_mesh.position.x=planet.x;
|
p_mesh.position.x=planet.x;
|
||||||
p_mesh.position.y=planet.y;
|
p_mesh.position.y=planet.y;
|
||||||
p_mesh.position.z=planet.z;
|
p_mesh.position.z=planet.z;
|
||||||
p_mesh.name = planet.name;
|
p_mesh.name = escapeHTML(planet.name);
|
||||||
scene.add( p_mesh );
|
scene.add( p_mesh );
|
||||||
l_text = new Text2D(planet.name, { align: textAlign.right, font: '12px Arial', fillStyle: '#FFF' , antialias: false });
|
l_text = new Text2D(escapeHTML(planet.name), { align: textAlign.right, font: '12px Arial', fillStyle: '#FFF' , antialias: false });
|
||||||
l_text.material.alphaTest = 0.0;
|
l_text.material.alphaTest = 0.0;
|
||||||
l_text.position.set(planet.x,planet.y,planet.z);
|
l_text.position.set(planet.x,planet.y,planet.z);
|
||||||
l_text.scale.set(0.25,0.25,0.25);
|
l_text.scale.set(0.25,0.25,0.25);
|
||||||
@@ -123,9 +121,9 @@ for (var key in jsonEmpire) {
|
|||||||
s_mesh.position.x=base.x;
|
s_mesh.position.x=base.x;
|
||||||
s_mesh.position.y=base.y;
|
s_mesh.position.y=base.y;
|
||||||
s_mesh.position.z=base.z;
|
s_mesh.position.z=base.z;
|
||||||
s_mesh.name = base.name;
|
s_mesh.name = escapeHTML(base.name);
|
||||||
scene.add( s_mesh );
|
scene.add( s_mesh );
|
||||||
l_text = new Text2D(base.name, { align: textAlign.left, font: '12px Arial', fillStyle: '#ABABAB' , antialias: false });
|
l_text = new Text2D(escapeHTML(base.name), { align: textAlign.left, font: '12px Arial', fillStyle: '#ABABAB' , antialias: false });
|
||||||
l_text.material.alphaTest = 0.0;
|
l_text.material.alphaTest = 0.0;
|
||||||
l_text.position.set(base.x,base.y+3,base.z);
|
l_text.position.set(base.x,base.y+3,base.z);
|
||||||
l_text.scale.set(0.20,0.20,0.20);
|
l_text.scale.set(0.20,0.20,0.20);
|
||||||
@@ -148,20 +146,46 @@ window.onresize = function() {
|
|||||||
render();
|
render();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
function onCanvasClick( event ) {
|
||||||
|
|
||||||
|
//event.preventDefault();
|
||||||
|
|
||||||
|
mouse.x = ( event.clientX / window.innerWidth ) * 2 - 1;
|
||||||
|
mouse.y = - ( event.clientY / window.innerHeight ) * 2 + 1;
|
||||||
|
|
||||||
|
raycaster.setFromCamera( mouse, camera );
|
||||||
|
var intersects = raycaster.intersectObjects( scene.children );
|
||||||
|
|
||||||
|
if ( intersects.length > 0 ) {
|
||||||
|
if ( INTERSECTED != intersects[ 0 ].object ) {
|
||||||
|
|
||||||
|
INTERSECTED = intersects[ 0 ].object;
|
||||||
|
// console.log( INTERSECTED.name );
|
||||||
|
document.getElementById(lastInputBox).value = INTERSECTED.name;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
INTERSECTED = null;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
function animate() {
|
function animate() {
|
||||||
var delta = clock.getDelta();
|
var delta = clock.getDelta();
|
||||||
requestAnimationFrame( animate );
|
requestAnimationFrame( animate );
|
||||||
scene.updateMatrixWorld()
|
scene.updateMatrixWorld()
|
||||||
controls.update(delta);
|
controls.update(delta);
|
||||||
render();
|
render();
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function render () {
|
function render () {
|
||||||
//requestAnimationFrame( render );
|
//requestAnimationFrame( render );
|
||||||
renderer.render( scene, camera );
|
renderer.render( scene, camera );
|
||||||
|
// find intersections
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -187,7 +211,7 @@ function zoomfocus(name) {
|
|||||||
for (var type in types) {
|
for (var type in types) {
|
||||||
var objects = listobjects(types[type]);
|
var objects = listobjects(types[type]);
|
||||||
for ( var key in objects ) {
|
for ( var key in objects ) {
|
||||||
if (escapeHTML(key) == name) {
|
if (key == name) {
|
||||||
var object = objects[key];
|
var object = objects[key];
|
||||||
controls.target.x = object.x;
|
controls.target.x = object.x;
|
||||||
controls.target.y = object.y;
|
controls.target.y = object.y;
|
||||||
@@ -225,3 +249,53 @@ function removeEntity(object) {
|
|||||||
scene.remove( selectedObject );
|
scene.remove( selectedObject );
|
||||||
animate();
|
animate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Calculates SU/s with given warp factor
|
||||||
|
function calcSUpS(warpfactor) {
|
||||||
|
// 14.0*29.979246*1298.737508 = 257494817.55 SU/s
|
||||||
|
// Velocity = WF^3.333333*lightspeed*cochranes
|
||||||
|
// 3087467836.3256578445 = 1 Parsec
|
||||||
|
var cochranes = 1298.737508; // Average cochranes
|
||||||
|
var lightspeed = 29.979246; // Lightspeed constant
|
||||||
|
var exponent = 3.333333;
|
||||||
|
|
||||||
|
var sus = Math.pow(warpfactor,exponent) * lightspeed * cochranes ;
|
||||||
|
return sus;
|
||||||
|
}
|
||||||
|
|
||||||
|
function su2pc ( su ) {
|
||||||
|
return su / 3087467836.3256578445;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Calculates ETA for given distance and velocity.
|
||||||
|
// Velocity should be supplied as an array of speed and unit
|
||||||
|
function calcETA(velocity,distance) {
|
||||||
|
var speed = velocity.speed;
|
||||||
|
var unit = velocity.unit;
|
||||||
|
var seconds;
|
||||||
|
switch (unit) {
|
||||||
|
case 'SU/s':
|
||||||
|
seconds = new Decimal( distance / su2pc(speed) );
|
||||||
|
break;
|
||||||
|
case 'PC/s':
|
||||||
|
seconds = new Decimal( distance / speed );
|
||||||
|
break;
|
||||||
|
case 'WF':
|
||||||
|
seconds = distance / su2pc(calcSUpS(speed));
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
throw "Invalid unit of speed."
|
||||||
|
}
|
||||||
|
|
||||||
|
return seconds;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// Calculate the distance between two named points ( Stations or Bases )
|
||||||
|
function calcDist(pointa, pointb) {
|
||||||
|
var obj_A = scene.getObjectByName(pointa);
|
||||||
|
var obj_B = scene.getObjectByName(pointb);
|
||||||
|
|
||||||
|
var distance = obj_A.position.distanceTo(obj_B.position);
|
||||||
|
return distance;
|
||||||
|
}
|
||||||
@@ -41869,4 +41869,3 @@ THREE.MorphBlendMesh.prototype.update = function ( delta ) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
+48
-10
@@ -2,6 +2,7 @@
|
|||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<script src="js/three.js"></script>
|
<script src="js/three.js"></script>
|
||||||
|
<script src="js/decimal.min.js"></script>
|
||||||
<script src="js/OrbitControls.js"></script>
|
<script src="js/OrbitControls.js"></script>
|
||||||
<script src="js/three-text2d.js"></script>
|
<script src="js/three-text2d.js"></script>
|
||||||
<script src="js/Detector.js"></script>
|
<script src="js/Detector.js"></script>
|
||||||
@@ -30,8 +31,8 @@
|
|||||||
ul.wvg-navbar li { width:auto; height: 100%; float: left; } .wvg-tablink { margin: 0; padding: 0; padding: 8px 10px; font-weight: bold; text-align: center; font-family: 'Space Mono', monospace; color:#67989A; }
|
ul.wvg-navbar li { width:auto; height: 100%; float: left; } .wvg-tablink { margin: 0; padding: 0; padding: 8px 10px; font-weight: bold; text-align: center; font-family: 'Space Mono', monospace; color:#67989A; }
|
||||||
.wvg-tab-active { background-color: #0D4A4D; color: #003133; }
|
.wvg-tab-active { background-color: #0D4A4D; color: #003133; }
|
||||||
.wvg-tools { width: 100%; height: 98%; background: #333; display: none; color: #AAA; padding-top: 2vh; padding-left:1vw; padding-right: 2.5vw;}
|
.wvg-tools { width: 100%; height: 98%; background: #333; display: none; color: #AAA; padding-top: 2vh; padding-left:1vw; padding-right: 2.5vw;}
|
||||||
.wvg-tools select {
|
.wvg-tools select, .wvg-tools input {
|
||||||
width: 75%;
|
width: 12vw;
|
||||||
padding: 5px;
|
padding: 5px;
|
||||||
font-size: 16px;
|
font-size: 16px;
|
||||||
line-height: 1;
|
line-height: 1;
|
||||||
@@ -43,7 +44,8 @@
|
|||||||
color: #67989A;
|
color: #67989A;
|
||||||
margin: 0 auto;
|
margin: 0 auto;
|
||||||
}
|
}
|
||||||
.wvg-tools span { text-align: center; color: #FFF; font-family: 'Space Mono', monospace; margin: 0 auto;}
|
.wvg-tools input { background: #333; width: 11.4vw; }
|
||||||
|
.wvg-tools span { text-align: center; color: #FFF; font-family: 'Space Mono', monospace; display: block; padding-right: 3vw; }
|
||||||
.wvg-first { display: block; }
|
.wvg-first { display: block; }
|
||||||
#wrapper { height: inherit; width: 100%; }
|
#wrapper { height: inherit; width: 100%; }
|
||||||
.active { display: block; }
|
.active { display: block; }
|
||||||
@@ -86,17 +88,22 @@
|
|||||||
font-family: 'Space Mono', monospace;
|
font-family: 'Space Mono', monospace;
|
||||||
color: #003133;
|
color: #003133;
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
|
font-weight: bolder;
|
||||||
width: 75%;
|
width: 75%;
|
||||||
height: 4vh;
|
height: 4vh;
|
||||||
padding: 3px;
|
padding: 3px;
|
||||||
|
margin-top:1vh;
|
||||||
border: solid #67878A 1px;
|
border: solid #67878A 1px;
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
.btn:hover {
|
.btn:hover {
|
||||||
background: #0D4A4D;
|
background: #0D4A4D;
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
}
|
}
|
||||||
|
.tool-header { font-weight: bold; padding-top: 5vh; display: block; }
|
||||||
|
|
||||||
|
.toolsep { margin-right: 1vw; padding:0; padding-top: 1vh; padding-bottom: 2.5vh; border-bottom: 1px #AAA solid; height: 1vh; display: block; width: 64%;}
|
||||||
|
.calc_data { padding-top: 2.5vh; font-size: 0.9em; }
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
@@ -105,16 +112,47 @@
|
|||||||
<div id="controls" class="wvg-controls active">
|
<div id="controls" class="wvg-controls active">
|
||||||
<div id="wrapper">
|
<div id="wrapper">
|
||||||
<ul class="wvg-navbar">
|
<ul class="wvg-navbar">
|
||||||
<li><a class="wvg-tablink wvg-tab-active" href='#' onclick="openTab(event,'Find');">Find</a></li>
|
<li><a class="wvg-tablink wvg-tab-active" href='#' onclick="openTab(event,'Find');">Find & Calc</a></li>
|
||||||
|
<!-- <li><a class="wvg-tablink" href='#' onclick="openTab(event,'Tools');">Tools</a></li> -->
|
||||||
<li><a class="wvg-tablink" href='#' onclick="openTab(event,'Info');">Info</a></li>
|
<li><a class="wvg-tablink" href='#' onclick="openTab(event,'Info');">Info</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
<div class="wvg-tools wvg-first" id="Find">
|
<div class="wvg-tools wvg-first" id="Find">
|
||||||
<span> Find Object By Name </span>
|
<span class="tool-header"> Find Object By Name </span>
|
||||||
<span> <select id="findbyselect">
|
<span>
|
||||||
|
<select id="findbyselect">
|
||||||
<option value=''></option>
|
<option value=''></option>
|
||||||
</select> </span>
|
</select> <br />
|
||||||
<br/><input type="checkbox" name="objtype" id="cbp" value="planets" onclick="populateUserFields();"><label for="cbp"> Planets</label> <input type="checkbox" name="objtype" id="cbs" value="stations" onclick="populateUserFields();"> <label for="cbs">Stations</label>
|
<input type="checkbox" name="objtype" id="cbp" value="planets" checked><label for="cbp"> Planets</label> <input type="checkbox" name="objtype" id="cbs" value="stations" onclick="populateUserFields();"> <label for="cbs">Stations</label>
|
||||||
<br /><button id="submitfindbyname" class="btn">Find</button>
|
<button id="submitfindbyname" class="btn">Find</button>
|
||||||
|
</span>
|
||||||
|
<span class="toolsep"></span>
|
||||||
|
<span class="tool-header"> Travel Time & Distances </span>
|
||||||
|
<span>
|
||||||
|
<label for="pointa">Point A</label>
|
||||||
|
<select id="pointa" name="Point_A">
|
||||||
|
<!-- Options will generated in code -->
|
||||||
|
</select>
|
||||||
|
<br />
|
||||||
|
<label for="pointb"> Point B </label>
|
||||||
|
<select id="pointb" name="Point_B">
|
||||||
|
<!-- Options will generated in code -->
|
||||||
|
</select>
|
||||||
|
<label for="speed">Travel Speed</label>
|
||||||
|
<input type="text" id="speed" value="14">
|
||||||
|
<select id="speedunit" name="Speed Unit">
|
||||||
|
<option value='WF'>Warp Factor</option>
|
||||||
|
<option value='PC/s'>PC/s</option>
|
||||||
|
<option value='SU/s'>SU/s</option>
|
||||||
|
</select>
|
||||||
|
<br />
|
||||||
|
<button id="calctnd" class="btn">Calculate</button>
|
||||||
|
</span>
|
||||||
|
<span class="calc_data"><br />
|
||||||
|
From: <u><i id="cal_start">Empty</i></u> <br />
|
||||||
|
To: <u><i id="cal_end">Empty</i></u><br />
|
||||||
|
Distance: <u><i id="cal_dist">Unknown</i></u><br />
|
||||||
|
ETA @ <u><i id="cal_speed">Unknown</i></u> : <u><i id="cal_eta">Unknown</i></u>
|
||||||
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="wvg-tools" id="Info">
|
<div class="wvg-tools" id="Info">
|
||||||
<span> This tool was designed by Frey @ ATSMUSH. It is based on MapView for ATS with data used from the Navcomp MUSHClient plugin with permission. </span>
|
<span> This tool was designed by Frey @ ATSMUSH. It is based on MapView for ATS with data used from the Navcomp MUSHClient plugin with permission. </span>
|
||||||
|
|||||||
Reference in new issue
Block a user