Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Alfakhori
Gengenbach
Commits
29e6ece1
Commit
29e6ece1
authored
Sep 29, 2026
by
Alfakhori
Browse files
fix
parent
f2bf92b7
Pipeline
#12470
passed with stage
in 24 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
public/ar_main.js
View file @
29e6ece1
...
@@ -1204,28 +1204,67 @@ async function activateXR(sceneData = null) {
...
@@ -1204,28 +1204,67 @@ async function activateXR(sceneData = null) {
// Show main menu
// Show main menu
// ========================================================
// ========================================================
menu
Element
s
[
"
menu-bar
"
]
.
style
.
display
=
"
flex
"
;
document
.
get
Element
ById
(
"
menu-bar
"
)
.
style
.
display
=
"
flex
"
;
// ========================================================
// ========================================================
// AR session ended
// AR session ended
// ========================================================
// ========================================================
currentSession
.
addEventListener
(
"
end
"
,
()
=>
{
currentSession
.
addEventListener
(
"
end
"
,
()
=>
{
console
.
log
(
"
AR session ended
"
);
// ====================================================
// Stop the AR session reference
// ====================================================
currentSession
=
null
;
currentSession
=
null
;
// Hide dynamic menu
// ====================================================
// Remove the XR canvas
//
// This prevents the dark/black screen from remaining
// over the normal start page.
// ====================================================
if
(
canvas
&&
canvas
.
parentNode
)
{
canvas
.
parentNode
.
removeChild
(
canvas
);
}
document
.
getElementById
(
"
dynamic-menu
"
).
style
.
display
=
"
none
"
;
// ====================================================
// Hide dynamic AR menu
// ====================================================
const
dynamicMenu
=
document
.
getElementById
(
"
dynamic-menu
"
);
if
(
dynamicMenu
)
{
dynamicMenu
.
style
.
display
=
"
none
"
;
}
// Hide all application menus
// ====================================================
// Hide AR menus
// ====================================================
menus
.
forEach
((
id
)
=>
{
menus
.
forEach
((
id
)
=>
{
const
element
=
menu
Element
s
[
id
]
;
const
element
=
document
.
get
Element
ById
(
id
)
;
if
(
element
)
{
if
(
element
)
{
element
.
style
.
display
=
"
none
"
;
element
.
style
.
display
=
"
none
"
;
}
}
});
});
// ====================================================
// Clear selected model
// ====================================================
selectedPlacedModel
=
null
;
// ====================================================
// Return to the normal start page
// ====================================================
if
(
typeof
showStartScreen
===
"
function
"
)
{
showStartScreen
();
}
});
});
// ========================================================
// ========================================================
...
...
public/ar_start.js
View file @
29e6ece1
/* ========================= */
/* ========================= */
/* DEBUGGING UND START */
/* DEBUGGING UND START */
/* ========================= */
/* ========================= */
let
sceneData
=
null
;
let
sceneFileName
=
null
;
let
startButton
=
null
;
let
loadButton
=
null
;
/* ============================================================ */
/* Create the Start AR / Load Scene buttons */
/* ============================================================ */
function
showStartScreen
()
{
// Prevent duplicate buttons
if
(
startButton
||
loadButton
)
{
return
;
}
/* ========================= */
/* START AR */
/* ========================= */
startButton
=
document
.
createElement
(
"
button
"
);
startButton
.
textContent
=
"
Start AR
"
;
startButton
.
style
.
cssText
=
"
position: fixed;
"
+
"
top: 45%;
"
+
"
left: 50%;
"
+
"
transform: translate(-50%, -50%);
"
+
"
padding: 15px;
"
+
"
font-size: 18px;
"
;
document
.
body
.
appendChild
(
startButton
);
/* ========================= */
/* LOAD SCENE */
/* ========================= */
loadButton
=
document
.
createElement
(
"
button
"
);
loadButton
.
textContent
=
sceneFileName
||
"
Umgebung Laden
"
;
loadButton
.
style
.
cssText
=
"
position: fixed;
"
+
"
top: 55%;
"
+
"
left: 50%;
"
+
"
transform: translate(-50%, -50%);
"
+
"
padding: 15px;
"
+
"
font-size: 18px;
"
;
document
.
body
.
appendChild
(
loadButton
);
/* ========================= */
/* START AR CLICK */
/* ========================= */
startButton
.
onclick
=
()
=>
{
// Remove start-page buttons
startButton
.
remove
();
loadButton
.
remove
();
// Reset references
startButton
=
null
;
loadButton
=
null
;
// Start AR
activateXR
(
sceneData
);
};
/* ========================= */
/* LOAD SCENE CLICK */
/* ========================= */
loadButton
.
onclick
=
()
=>
{
loadSceneFromFile
((
data
,
fileName
)
=>
{
if
(
data
&&
fileName
)
{
sceneData
=
data
;
sceneFileName
=
fileName
;
loadButton
.
textContent
=
fileName
;
}
else
{
loadButton
.
textContent
=
sceneFileName
||
"
Umgebung Laden
"
;
}
});
};
}
/* ========================= */
/* INITIAL START */
/* ========================= */
if
(
navigator
.
xr
)
{
if
(
navigator
.
xr
)
{
let
sceneData
;
showStartScreen
();
const
startButton
=
document
.
createElement
(
'
button
'
);
}
else
{
startButton
.
textContent
=
'
Start AR
'
;
alert
(
"
WebXR wird nicht unterstützt.
"
);
startButton
.
style
.
cssText
=
"
position: fixed; top: 45%; left: 50%; transform: translate(-50%, -50%); padding: 15px; font-size: 18px;
"
;
}
document
.
body
.
appendChild
(
startButton
);
startButton
.
onclick
=
()
=>
{
startButton
.
remove
();
loadButton
.
remove
();
activateXR
(
sceneData
);
};
const
loadButton
=
document
.
createElement
(
'
button
'
);
loadButton
.
textContent
=
'
Umgebung Laden
'
;
loadButton
.
style
.
cssText
=
"
position: fixed; top: 55%; left: 50%; transform: translate(-50%, -50%); padding: 15px; font-size: 18px;
"
;
document
.
body
.
appendChild
(
loadButton
);
loadButton
.
onclick
=
()
=>
{
loadSceneFromFile
((
data
,
fileName
)
=>
{
if
(
data
&&
fileName
)
{
loadButton
.
textContent
=
fileName
;
sceneData
=
data
}
else
{
loadButton
.
textContent
=
'
Umgebung Laden
'
;
}
});
};
}
else
{
alert
(
'
WebXR wird nicht unterstützt.
'
);
}
\ No newline at end of file
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment