Browse Source

Update scripts

customisations
alemart 10 months ago
parent
commit
fbd1bd7a27
2 changed files with 9 additions and 7 deletions
  1. 7
    5
      dist/encantar.js
  2. 2
    2
      dist/encantar.min.js

+ 7
- 5
dist/encantar.js View File

5
  * https://github.com/alemart/encantar-js
5
  * https://github.com/alemart/encantar-js
6
  *
6
  *
7
  * @license LGPL-3.0-or-later
7
  * @license LGPL-3.0-or-later
8
- * Date: 2024-10-20T01:13:15.146Z
8
+ * Date: 2024-10-20T05:43:39.143Z
9
  */
9
  */
10
 (function webpackUniversalModuleDefinition(root, factory) {
10
 (function webpackUniversalModuleDefinition(root, factory) {
11
 	if(typeof exports === 'object' && typeof module === 'object')
11
 	if(typeof exports === 'object' && typeof module === 'object')
25836
      * Trigger a resize event after a delay
25836
      * Trigger a resize event after a delay
25837
      * @param delay in milliseconds
25837
      * @param delay in milliseconds
25838
      */
25838
      */
25839
-    triggerResize(delay = 50) {
25839
+    triggerResize(delay = 100) {
25840
         const event = new ViewportEvent('resize');
25840
         const event = new ViewportEvent('resize');
25841
         if (delay <= 0) {
25841
         if (delay <= 0) {
25842
             this._viewport.dispatchEvent(event);
25842
             this._viewport.dispatchEvent(event);
25968
         const subContainer = viewport._subContainer;
25968
         const subContainer = viewport._subContainer;
25969
         const windowAspectRatio = window.innerWidth / window.innerHeight;
25969
         const windowAspectRatio = window.innerWidth / window.innerHeight;
25970
         const viewportAspectRatio = viewport._realSize.width / viewport._realSize.height;
25970
         const viewportAspectRatio = viewport._realSize.width / viewport._realSize.height;
25971
-        let width = 1, height = 1;
25971
+        let width = 1, height = 1, left = '0px', top = '0px';
25972
         if (viewportAspectRatio <= windowAspectRatio) {
25972
         if (viewportAspectRatio <= windowAspectRatio) {
25973
             height = window.innerHeight;
25973
             height = window.innerHeight;
25974
             width = Math.round(height * viewportAspectRatio);
25974
             width = Math.round(height * viewportAspectRatio);
25975
             width -= width % 2;
25975
             width -= width % 2;
25976
+            left = `calc(50% - ${width >>> 1}px)`;
25976
         }
25977
         }
25977
         else {
25978
         else {
25978
             width = window.innerWidth;
25979
             width = window.innerWidth;
25979
             height = Math.round(width / viewportAspectRatio);
25980
             height = Math.round(width / viewportAspectRatio);
25980
             height -= height % 2;
25981
             height -= height % 2;
25982
+            top = `calc(50% - ${height >>> 1}px)`;
25981
         }
25983
         }
25982
         subContainer.style.position = 'absolute';
25984
         subContainer.style.position = 'absolute';
25983
-        subContainer.style.left = `calc(50% - ${width >>> 1}px)`;
25984
-        subContainer.style.top = `calc(50% - ${height >>> 1}px)`;
25985
+        subContainer.style.left = left;
25986
+        subContainer.style.top = top;
25985
         subContainer.style.width = width + 'px';
25987
         subContainer.style.width = width + 'px';
25986
         subContainer.style.height = height + 'px';
25988
         subContainer.style.height = height + 'px';
25987
         super.resize(viewport);
25989
         super.resize(viewport);

+ 2
- 2
dist/encantar.min.js
File diff suppressed because it is too large
View File


Loading…
Cancel
Save