@canvas3/nuxt 0.1.25 → 0.1.27
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/dist/module.json +1 -1
- package/dist/runtime/utils/canvas3/scroll.js +14 -10
- package/package.json +2 -2
package/dist/module.json
CHANGED
|
@@ -66,11 +66,9 @@ export default class Scroll {
|
|
|
66
66
|
document.body.style.height = this.DOM.scrollable.scrollHeight > window.innerHeight ? `${this.DOM.scrollable.scrollHeight}px` : `${window.innerHeight}px`;
|
|
67
67
|
}
|
|
68
68
|
setElementActive(item, isActive) {
|
|
69
|
-
if (!item.containedMeshIds) return;
|
|
70
|
-
item.isInView = isActive;
|
|
71
69
|
const isActiveString = isActive ? "true" : "false";
|
|
72
70
|
item.elNode.dataset.activeScroll = isActiveString;
|
|
73
|
-
setScrollActiveElements(item.elNode, item.containedMeshIds, isActiveString);
|
|
71
|
+
setScrollActiveElements(item.elNode, item.containedMeshIds ?? [], isActiveString);
|
|
74
72
|
if (isActive) {
|
|
75
73
|
item.elNode.classList.add("active");
|
|
76
74
|
if (item.options.activateCallback) {
|
|
@@ -82,7 +80,7 @@ export default class Scroll {
|
|
|
82
80
|
item.options.deactivateCallback(item);
|
|
83
81
|
}
|
|
84
82
|
}
|
|
85
|
-
if (item.containedMeshIds.length > 0 && !item.trackOnly) {
|
|
83
|
+
if (item.containedMeshIds && item.containedMeshIds.length > 0 && !item.trackOnly) {
|
|
86
84
|
for (const meshId of item.containedMeshIds) {
|
|
87
85
|
this.activateMeshCallback(meshId, isActive);
|
|
88
86
|
}
|
|
@@ -96,14 +94,20 @@ export default class Scroll {
|
|
|
96
94
|
const itemRangeMargin = item.options.activeRangeMargin ?? 0;
|
|
97
95
|
const activeRange = item.options.activeRange ?? 1;
|
|
98
96
|
const activeRangeInPx = activeRange * windowInnerHeight;
|
|
99
|
-
const
|
|
100
|
-
if (
|
|
101
|
-
if (item.options.onScrollCallback && this.scrollInProgress)
|
|
97
|
+
const itemIsInView = elementNearViewport(bounds, activeRangeInPx);
|
|
98
|
+
if (itemIsInView) {
|
|
99
|
+
if (item.options.onScrollCallback && this.scrollInProgress) {
|
|
102
100
|
item.options.onScrollCallback(item, this.speed, this.current);
|
|
103
|
-
|
|
101
|
+
}
|
|
102
|
+
if (!item.isInView && !item.options.activateOnce) {
|
|
103
|
+
item.isInView = true;
|
|
104
104
|
this.setElementActive(item, true);
|
|
105
|
-
|
|
106
|
-
|
|
105
|
+
}
|
|
106
|
+
} else {
|
|
107
|
+
if (item.isInView) {
|
|
108
|
+
item.isInView = false;
|
|
109
|
+
this.setElementActive(item, false);
|
|
110
|
+
}
|
|
107
111
|
}
|
|
108
112
|
if (typeof item.options.scrollSpeed?.value === "number") {
|
|
109
113
|
item.elNode.style.transition = `linear translate3d 0s`;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@canvas3/nuxt",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.27",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -41,7 +41,6 @@
|
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
43
|
"@nuxt/kit": "^4.0.0",
|
|
44
|
-
"vite-plugin-glsl": "^1.5.1",
|
|
45
44
|
"vue": "^3.5.18"
|
|
46
45
|
},
|
|
47
46
|
"peerDependencies": {
|
|
@@ -56,6 +55,7 @@
|
|
|
56
55
|
"@nuxt/test-utils": "^3.19.2",
|
|
57
56
|
"@types/node": "latest",
|
|
58
57
|
"@types/three": "^0.178.1",
|
|
58
|
+
"vite-plugin-glsl": "^1.5.1",
|
|
59
59
|
"eslint": "^9.30.1",
|
|
60
60
|
"nuxt": "^4.4.6",
|
|
61
61
|
"typescript": "~5.8.3",
|