bilca's picture
Update style.css
c34c82d verified
/* viewer.css - Modified to properly restore aspect ratio when exiting fullscreen */
/* Widget container styling */
.ply-widget-container {
position: relative;
width: 100%;
height: 0; /* Important: Height 0 allows padding-bottom to control size */
/* padding-bottom is set dynamically inline for aspect ratio */
background-color: black;
transition: all 0.3s ease; /* Smooth transition when toggling fullscreen */
box-sizing: border-box; /* Ensure padding is included in the height calculation */
overflow: hidden; /* Prevents content overflow */
}
/* When in fake fullscreen mode (iOS fallback) */
.ply-widget-container.fake-fullscreen {
position: fixed !important;
top: 0 !important;
left: 0 !important;
width: 100vw !important;
height: 100vh !important;
padding-bottom: 0 !important; /* Remove aspect ratio padding in fullscreen */
z-index: 9999 !important;
background-color: black;
border-radius: 0 !important;
margin: 0 !important;
max-width: 100vw !important;
max-height: 100vh !important;
box-sizing: border-box;
overflow: hidden;
}
/* For native fullscreen - ensure no aspect ratio padding */
.ply-widget-container:fullscreen {
width: 100vw !important;
height: 100vh !important;
padding-bottom: 0 !important;
border-radius: 0 !important;
background-color: black;
}
/* Vendor prefixes for fullscreen */
.ply-widget-container:-webkit-full-screen {
width: 100vw !important;
height: 100vh !important;
padding-bottom: 0 !important;
border-radius: 0 !important;
background-color: black;
}
.ply-widget-container:-moz-full-screen {
width: 100vw !important;
height: 100vh !important;
padding-bottom: 0 !important;
border-radius: 0 !important;
background-color: black;
}
.ply-widget-container:-ms-fullscreen {
width: 100vw !important;
height: 100vh !important;
padding-bottom: 0 !important;
border-radius: 0 !important;
background-color: black;
}
/* Viewer Container styling */
.viewer-container {
display: none;
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
width: 100%;
height: 100%;
background: black;
border: 1px solid #474558;
border-radius: 10px;
overflow: hidden;
box-sizing: border-box;
transition: all 0.3s ease;
/* These ensure proper rendering after fullscreen exit */
min-height: 100%;
object-fit: contain;
}
/* When parent container is fullscreen, adjust viewer container */
.fake-fullscreen .viewer-container,
:fullscreen .viewer-container,
:-webkit-full-screen .viewer-container,
:-moz-full-screen .viewer-container,
:-ms-fullscreen .viewer-container {
border-radius: 0;
border: none;
width: 100%;
height: 100%;
}
/* GIF Preview styling */
.gif-preview-container {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
border: 1px solid #474558;
border-radius: 10px;
overflow: hidden;
cursor: pointer;
background-color: black;
}
.gif-preview-container img {
width: 100%;
height: 100%;
object-fit: cover;
}
/* Canvas fills the viewer container */
.ply-canvas {
width: 100%;
height: 100%;
display: block;
background-color: transparent; /* Transparent background for PlayCanvas rendering */
z-index: 1; /* Lower z-index to keep it behind buttons */
position: absolute; /* Ensure canvas fills the entire container */
top: 0;
left: 0;
right: 0;
bottom: 0;
}
/* Make sure canvas fills the entire space in fullscreen */
.fake-fullscreen .ply-canvas,
:fullscreen .ply-canvas,
:-webkit-full-screen .ply-canvas,
:-moz-full-screen .ply-canvas,
:-ms-fullscreen .ply-canvas {
width: 100vw;
height: 100vh;
}
/* Progress dialog styling (centered) */
.progress-dialog {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
border: none;
background: rgba(0,0,0,0.7);
padding: 20px;
border-radius: 5px;
z-index: 1000;
display: none;
color: white;
}
/* Progress bar styling */
progress {
width: 250px;
height: 15px;
appearance: none;
border: none;
border-radius: 10px;
overflow: hidden;
}
progress::-webkit-progress-bar {
background-color: #333;
border-radius: 10px;
}
progress::-webkit-progress-value {
background-color: #4682B4;
border-radius: 10px;
}
progress::-moz-progress-bar {
background-color: #4682B4;
border-radius: 10px;
}
/* Menu (instructions) content styling */
.menu-content {
display: none;
position: absolute;
top: 70px;
right: 15px;
background: rgba(0, 0, 0, 0.8);
border: 1px solid #474558;
border-radius: 5px;
padding: 10px;
font-size: 15px;
line-height: 1.4;
color: white;
z-index: 1010; /* Higher than buttons to appear on top when shown */
}
/* Button styling with improved visibility */
.widget-button {
position: absolute;
width: 45px;
height: 45px;
background-color: rgba(0, 0, 0, 0.6);
border: 1px solid #474558;
border-radius: 50%;
cursor: pointer;
font-size: 14px;
color: white;
display: flex !important; /* Always display flex */
align-items: center;
justify-content: center;
transition: background-color 0.2s ease;
z-index: 1000; /* Higher z-index to ensure visibility */
opacity: 1 !important; /* Force opacity to ensure visibility */
visibility: visible !important; /* Force visibility */
}
.widget-button:hover {
background-color: rgba(70, 130, 180, 0.5);
}
/* Make sure buttons remain visible in fullscreen modes */
.fake-fullscreen .widget-button,
:fullscreen .widget-button,
:-webkit-full-screen .widget-button,
:-moz-full-screen .widget-button,
:-ms-fullscreen .widget-button {
z-index: 10000; /* Extra high z-index in fullscreen mode */
}
/* Specific button positions */
.close-btn {
top: 17px;
left: 15px;
font-family: sans-serif;
}
.fullscreen-toggle {
top: 17px;
right: 15px;
}
.help-toggle {
top: 17px;
right: 70px;
font-size: 22px;
}
.reset-camera-btn {
top: 17px;
right: 123px;
font-size: 22px;
line-height: normal;
padding: 0;
}
/* Adjust the reset icon position */
.reset-icon {
display: inline-block;
transform: translateY(-3px);
}
/* --- Mobile adjustments: when the widget container has the "mobile" class --- */
.ply-widget-container.mobile .widget-button {
width: 30px; /* 45px * 2/3 */
height: 30px; /* 45px * 2/3 */
font-size: 10px; /* 14px * approx 0.67 */
}
.ply-widget-container.mobile .help-toggle {
font-size: 15px; /* 22px * approx 0.67 */
}
/* Adjust button positions for mobile */
.ply-widget-container.mobile .close-btn {
top: 11px; /* 17px * approx 0.67 */
left: 10px; /* 15px * approx 0.67 */
}
.ply-widget-container.mobile .fullscreen-toggle {
top: 11px;
right: 10px;
}
.ply-widget-container.mobile .help-toggle {
top: 11px;
right: 47px; /* 70px * approx 0.67 */
}
.ply-widget-container.mobile .reset-camera-btn {
top: 11px;
right: 82px; /* 123px * approx 0.67 */
}
/* Additional styles for PlayCanvas compatibility */
#application-canvas {
width: 100%;
height: 100%;
display: block;
}
html, body {
margin: 0;
padding: 0;
height: 100%;
}
/* Additional fullscreen styles for mobile browsers */
@media screen and (max-width: 768px) {
.ply-widget-container.fake-fullscreen {
position: fixed !important;
width: 100% !important;
height: 100% !important;
top: 0 !important;
left: 0 !important;
right: 0 !important;
bottom: 0 !important;
z-index: 9999 !important;
padding-bottom: 0 !important; /* Make sure padding is removed on mobile too */
}
/* Ensure buttons remain visible on mobile */
.ply-widget-container.mobile.fake-fullscreen .widget-button {
display: flex !important;
visibility: visible !important;
opacity: 1 !important;
z-index: 10000 !important;
}
}
/* Error message styling */
.progress-dialog p {
margin: 0;
padding: 5px;
}
/* Make sure fluid engine elements don't interfere with pointer events */
.viewer-container .fluid-engine {
pointer-events: none !important;
}