Skip to content

Commit 313e5c2

Browse files
committed
Fix AR button overlap on Samsung devices by shifting custom AR button via container queries
1 parent 29e37b1 commit 313e5c2

1 file changed

Lines changed: 28 additions & 1 deletion

File tree

  • packages/modelviewer.dev/examples/loading

packages/modelviewer.dev/examples/loading/index.html

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -425,17 +425,44 @@ <h4>Our renderer tries to keep the frame rate between 38 and 60 frames per secon
425425
<example-snippet stamp-to="renderScale" highlight-as="html">
426426
<template>
427427
<style>
428+
model-viewer#scale {
429+
container-type: size;
430+
}
428431
.controls {
429432
position: absolute;
430433
display: flex;
431434
flex-direction: column;
432435
align-items: flex-start;
433-
top: 16px;
436+
bottom: 16px;
434437
left: 16px;
438+
z-index: 10;
439+
}
440+
.custom-ar-button {
441+
position: absolute;
442+
top: 16px;
443+
right: 16px;
444+
background-color: white;
445+
border: 1px solid #dadce0;
446+
border-radius: 4px;
447+
padding: 8px 12px;
448+
font-weight: 500;
449+
font-size: 14px;
450+
color: #1a73e8;
451+
box-shadow: 0 2px 4px rgba(0,0,0,.1);
452+
cursor: pointer;
453+
z-index: 10;
454+
transform: translateY(calc(100cqh - 100% - 32px));
455+
transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
456+
}
457+
@container (max-width: 700px) {
458+
.custom-ar-button {
459+
transform: translateY(0px);
460+
}
435461
}
436462
</style>
437463
<model-viewer id="scale" alt="A 3D model of a toy car" camera-controls touch-action="pan-y" auto-rotate
438464
src="../../shared-assets/models/glTF-Sample-Assets/Models/ToyCar/glTF-Binary/ToyCar.glb" ar>
465+
<button slot="ar-button" class="custom-ar-button">View in AR</button>
439466
<div class="controls glass">
440467
<div>
441468
Reported DPR: <span id="reportedDpr"></span>

0 commit comments

Comments
 (0)