ext-apps/examples/threejs-server/src/global.css
Mel Ludowise 83d82a1caa
fix(examples): improve mobile support for map, pdf, and threejs examples (#555)
* Fix touch gesture conflicts in WebGL example apps on mobile

* Format with prettier

* fix(examples): improve mobile support for map, pdf, and threejs examples

- map-server: fullscreen button respects safe area insets, hover/opacity
  pattern with always-visible on touch devices
- pdf-server: fit-to-width scale for narrow viewports, responsive toolbar
  with compact controls on mobile, safe area in fullscreen toolbar via
  CSS custom properties
- threejs-server: fullscreen button respects safe area and always visible
  on touch, ResizeObserver for responsive width, host containerDimensions
  for fullscreen height, no container padding in fullscreen, replace
  useHostStyles with inline style application to avoid overwriting
  onhostcontextchanged handler
2026-03-18 13:47:47 +00:00

116 lines
2.2 KiB
CSS

:root {
color-scheme: light dark;
}
* {
box-sizing: border-box;
}
html,
body {
font-family: var(--font-sans, system-ui, -apple-system, sans-serif);
font-size: 1rem;
margin: 0;
padding: 0;
background: transparent;
}
.loading {
display: flex;
align-items: center;
justify-content: center;
height: 400px;
color: var(--color-text-secondary, #888);
font-size: 14px;
}
.error {
padding: 20px;
color: var(--color-text-danger, #ff6b6b);
}
.threejs-container {
width: 100%;
position: relative;
}
.error-overlay {
position: absolute;
inset: 0;
display: flex;
align-items: center;
justify-content: center;
color: var(--color-text-danger, #ff6b6b);
background: var(--color-background-secondary, rgba(26, 26, 46, 0.9));
border-radius: var(--border-radius-md, 8px);
font-family: var(--font-sans, system-ui);
padding: 20px;
}
/* Fullscreen button */
.fullscreen-btn {
position: absolute;
top: 10px;
right: 10px;
width: 40px;
height: 40px;
border: none;
border-radius: 8px;
background: rgba(0, 0, 0, 0.6);
color: white;
cursor: pointer;
display: none; /* Hidden by default, shown when fullscreen available */
align-items: center;
justify-content: center;
transition:
background 0.2s,
opacity 0.2s;
opacity: 0; /* Initially invisible, shown on hover */
z-index: 100;
}
.fullscreen-btn:hover {
background: rgba(0, 0, 0, 0.8);
opacity: 1;
}
.fullscreen-btn svg {
width: 20px;
height: 20px;
}
.fullscreen-btn .collapse-icon {
display: none;
}
.fullscreen-btn.available {
display: flex;
}
/* Show button on container hover */
.threejs-container:hover .fullscreen-btn.available {
opacity: 0.7;
}
/* Always show button on touch devices */
.threejs-container.touch-device .fullscreen-btn.available {
opacity: 0.7;
}
/* In fullscreen, canvas goes edge-to-edge; only the button respects safe area */
.threejs-container.fullscreen {
padding: 0 !important;
}
/* Fullscreen mode: swap icons and remove border radius */
.threejs-container.fullscreen .fullscreen-btn .expand-icon {
display: none;
}
.threejs-container.fullscreen .fullscreen-btn .collapse-icon {
display: block;
}
.threejs-container.fullscreen canvas {
border-radius: 0 !important;
}