diff --git a/js/ui_init.js b/js/ui_init.js index bae0ad549956bf9b4516c68d7685d4daae6db876..e9ba217da92ba55ad5a6e58355e669031e1ad333 100644 --- a/js/ui_init.js +++ b/js/ui_init.js @@ -165,10 +165,14 @@ function light_init(){ Map = new LeafletObject('leaflet_map',Data,{}); //wait until it DOM is extended x3dom.runtime.ready = function(){ + map_resize_init(); deep_init(); align_init(); x3d_initial_camera_placement(); + x3d_events(); + leaf_events(); + }; }); @@ -239,7 +243,7 @@ function deep_init(){ cnt = parseInt(progress_counter[1]); if (!Scene._X3DOM_SCENE_INIT_DONE&&(cnt==0)){ - + //Scene.initResize(); // now then all shapes are parsed and accessible @@ -247,8 +251,6 @@ function deep_init(){ Scene._X3DOM_SCENE_INIT_DONE = true; - x3d_events(); - leaf_events(); } }; @@ -545,6 +547,8 @@ function leaf_mousemove_hc(){ x3dom_altelev(altitude,elevation); + X3DOMObject.displayViewInfo({}); + } function leaf_mousemove_nohc(e){ diff --git a/js/x3dom_functions.js b/js/x3dom_functions.js index f6ddb3a5a6a682d2d27633b977c7ed9e396a2f27..e392255aa4565db53e26483d8641038cff7adaed 100644 --- a/js/x3dom_functions.js +++ b/js/x3dom_functions.js @@ -35,6 +35,15 @@ * for the JavaScript code in this page. */ +function x3dom_getViewTranslation(elem){ + + var m = elem.runtime.viewMatrix().inverse(); + var tr = m.e3(); + + return tr; + +} + /** * get position and orientation in the 3D scene defined by mouse's canvas x,y */ @@ -277,8 +286,12 @@ function x3dom_altelev(alt,elev){ var mat = R0.mult(mat); var ypr = x3dom_YawPitchRoll_nc(mat); var ypr2 = x3dom_YawPitchRoll_nc_degs(mat); + console.log("Check1"); + console.log(ypr2); var from = mat.e3(); + + console.log(from); from.y = alt; var az = ypr.yaw; @@ -295,13 +308,17 @@ function x3dom_altelev(alt,elev){ var R_rw = x3dom_TixMxT(R); var R_w = R0.inverse().mult(R_rw); - var ypr2 = x3dom_YawPitchRoll_nc_degs(R_w); + var ypr2 = x3dom_YawPitchRoll_nc_degs(R_rw); + console.log("Check2"); + console.log(ypr2); var matt = x3dom.fields.SFMatrix4f.translation(from); var newmat = matt.mult(R_w); x3dom_setViewpoint(newmat); + + console.log(newmat.e3()); }