MikaFil commited on
Commit
8c45d16
Β·
verified Β·
1 Parent(s): 0aa7811

Update fullscreen_playcanvas.js

Browse files
Files changed (1) hide show
  1. fullscreen_playcanvas.js +5 -2
fullscreen_playcanvas.js CHANGED
@@ -36,7 +36,10 @@
36
  return null;
37
  }
38
 
39
- const aspectPadding = computeAspectPadding(scriptTag.getAttribute('data-aspect')) || '56.25%';
 
 
 
40
 
41
  // ─── 5. Injection du CSS ─────────────────────────────────────────────────────
42
  const style = document.createElement('style');
@@ -44,7 +47,7 @@
44
  .pc-embed-wrapper-${id} {
45
  position: relative;
46
  width: 100%;
47
- height: 0;
48
  padding-bottom: ${aspectPadding};
49
  overflow: hidden;
50
  background: #000;
 
36
  return null;
37
  }
38
 
39
+ const aspectAttr = scriptTag.getAttribute('data-aspect');
40
+ // On considère "auto" si l'attribut est 'auto' OU s'il est absent
41
+ const isAuto = aspectAttr === 'auto' || !aspectAttr;
42
+ const aspectPadding = isAuto ? '0' : (computeAspectPadding(aspectAttr) || '56.25%');
43
 
44
  // ─── 5. Injection du CSS ─────────────────────────────────────────────────────
45
  const style = document.createElement('style');
 
47
  .pc-embed-wrapper-${id} {
48
  position: relative;
49
  width: 100%;
50
+ height: ${isAuto ? '100%' : '0'};
51
  padding-bottom: ${aspectPadding};
52
  overflow: hidden;
53
  background: #000;