@urso/core 0.7.77 → 0.7.78-dev
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
|
@@ -14,6 +14,7 @@ class ExtraBrowserEvents {
|
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
init() {
|
|
17
|
+
window.addEventListener('keydown', this._keyPressHandler);
|
|
17
18
|
document.addEventListener("visibilitychange", this.visibilitychangeHandler);
|
|
18
19
|
|
|
19
20
|
window.addEventListener('resize', this.resizeHandler);
|
|
@@ -46,6 +47,10 @@ class ExtraBrowserEvents {
|
|
|
46
47
|
_pointerEventsHandler(event) {
|
|
47
48
|
this.emit(Urso.events.EXTRA_BROWSEREVENTS_POINTER_EVENT, event);
|
|
48
49
|
}
|
|
50
|
+
|
|
51
|
+
_keyPressHandler(event) {
|
|
52
|
+
this.emit(Urso.events.EXTRA_BROWSEREVENTS_KEYPRESS_EVENT, event);
|
|
53
|
+
}
|
|
49
54
|
}
|
|
50
55
|
|
|
51
56
|
module.exports = ExtraBrowserEvents;
|
|
@@ -3,6 +3,7 @@ class ModulesAssetsConfig {
|
|
|
3
3
|
this.singleton = true;
|
|
4
4
|
|
|
5
5
|
this.defaultQualityFactor = 1;
|
|
6
|
+
this.addFolderPathInAtlasTextureKey = true; //or false for simple textures names
|
|
6
7
|
|
|
7
8
|
/**
|
|
8
9
|
* quality settings for resource loading selection
|
|
@@ -10,7 +11,7 @@ class ModulesAssetsConfig {
|
|
|
10
11
|
this.qualityFactors = {
|
|
11
12
|
medium: 0.5,
|
|
12
13
|
hd: 0.75,
|
|
13
|
-
high: 1
|
|
14
|
+
high: 1
|
|
14
15
|
};
|
|
15
16
|
|
|
16
17
|
|
|
@@ -53,6 +53,13 @@ class ModulesAssetsController {
|
|
|
53
53
|
checkWebPSupport() {
|
|
54
54
|
this.getInstance('Service').checkWebPSupport();
|
|
55
55
|
}
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* preload all images in global atlas into GPU
|
|
59
|
+
*/
|
|
60
|
+
preloadAllImagesInGPU() {
|
|
61
|
+
this.getInstance('Service').preloadAllImagesInGPU();
|
|
62
|
+
}
|
|
56
63
|
}
|
|
57
64
|
|
|
58
65
|
module.exports = ModulesAssetsController;
|
|
@@ -85,6 +85,25 @@ class ModulesAssetsService {
|
|
|
85
85
|
this._loadGroupAtlases(assetsSpace, group, () => { this._loadGroupRestAssets(assetsSpace, group, callback, updateCallback) });
|
|
86
86
|
}
|
|
87
87
|
|
|
88
|
+
preloadAllImagesInGPU() {
|
|
89
|
+
const world = Urso.findOne('^WORLD')._baseObject;
|
|
90
|
+
|
|
91
|
+
Urso.cache.globalAtlas.pages.forEach(({ baseTexture }) => {
|
|
92
|
+
const texture = new PIXI.Texture(baseTexture);
|
|
93
|
+
const sprite = new PIXI.Sprite(texture);
|
|
94
|
+
|
|
95
|
+
sprite.x = -10000;
|
|
96
|
+
sprite.y = -10000;
|
|
97
|
+
|
|
98
|
+
world.addChild(sprite);
|
|
99
|
+
|
|
100
|
+
setTimeout(() => {
|
|
101
|
+
world.removeChild(sprite);
|
|
102
|
+
sprite.destroy()
|
|
103
|
+
}, 1);
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
|
|
88
107
|
/**
|
|
89
108
|
* create new assets space for loading
|
|
90
109
|
* @returns {Object}
|
|
@@ -173,6 +192,7 @@ class ModulesAssetsService {
|
|
|
173
192
|
*/
|
|
174
193
|
_processLoadedAtlases(assetsSpace, group) {
|
|
175
194
|
const atlases = assetsSpace[group].filter(assetModel => assetModel.type === Urso.types.assets.ATLAS);
|
|
195
|
+
const { addFolderPathInAtlasTextureKey } = this.getInstance('Config');
|
|
176
196
|
|
|
177
197
|
for (let assetModel of atlases) {
|
|
178
198
|
const assetKey = assetModel.key;
|
|
@@ -183,7 +203,7 @@ class ModulesAssetsService {
|
|
|
183
203
|
let texture = imageData.textures[name];
|
|
184
204
|
let newFilename = name;
|
|
185
205
|
|
|
186
|
-
if (!name.includes('/'))
|
|
206
|
+
if (addFolderPathInAtlasTextureKey && !name.includes('/'))
|
|
187
207
|
newFilename = folderPath + '/' + name;
|
|
188
208
|
|
|
189
209
|
Urso.cache.addFile(newFilename, texture);
|
|
@@ -8,6 +8,7 @@ class ModulesObserverConfig {
|
|
|
8
8
|
COMPONENTS_FULLSCREEN_CHANGE: 'components.fullscreen.change',
|
|
9
9
|
COMPONENTS_FULLSCREEN_SWITCH: 'components.fullscreen.switch',
|
|
10
10
|
COMPONENTS_LAYERS_SWITCHER_SWITCH: 'components.layersSwitcher.switch',
|
|
11
|
+
EXTRA_BROWSEREVENTS_KEYPRESS_EVENT: 'extra.browserEvents.window.keypress.event',
|
|
11
12
|
EXTRA_BROWSEREVENTS_POINTER_EVENT: 'extra.browserEvents.window.pointer.event',
|
|
12
13
|
EXTRA_BROWSEREVENTS_WINDOW_PRE_RESIZE: 'extra.browserEvents.window.pre.resize',
|
|
13
14
|
EXTRA_BROWSEREVENTS_WINDOW_RESIZE: 'extra.browserEvents.window.resize',
|