ohzi-core 6.6.1 → 6.9.0
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/build/index.module.js +1 -1
- package/build/index.module.js.map +1 -1
- package/package.json +1 -1
- package/src/components/UIElement.js +1 -1
- package/src/index.js +2 -0
- package/src/resource_loader/AsyncTextureLoader.js +35 -0
- package/src/view_components/ApplicationView.js +6 -2
- package/src/view_components/ViewManager.js +33 -0
- package/types/resource_loader/AsyncTextureLoader.ts +6 -0
- package/types/resource_loader/BasisLoader.d.ts +1 -1
package/package.json
CHANGED
|
@@ -180,7 +180,7 @@ export default class UIElement extends Mesh
|
|
|
180
180
|
{
|
|
181
181
|
this.material.uniforms._MainTex.value.dispose();
|
|
182
182
|
}
|
|
183
|
-
//
|
|
183
|
+
// OScreen.remove_screen_material(this.material);
|
|
184
184
|
this.geometry.dispose();
|
|
185
185
|
this.material.dispose();
|
|
186
186
|
}
|
package/src/index.js
CHANGED
|
@@ -100,6 +100,7 @@ import OBJLoader from './resource_loader/OBJLoader';
|
|
|
100
100
|
import PointArrayLoader from './resource_loader/PointArrayLoader';
|
|
101
101
|
import RGBETextureLoader from './resource_loader/RGBETextureLoader';
|
|
102
102
|
import TextLoader from './resource_loader/TextLoader';
|
|
103
|
+
import AsyncTextureLoader from './resource_loader/AsyncTextureLoader';
|
|
103
104
|
import TextureLoader from './resource_loader/TextureLoader';
|
|
104
105
|
import VideoLoader from './resource_loader/VideoLoader';
|
|
105
106
|
|
|
@@ -205,6 +206,7 @@ export {
|
|
|
205
206
|
PointArrayLoader,
|
|
206
207
|
RGBETextureLoader,
|
|
207
208
|
TextLoader,
|
|
209
|
+
AsyncTextureLoader,
|
|
208
210
|
TextureLoader,
|
|
209
211
|
VideoLoader,
|
|
210
212
|
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import AbstractLoader from './AbstractLoader';
|
|
2
|
+
|
|
3
|
+
import { Texture } from 'three';
|
|
4
|
+
|
|
5
|
+
export default class AsyncTextureLoader extends AbstractLoader
|
|
6
|
+
{
|
|
7
|
+
constructor(resource_id, url, size)
|
|
8
|
+
{
|
|
9
|
+
super(resource_id, url, size);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
on_preloaded_finished(resource_container)
|
|
13
|
+
{
|
|
14
|
+
const texture = new Texture();
|
|
15
|
+
const image = new Image();
|
|
16
|
+
|
|
17
|
+
image.src = this.url;
|
|
18
|
+
|
|
19
|
+
image.onload = () =>
|
|
20
|
+
{
|
|
21
|
+
texture.image = image;
|
|
22
|
+
texture.needsUpdate = true;
|
|
23
|
+
|
|
24
|
+
resource_container.set_resource(this.resource_id, this.url, texture);
|
|
25
|
+
|
|
26
|
+
this.__update_downloaded_bytes(1, 1);
|
|
27
|
+
this.__loading_ended();
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
image.onerror = () =>
|
|
31
|
+
{
|
|
32
|
+
console.error('Error loading texture. Maybe the resource is not an image?', this.url);
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import ResourceContainer from '../ResourceContainer';
|
|
2
|
-
import DrawIOAnimationSheet from './transition/DrawIOAnimationSheet';
|
|
3
2
|
import ViewManager from './ViewManager';
|
|
4
3
|
import ViewState from './ViewState';
|
|
5
4
|
|
|
@@ -12,7 +11,12 @@ export default class ApplicationView extends ViewState
|
|
|
12
11
|
this.container = container;
|
|
13
12
|
this.url = url;
|
|
14
13
|
|
|
15
|
-
|
|
14
|
+
let transition_data = ResourceContainer.get(`${name}_data`);
|
|
15
|
+
|
|
16
|
+
transition_data = transition_data || {
|
|
17
|
+
animation_tracks: [],
|
|
18
|
+
triggers: []
|
|
19
|
+
};
|
|
16
20
|
|
|
17
21
|
const transitions = [
|
|
18
22
|
{
|
|
@@ -11,6 +11,8 @@ class ViewManager
|
|
|
11
11
|
this.transition_handler = new ViewStateTransitionHandler(this.transition_table);
|
|
12
12
|
|
|
13
13
|
this.view_change_subscribers = [];
|
|
14
|
+
|
|
15
|
+
this.browser_title_suffix = '';
|
|
14
16
|
}
|
|
15
17
|
|
|
16
18
|
update()
|
|
@@ -28,6 +30,7 @@ class ViewManager
|
|
|
28
30
|
if (change_url)
|
|
29
31
|
{
|
|
30
32
|
this.__change_browser_url(v.url);
|
|
33
|
+
this.__change_browser_title(v.url);
|
|
31
34
|
}
|
|
32
35
|
|
|
33
36
|
this.notify_view_change(view_name);
|
|
@@ -81,6 +84,11 @@ class ViewManager
|
|
|
81
84
|
this.transition_handler.set_state(view);
|
|
82
85
|
}
|
|
83
86
|
|
|
87
|
+
set_browser_title_suffix(title_suffix)
|
|
88
|
+
{
|
|
89
|
+
this.browser_title_suffix = title_suffix;
|
|
90
|
+
}
|
|
91
|
+
|
|
84
92
|
get_current_view()
|
|
85
93
|
{
|
|
86
94
|
return this.transition_handler.current_state;
|
|
@@ -135,6 +143,13 @@ class ViewManager
|
|
|
135
143
|
window.history.pushState('', '', url);
|
|
136
144
|
}
|
|
137
145
|
|
|
146
|
+
__change_browser_title(name)
|
|
147
|
+
{
|
|
148
|
+
const title = this.__capitalize(name);
|
|
149
|
+
|
|
150
|
+
document.title = title ? `${title} | ${this.browser_title_suffix}` : this.browser_title_suffix;
|
|
151
|
+
}
|
|
152
|
+
|
|
138
153
|
__set_views_opacities()
|
|
139
154
|
{
|
|
140
155
|
for (let i = 0; i < this.views.length; i++)
|
|
@@ -142,6 +157,24 @@ class ViewManager
|
|
|
142
157
|
this.views[i].set_opacity(this.transition_handler.current_state_data);
|
|
143
158
|
}
|
|
144
159
|
}
|
|
160
|
+
|
|
161
|
+
__capitalize(string)
|
|
162
|
+
{
|
|
163
|
+
let aux_string = string.toUpperCase().replace('/', '');
|
|
164
|
+
aux_string = this.__snake_to_whitespace(aux_string);
|
|
165
|
+
|
|
166
|
+
return aux_string;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
__snake_to_whitespace(string)
|
|
170
|
+
{
|
|
171
|
+
return string.replace(
|
|
172
|
+
/([-_][A-Z])/g,
|
|
173
|
+
(group) => group
|
|
174
|
+
.replace('-', ' ')
|
|
175
|
+
.replace('_', ' ')
|
|
176
|
+
);
|
|
177
|
+
}
|
|
145
178
|
}
|
|
146
179
|
|
|
147
180
|
export default new ViewManager();
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { AbstractLoader } from "./AbstractLoader";
|
|
2
2
|
|
|
3
3
|
export class BasisLoader extends AbstractLoader {
|
|
4
|
-
constructor(resource_id: any, url: any,
|
|
4
|
+
constructor(resource_id: any, url: any, loader: any, size: any);
|
|
5
5
|
loader: any;
|
|
6
6
|
}
|