@canvas3/nuxt 0.1.21 → 0.1.22

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "canvas-nuxt-layout",
3
3
  "configKey": "canvas3Layout",
4
- "version": "0.1.21",
4
+ "version": "0.1.22",
5
5
  "builder": {
6
6
  "@nuxt/module-builder": "1.0.2",
7
7
  "unbuild": "3.6.0"
@@ -9,6 +9,7 @@ declare class Canvas3Class {
9
9
  canvasInitiated: import("vue").Ref<boolean, boolean>;
10
10
  mouseMoveInProgress: boolean;
11
11
  animationsRender: boolean;
12
+ documentVisibility: boolean;
12
13
  resizeInProgress: boolean;
13
14
  meshPositionsUpdate: boolean;
14
15
  canvasContainer: HTMLElement | null;
@@ -16,6 +16,7 @@ class Canvas3Class {
16
16
  canvasInitiated = canvasInitiated;
17
17
  mouseMoveInProgress = false;
18
18
  animationsRender = false;
19
+ documentVisibility = true;
19
20
  resizeInProgress = false;
20
21
  meshPositionsUpdate = false;
21
22
  canvasContainer = null;
@@ -77,6 +78,14 @@ class Canvas3Class {
77
78
  this.mouseMoveInProgress = false;
78
79
  }, 0);
79
80
  });
81
+ document.addEventListener("visibilitychange", () => {
82
+ if (document.hidden) {
83
+ this.documentVisibility = false;
84
+ } else {
85
+ this.documentVisibility = true;
86
+ this.render();
87
+ }
88
+ });
80
89
  this.canvasInitiated.value = true;
81
90
  studio783log();
82
91
  }
@@ -426,6 +435,7 @@ class Canvas3Class {
426
435
  this.renderer.render(this.scene, this.camera);
427
436
  }
428
437
  try {
438
+ if (!this.documentVisibility) return;
429
439
  requestAnimationFrame(this.render.bind(this));
430
440
  } catch (e) {
431
441
  console.error(e);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@canvas3/nuxt",
3
- "version": "0.1.21",
3
+ "version": "0.1.22",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },