@urso/core 0.4.10 → 0.4.11

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": "@urso/core",
3
- "version": "0.4.10",
3
+ "version": "0.4.11",
4
4
  "description": "HTML5 game engine",
5
5
  "main": "build/js/index.js",
6
6
  "author": "Megbrimef",
@@ -7,8 +7,10 @@ class ComponentsFullscreenController extends ComponentsBaseController {
7
7
 
8
8
  this._fullscreenActivator = null;
9
9
  this._resolutionsConfig = null;
10
+ this.lastResizeFullscreenResult;
10
11
 
11
12
  this.createActivator();
13
+ this._resizeHandler();
12
14
  }
13
15
 
14
16
  createActivator() {
@@ -53,7 +55,14 @@ class ComponentsFullscreenController extends ComponentsBaseController {
53
55
  }
54
56
 
55
57
  _resizeHandler() {
56
- Urso.localData.set('fullscreen.isFullscreen', this.isFullscreen);
58
+ const isFullscreen = this.isFullscreen;
59
+
60
+ if (this.lastResizeFullscreenResult === isFullscreen)
61
+ return;
62
+
63
+ this.lastResizeFullscreenResult = isFullscreen;
64
+ Urso.localData.set('fullscreen.isFullscreen', isFullscreen);
65
+ this.emit(Urso.events.COMPONENTS_FULLSCREEN_CHANGE, isFullscreen);
57
66
  }
58
67
 
59
68
  _subscribeOnce() {
@@ -40,6 +40,10 @@ class ComponentsFullscreenIos {
40
40
  });
41
41
  }
42
42
 
43
+ get isFullscreen() {
44
+ return this._isFullscreen;
45
+ }
46
+
43
47
  get _isFullscreen() {
44
48
  const minFactor = 0.51;
45
49
  const deviceFactor = screen.width / screen.height;
@@ -49,7 +53,7 @@ class ComponentsFullscreenIos {
49
53
 
50
54
  return !(
51
55
  this._isPortrait ?
52
- factor - deviceFactor < 0.1:
56
+ factor - deviceFactor < 0.1 :
53
57
  factor > minFactor
54
58
  );
55
59
  }
@@ -87,8 +91,8 @@ class ComponentsFullscreenIos {
87
91
  this._div.style.zIndex = needShowDiv ? 1 : -1;
88
92
  clearTimeout(this._scrollTimeout)
89
93
  this._scrollTimeout = setTimeout(() => {
90
- if(needShowDiv)
91
- window.scrollTo(0,0);
94
+ if (needShowDiv)
95
+ window.scrollTo(0, 0);
92
96
  }, 200);
93
97
  }
94
98
 
@@ -3,6 +3,7 @@ class ModulesObserverConfig {
3
3
  this.singleton = true;
4
4
 
5
5
  this.list = {
6
+ COMPONENTS_FULLSCREEN_CHANGE: 'components.fullscreen.change',
6
7
  MODULES_ASSETS_GROUP_LOADED: 'modules.assets.group.loaded',
7
8
  MODULES_ASSETS_LOAD_PROGRESS: 'modules.assets.load.progress',
8
9
  MODULES_ASSETS_LAZYLOAD_FINISHED: 'modules.assets.lazyLoad.finished',