MikaFil commited on
Commit
54a50fa
·
verified ·
1 Parent(s): c46ee0c

Update style/defaults/style.css

Browse files
Files changed (1) hide show
  1. style/defaults/style.css +65 -11
style/defaults/style.css CHANGED
@@ -15,7 +15,61 @@
15
  top: 0 !important;
16
  left: 0 !important;
17
  width: 100vw !important;
18
- height: 100vh !important;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
19
  padding-bottom: 0 !important;
20
  z-index: 9999 !important;
21
  background-color: black;
@@ -339,15 +393,15 @@ html, body { margin: 0; padding: 0; height: 100%; }
339
  .progress-dialog p { margin: 0; padding: 5px; }
340
 
341
  @media (max-width: 600px) {
342
- .menu-content {
343
- width: 85vw;
344
- max-height: 55vh;
345
- overflow-y: auto;
346
- padding: 40px 18px 14px;
347
- font-size: 14px;
348
- }
349
- .menu-content .help-close {
350
- top: 6px;
351
- right: 6px;
352
  }
353
  }
 
 
15
  top: 0 !important;
16
  left: 0 !important;
17
  width: 100vw !important;
18
+ height: 100vh !importaconst menuContent = document.getElementById('menu-content-' + instanceId);
19
+ // ... other DOM elements ...
20
+
21
+ const isIOS = /iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream;
22
+ const isMobile = isIOS || /Android/i.test(navigator.userAgent);
23
+
24
+ // ... help text and viewer initialization ...
25
+
26
+ // --- Responsive menu sizing for mobile: robust fallback JS ---
27
+ function setMenuContentMaxSize() {
28
+ if (!isMobile) {
29
+ menuContent.style.maxWidth = "";
30
+ menuContent.style.maxHeight = "";
31
+ menuContent.style.overflowY = "";
32
+ menuContent.style.overflowX = "";
33
+ return;
34
+ }
35
+ let parent = viewerContainerElem;
36
+ if (parent) {
37
+ // Get the parent's size (the viewer's actual rendered box)
38
+ const vw = parent.offsetWidth;
39
+ const vh = parent.offsetHeight;
40
+ if (vw && vh) {
41
+ // 80% of parent
42
+ menuContent.style.maxWidth = Math.round(vw * 0.8) + "px";
43
+ menuContent.style.maxHeight = Math.round(vh * 0.8) + "px";
44
+ menuContent.style.overflowY = "auto";
45
+ menuContent.style.overflowX = "auto";
46
+ } else {
47
+ // fallback to 80vw/80vh if dimensions are not found
48
+ menuContent.style.maxWidth = "80vw";
49
+ menuContent.style.maxHeight = "80vh";
50
+ }
51
+ }
52
+ }
53
+ // Initial call
54
+ setMenuContentMaxSize();
55
+ // Update on resize or fullscreen toggle
56
+ window.addEventListener('resize', setMenuContentMaxSize);
57
+ document.addEventListener('fullscreenchange', setMenuContentMaxSize);
58
+ // Optional: update if your viewer supports orientationchange on mobile
59
+ window.addEventListener('orientationchange', setMenuContentMaxSize);
60
+
61
+ // ... rest of your event listeners and logic (help panel, fullscreen, etc) ...
62
+
63
+ // Example: show/hide menu-content logic stays unchanged
64
+ menuContent.style.display = (isMobile ? 'none' : 'block'); // Don't show by default on mobile
65
+
66
+ helpToggle.addEventListener('click', (e) => {
67
+ hideTooltipPanel();
68
+ e.stopPropagation();
69
+ // Only show/hide, the sizing is handled above
70
+ menuContent.style.display = menuContent.style.display === 'block' ? 'none' : 'block';
71
+ });
72
+ helpCloseBtn.addEventListener('click', () => { menuContent.style.display = 'none'; });nt;
73
  padding-bottom: 0 !important;
74
  z-index: 9999 !important;
75
  background-color: black;
 
393
  .progress-dialog p { margin: 0; padding: 5px; }
394
 
395
  @media (max-width: 600px) {
396
+ .ply-widget-container .menu-content {
397
+ max-width: 80vw !important;
398
+ max-height: 80vh !important;
399
+ overflow-y: auto !important;
400
+ overflow-x: auto !important;
401
+ left: 50% !important;
402
+ top: 50% !important;
403
+ transform: translate(-50%, -50%) !important;
404
+ box-sizing: border-box !important;
 
405
  }
406
  }
407
+