ohzi-core 6.3.0 → 6.3.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ohzi-core",
3
- "version": "6.3.0",
3
+ "version": "6.3.1",
4
4
  "description": "OHZI Core Library",
5
5
  "source": "src/index.js",
6
6
  "module": "build/index.module.js",
@@ -6,6 +6,7 @@ export default class ViewComponent
6
6
  {
7
7
  this.name = name;
8
8
  this.container = container;
9
+ this.hidden = true;
9
10
 
10
11
  ViewComponentManager.register_component(this);
11
12
  }
@@ -18,6 +19,8 @@ export default class ViewComponent
18
19
  {
19
20
  this.container.classList.remove('hidden');
20
21
  ViewComponentManager.enable_component(this);
22
+
23
+ this.hidden = false;
21
24
  }
22
25
 
23
26
  update()
@@ -28,10 +31,31 @@ export default class ViewComponent
28
31
  {
29
32
  this.container.classList.add('hidden');
30
33
  ViewComponentManager.disable_component(this);
34
+
35
+ this.hidden = true;
36
+ }
37
+
38
+ set_opacity(current_state_data)
39
+ {
40
+ this.container.style.opacity = current_state_data[`${this.name}_opacity`];
41
+ this.toggle_hidden();
31
42
  }
32
43
 
33
- set_opacity(opacity)
44
+ toggle_hidden()
34
45
  {
35
- this.container.style.opacity = opacity;
46
+ if (this.container.style.opacity > 0.001)
47
+ {
48
+ if (this.hidden)
49
+ {
50
+ this.on_enter();
51
+ }
52
+ }
53
+ else
54
+ {
55
+ if (!this.hidden)
56
+ {
57
+ this.on_exit();
58
+ }
59
+ }
36
60
  }
37
61
  }
@@ -10,6 +10,8 @@ class ViewComponentManager
10
10
 
11
11
  update()
12
12
  {
13
+ this.__set_components_opacities();
14
+
13
15
  for (const component of this.enabled_components)
14
16
  {
15
17
  component.update(ViewManager.transition_handler.current_state_data);
@@ -53,6 +55,14 @@ class ViewComponentManager
53
55
  console.error('[ViewComponentManager.get] no component found for: ', component_name);
54
56
  return undefined;
55
57
  }
58
+
59
+ __set_components_opacities()
60
+ {
61
+ for (let i = 0; i < this.components.length; i++)
62
+ {
63
+ this.components[i].set_opacity(ViewManager.transition_handler.current_state_data);
64
+ }
65
+ }
56
66
  }
57
67
 
58
68
  export default new ViewComponentManager();