Spaces:
Running
Running
Update fullscreen_playcanvas.js
Browse files- fullscreen_playcanvas.js +5 -2
fullscreen_playcanvas.js
CHANGED
|
@@ -36,7 +36,10 @@
|
|
| 36 |
return null;
|
| 37 |
}
|
| 38 |
|
| 39 |
-
const
|
|
|
|
|
|
|
|
|
|
| 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;
|