liquid-gl 2.2.2 → 2.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/liquidGL-helper.js +1 -1
- package/liquidGL.js +19 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
<a href="https://liquidgl.naughtyduk.com"><img src="https://raw.githubusercontent.com/naughtyduk/liquidGL/main/assets/liquidGL-npm-preview.gif" alt="liquidGL" width="100%" height="auto"/></a>
|
|
4
4
|
|
|
5
|
-
### v2.2.
|
|
5
|
+
### v2.2.3
|
|
6
6
|
|
|
7
7
|
> [!NOTE]
|
|
8
8
|
> `liquidGL` is free to use for both non-commercial and commercial purposes.
|
package/liquidGL-helper.js
CHANGED
package/liquidGL.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*
|
|
5
5
|
* Author: NaughtyDuk© – https://liquidgl.naughtyduk.com
|
|
6
6
|
* Licence: MIT
|
|
7
|
-
* Version: v2.2.
|
|
7
|
+
* Version: v2.2.3
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
const liquidGL = (() => {
|
|
@@ -2958,6 +2958,7 @@ fn fs() -> @location(0) vec4<f32> {
|
|
|
2958
2958
|
if (!this.snapshotTarget) this.snapshotTarget = document.body;
|
|
2959
2959
|
|
|
2960
2960
|
this._isScrolling = false;
|
|
2961
|
+
this._pendingViewportResize = false;
|
|
2961
2962
|
let lastScrollY = window.scrollY;
|
|
2962
2963
|
let scrollTimeout;
|
|
2963
2964
|
const scrollCheck = () => {
|
|
@@ -2967,6 +2968,10 @@ fn fs() -> @location(0) vec4<f32> {
|
|
|
2967
2968
|
clearTimeout(scrollTimeout);
|
|
2968
2969
|
scrollTimeout = setTimeout(() => {
|
|
2969
2970
|
this._isScrolling = false;
|
|
2971
|
+
if (this._pendingViewportResize) {
|
|
2972
|
+
this._pendingViewportResize = false;
|
|
2973
|
+
onResize();
|
|
2974
|
+
}
|
|
2970
2975
|
}, 200);
|
|
2971
2976
|
}
|
|
2972
2977
|
requestAnimationFrame(scrollCheck);
|
|
@@ -2974,7 +2979,12 @@ fn fs() -> @location(0) vec4<f32> {
|
|
|
2974
2979
|
requestAnimationFrame(scrollCheck);
|
|
2975
2980
|
|
|
2976
2981
|
const onResize = debounce(() => {
|
|
2977
|
-
if (this._capturing
|
|
2982
|
+
if (this._capturing) return;
|
|
2983
|
+
if (this._isScrolling) {
|
|
2984
|
+
this._pendingViewportResize = true;
|
|
2985
|
+
return;
|
|
2986
|
+
}
|
|
2987
|
+
this._pendingViewportResize = false;
|
|
2978
2988
|
|
|
2979
2989
|
if (window.visualViewport && window.visualViewport.scale !== 1) {
|
|
2980
2990
|
return;
|
|
@@ -3333,6 +3343,13 @@ fn fs() -> @location(0) vec4<f32> {
|
|
|
3333
3343
|
const backend = this.backend;
|
|
3334
3344
|
if (!backend || !this.hasTexture) return;
|
|
3335
3345
|
|
|
3346
|
+
const dprNow = Math.min(2, window.devicePixelRatio || 1);
|
|
3347
|
+
const bufW = Math.trunc(innerWidth * dprNow);
|
|
3348
|
+
const bufH = Math.trunc(innerHeight * dprNow);
|
|
3349
|
+
if (this.canvas.width !== bufW || this.canvas.height !== bufH) {
|
|
3350
|
+
this._resizeCanvas();
|
|
3351
|
+
}
|
|
3352
|
+
|
|
3336
3353
|
this.lenses.forEach((ln) => {
|
|
3337
3354
|
if (ln._isSticky && !ln._mirrorActive) ln.updateMetrics();
|
|
3338
3355
|
});
|