@@ -23,7 +23,6 @@ $(document).ready(function () {
2323} ) ;
2424
2525function initializeApplication ( metaDataJson ) {
26-
2726 //wait for canvas to be loaded full here...
2827 var canvas = document . getElementById ( canvasId ) ;
2928 if ( ! canvas ) {
@@ -34,25 +33,9 @@ function initializeApplication(metaDataJson){
3433 //create entity model
3534 model . initialize ( metaDataJson ) ;
3635
37- //switch to differentiate between x3dom and a-frame (specified in index.html/aframe.html)
38- if ( visMode ) {
39- switch ( visMode ) {
40- case "aframe" : {
41- aframeActionController . initialize ( ) ;
42- aframeCanvasManipulator . initialize ( ) ;
43- break ;
44- }
45- case "x3dom" :
46- default : {
47- //start action controller
48- actionController . initialize ( ) ;
49-
50- //initialize canvas manipulator
51- canvasManipulator . initialize ( ) ;
52- break ;
53- }
54- }
55- }
36+ console . debug ( "Initialize ActionController" ) ;
37+ actionController . initialize ( ) ;
38+ canvasManipulator . initialize ( ) ;
5639
5740 //initialize application
5841 application . initialize ( ) ;
@@ -123,9 +106,9 @@ var application = (function() {
123106
124107
125108 function startConfigParsingAfterControllerLoading ( ) {
126-
127109 //check that all controllers loaded
128110 if ( setup . controllers . length !== controllers . size ) {
111+ console . debug ( "controllers not loaded yet..." ) ;
129112 setTimeout ( startConfigParsingAfterControllerLoading , 1 ) ;
130113 return ;
131114 }
@@ -135,10 +118,15 @@ var application = (function() {
135118 canvasElement = document . getElementById ( "canvas" ) ;
136119
137120 //create ui div element
138- var uiDIV = document . createElement ( "DIV" ) ;
139- uiDIV . id = "ui" ;
140- bodyElement . appendChild ( uiDIV ) ;
141- currentUIConfig . uiDIV = uiDIV ;
121+ /* AFRAME-WORKAROUND
122+ FÜR AFRAME - existierendes DIV statt neuem UI aus aframe.html
123+ id von "ui" zu "canvas" geändert
124+ var uiDIV = document.getElementById("canvas");*/
125+
126+ var uiDIV = document . createElement ( "DIV" ) ;
127+ uiDIV . id = "ui" ;
128+ bodyElement . appendChild ( uiDIV ) ;
129+ currentUIConfig . uiDIV = uiDIV ;
142130
143131 //activate controller
144132 newActiveControllers = [ ] ;
@@ -149,7 +137,6 @@ var application = (function() {
149137
150138 //activate controller
151139 activateController ( ) ;
152-
153140 events . log . info . publish ( { text : "new config loaded: " + currentUIConfig . name } ) ;
154141 } catch ( err ) {
155142 events . log . error . publish ( { text : err . message } ) ;
@@ -205,7 +192,7 @@ var application = (function() {
205192 currentUIConfig = nextUIConfig ;
206193 currentUIConfig . uiDIV = uiDIV ;
207194
208- //collect old active controllers for deactivation
195+ //collect old active controllers for deactivation
209196 oldActiveControllers = Array . from ( activeControllers . keys ( ) ) ;
210197 newActiveControllers = [ ] ;
211198
@@ -214,16 +201,15 @@ var application = (function() {
214201 parseUIConfig ( currentUIConfig . name , currentUIConfig , uiDIV ) ;
215202
216203 //deactive controller
217- deactivateController ( oldActiveControllers ) ;
204+ deactivateController ( oldActiveControllers ) ;
218205
219206 //activate controller
220- activateController ( ) ;
207+ activateController ( ) ;
221208
222209 events . log . info . publish ( { text : "new config loaded: " + currentUIConfig . name } ) ;
223210 } catch ( err ) {
224211 events . log . error . publish ( { text : err . message } ) ;
225212 }
226-
227213 }
228214
229215
@@ -303,11 +289,18 @@ var application = (function() {
303289
304290 //canvas
305291 if ( configPart . canvas !== undefined ) {
306-
307- var canvasParentElement = canvasElement . parentElement ;
308- canvasParentElement . removeChild ( canvasElement ) ;
309-
310- parent . appendChild ( canvasElement ) ;
292+ if ( visMode != "aframe" ) {
293+ var canvasParentElement = canvasElement . parentElement ;
294+ canvasParentElement . removeChild ( canvasElement ) ;
295+
296+ parent . appendChild ( canvasElement ) ;
297+ } else {
298+ var canvasParentElement = canvasElement . parentElement ;
299+ canvasParentElement . removeChild ( canvasElement ) ;
300+
301+ parent . appendChild ( canvasElement . cloneNode ( true ) ) ;
302+ // evtl canvas löschen ??
303+ }
311304 }
312305
313306 //controller
@@ -332,7 +325,6 @@ var application = (function() {
332325
333326 function loadAndInitializeController ( controller ) {
334327 var controllerName = controller . name ;
335- if ( visMode == "aframe" ) console . debug ( "loadAndInitializeController(" + controller . name + ")" ) ;
336328
337329 //controller allready loaded by html-file?
338330 if ( window [ controllerName ] ) {
@@ -389,15 +381,14 @@ var application = (function() {
389381 }
390382
391383 function activateController ( ) {
392- console . debug ( arguments . callee . name ) ;
393384 newActiveControllers . forEach ( function ( controllerObject ) {
394385 if ( controllerObject . activate ) {
395386 var controllerDiv = activeControllers . get ( controllerObject ) ;
387+ console . debug ( controllerObject ) ;
396388
397389 controllerObject . activate ( controllerDiv ) ;
398390 }
399- } ) ;
400-
391+ } ) ;
401392 }
402393
403394
@@ -422,29 +413,31 @@ var application = (function() {
422413 //*******************
423414
424415 function createNavigationMode ( navigationObject ) {
425-
426- var navigationInfoElement = document . getElementById ( "navigationInfo" ) ;
427-
428- if ( ! navigationInfoElement ) {
429- var scene = document . getElementById ( "scene" ) ;
430-
431- navigationInfoElement = document . createElement ( "NAVIGATIONINFO" ) ;
432- navigationInfoElement . id = "navigationInfo" ;
433-
434- scene . appendChild ( navigationInfoElement ) ;
435- }
436-
437- if ( navigationObject . type ) {
438- navigationInfoElement . setAttribute ( "type" , navigationObject . type ) ;
439- }
440- if ( navigationObject . speed ) {
441- navigationInfoElement . setAttribute ( "speed" , navigationObject . speed ) ;
442- }
443-
444- //Turntable seems not to work with 1.7 and dynamic adding
445- if ( navigationObject . typeParams ) {
446- navigationInfoElement . setAttribute ( "typeParams" , navigationObject . typeParams ) ;
447- }
416+ if ( visMode == "x3dom" ) {
417+ var navigationInfoElement = document . getElementById ( "navigationInfo" ) ;
418+
419+ if ( ! navigationInfoElement ) {
420+ var scene = document . getElementById ( "scene" ) ;
421+
422+ navigationInfoElement = document . createElement ( "NAVIGATIONINFO" ) ;
423+ navigationInfoElement . id = "navigationInfo" ;
424+
425+ scene . appendChild ( navigationInfoElement ) ;
426+ }
427+
428+ if ( navigationObject . type ) {
429+ navigationInfoElement . setAttribute ( "type" , navigationObject . type ) ;
430+ }
431+ if ( navigationObject . speed ) {
432+ navigationInfoElement . setAttribute ( "speed" , navigationObject . speed ) ;
433+ }
434+
435+ //Turntable seems not to work with 1.7 and dynamic adding
436+ if ( navigationObject . typeParams ) {
437+ navigationInfoElement . setAttribute ( "typeParams" , navigationObject . typeParams ) ;
438+ }
439+ }
440+ else console . debug ( "No x3dom - no navigationInfoElement" ) ;
448441 }
449442
450443 function createPanel ( areaPart ) {
0 commit comments