MikaFil commited on
Commit
758df19
Β·
verified Β·
1 Parent(s): 4181ccb

Update fullscreen_playcanvas.js

Browse files
Files changed (1) hide show
  1. fullscreen_playcanvas.js +26 -43
fullscreen_playcanvas.js CHANGED
@@ -134,57 +134,40 @@
134
 
135
  // ─── 7. Γ‰tat fullscreen ──────────────────────────────────────────────────────
136
  let isFullscreen = false;
137
- let savedNextSibling = null;
138
- let savedParent = null;
139
  let savedPadding = aspectPadding;
140
 
141
  // ─── 8. Appliquer les styles plein Γ©cran ─────────────────────────────────────
142
  function applyFullscreenStyles() {
143
- // MΓ©moriser la position dans le DOM avant de dΓ©placer
144
- savedParent = wrapper.parentNode;
145
- savedNextSibling = wrapper.nextSibling;
146
-
147
- // DΓ©placer le wrapper directement dans <body> pour Γ©chapper
148
- // Γ  tout stacking context parent (header, transforms, etc.)
149
- document.body.appendChild(wrapper);
150
-
151
- wrapper.style.position = 'fixed';
152
- wrapper.style.top = '0';
153
- wrapper.style.left = '0';
154
- wrapper.style.width = '100vw';
155
- wrapper.style.height = '100vh';
156
- wrapper.style.maxWidth = '100vw';
157
- wrapper.style.maxHeight = '100vh';
158
- wrapper.style.paddingBottom = '0';
159
- wrapper.style.margin = '0';
160
- wrapper.style.zIndex = '99999';
161
- wrapper.classList.add('fake-fullscreen');
162
- fsBtn.textContent = '⇲';
163
- isFullscreen = true;
164
  }
165
 
166
  // ─── 9. Restaurer les styles normaux ─────────────────────────────────────────
167
  function restoreStyles() {
168
- wrapper.style.position = '';
169
- wrapper.style.top = '';
170
- wrapper.style.left = '';
171
- wrapper.style.width = '100%';
172
- wrapper.style.height = '0';
173
- wrapper.style.maxWidth = '';
174
- wrapper.style.maxHeight = '';
175
- wrapper.style.paddingBottom = savedPadding;
176
- wrapper.style.margin = '';
177
- wrapper.style.zIndex = '';
178
- wrapper.classList.remove('fake-fullscreen');
179
- fsBtn.textContent = '⇱';
180
- isFullscreen = false;
181
-
182
- // Remettre le wrapper Γ  sa position d'origine dans le DOM
183
- if (savedParent) {
184
- savedParent.insertBefore(wrapper, savedNextSibling);
185
- savedParent = null;
186
- savedNextSibling = null;
187
- }
188
  }
189
 
190
  // ─── 10. EntrΓ©e en plein Γ©cran ───────────────────────────────────────────────
 
134
 
135
  // ─── 7. Γ‰tat fullscreen ──────────────────────────────────────────────────────
136
  let isFullscreen = false;
 
 
137
  let savedPadding = aspectPadding;
138
 
139
  // ─── 8. Appliquer les styles plein Γ©cran ─────────────────────────────────────
140
  function applyFullscreenStyles() {
141
+ wrapper.style.position = 'fixed';
142
+ wrapper.style.top = '0';
143
+ wrapper.style.left = '0';
144
+ wrapper.style.width = '100vw';
145
+ wrapper.style.height = '100vh';
146
+ wrapper.style.maxWidth = '100vw';
147
+ wrapper.style.maxHeight = '100vh';
148
+ wrapper.style.paddingBottom = '0';
149
+ wrapper.style.margin = '0';
150
+ wrapper.style.zIndex = '99999';
151
+ wrapper.classList.add('fake-fullscreen');
152
+ fsBtn.textContent = '⇲';
153
+ isFullscreen = true;
 
 
 
 
 
 
 
 
154
  }
155
 
156
  // ─── 9. Restaurer les styles normaux ─────────────────────────────────────────
157
  function restoreStyles() {
158
+ wrapper.style.position = '';
159
+ wrapper.style.top = '';
160
+ wrapper.style.left = '';
161
+ wrapper.style.width = '100%';
162
+ wrapper.style.height = '0';
163
+ wrapper.style.maxWidth = '';
164
+ wrapper.style.maxHeight = '';
165
+ wrapper.style.paddingBottom = savedPadding;
166
+ wrapper.style.margin = '';
167
+ wrapper.style.zIndex = '';
168
+ wrapper.classList.remove('fake-fullscreen');
169
+ fsBtn.textContent = '⇱';
170
+ isFullscreen = false;
 
 
 
 
 
 
 
171
  }
172
 
173
  // ─── 10. EntrΓ©e en plein Γ©cran ───────────────────────────────────────────────