zincjs 1.10.2 → 1.10.3
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/zinc.frontend.js +1 -1
- package/build/zinc.js +5 -4
- package/build/zinc.js.map +1 -1
- package/package.json +1 -1
- package/src/loaders/primitivesLoader.js +44 -25
package/package.json
CHANGED
|
@@ -18,7 +18,6 @@ const mergeGeometries = (geometries) => {
|
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
const IndexedSourcesHandler = function(urlIn, crossOrigin, onDownloadedCallback) {
|
|
21
|
-
const allData = [];
|
|
22
21
|
const loader = new FileLoader();
|
|
23
22
|
const jsonLoader = new JSONLoader();
|
|
24
23
|
loader.crossOrigin = crossOrigin;
|
|
@@ -130,7 +129,6 @@ const MultiSourcesHandler = function(numberIn, onLoadCallback) {
|
|
|
130
129
|
onLoad(geometry, materials);
|
|
131
130
|
}
|
|
132
131
|
}
|
|
133
|
-
|
|
134
132
|
}
|
|
135
133
|
|
|
136
134
|
exports.PrimitivesLoader = function () {
|
|
@@ -161,35 +159,47 @@ exports.PrimitivesLoader = function () {
|
|
|
161
159
|
const newOptions = options ? {...options} : {};
|
|
162
160
|
let indexedLoader = indexedLoaders[url];
|
|
163
161
|
if (!indexedLoader) {
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
162
|
+
if (MAX_DOWNLOAD > concurrentDownloads) {
|
|
163
|
+
const onLoadCallback = new onFinally(undefined, this, newOptions);
|
|
164
|
+
++concurrentDownloads;
|
|
165
|
+
indexedLoader = new IndexedSourcesHandler(url, this.crossOrigin, onLoadCallback);
|
|
166
|
+
indexedLoaders[url] = indexedLoader;
|
|
167
|
+
} else {
|
|
168
|
+
waitingList.push({
|
|
169
|
+
url,
|
|
170
|
+
onLoad,
|
|
171
|
+
onProgress,
|
|
172
|
+
onError,
|
|
173
|
+
options,
|
|
174
|
+
});
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
if (indexedLoader) {
|
|
178
|
+
newOptions.isHandler = indexedLoader;
|
|
179
|
+
indexedLoader.load(options.index, onLoad, onProgress, onError);
|
|
168
180
|
}
|
|
169
|
-
newOptions.isHandler = indexedLoader;
|
|
170
|
-
indexedLoader.load(options.index, onLoad, onProgress, onError);
|
|
171
181
|
}
|
|
172
182
|
|
|
173
183
|
const loadFromSingleSource = (url, onLoad, onProgress, onError, options) => {
|
|
174
|
-
if (
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
184
|
+
if (options && (options.index !== undefined) ) {
|
|
185
|
+
handleIndexedSource(url, onLoad, onProgress, onError, options);
|
|
186
|
+
} else {
|
|
187
|
+
//Standard loading
|
|
188
|
+
if (MAX_DOWNLOAD > concurrentDownloads) {
|
|
179
189
|
++concurrentDownloads;
|
|
180
190
|
const onLoadCallback = new onFinally(onLoad, this, options);
|
|
181
191
|
const onErrorCallback = new onFinally(onError, this, options);
|
|
182
192
|
loader.crossOrigin = this.crossOrigin;
|
|
183
193
|
loader.load(url, onLoadCallback, onProgress, onErrorCallback);
|
|
194
|
+
} else {
|
|
195
|
+
waitingList.push({
|
|
196
|
+
url,
|
|
197
|
+
onLoad,
|
|
198
|
+
onProgress,
|
|
199
|
+
onError,
|
|
200
|
+
options,
|
|
201
|
+
});
|
|
184
202
|
}
|
|
185
|
-
} else {
|
|
186
|
-
waitingList.push({
|
|
187
|
-
url,
|
|
188
|
-
onLoad,
|
|
189
|
-
onProgress,
|
|
190
|
-
onError,
|
|
191
|
-
options,
|
|
192
|
-
});
|
|
193
203
|
}
|
|
194
204
|
}
|
|
195
205
|
|
|
@@ -202,10 +212,18 @@ exports.PrimitivesLoader = function () {
|
|
|
202
212
|
}
|
|
203
213
|
|
|
204
214
|
this.loadFromWaitingList = () => {
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
215
|
+
while (MAX_DOWNLOAD > concurrentDownloads) {
|
|
216
|
+
const item = waitingList.shift();
|
|
217
|
+
if (item) {
|
|
218
|
+
this.load(item.url, item.onLoad, item.onProgress, item.onError, item.options);
|
|
219
|
+
} else {
|
|
220
|
+
return;
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
this.itemRemainingCheck = () => {
|
|
226
|
+
if (waitingList.length === 0 && concurrentDownloads === 0) {
|
|
209
227
|
for (let key in indexedLoaders) {
|
|
210
228
|
if (indexedLoaders.hasOwnProperty(key)) {
|
|
211
229
|
delete indexedLoaders[key];
|
|
@@ -227,6 +245,7 @@ exports.PrimitivesLoader = function () {
|
|
|
227
245
|
}
|
|
228
246
|
}
|
|
229
247
|
loader.loadFromWaitingList();
|
|
248
|
+
loader.itemRemainingCheck();
|
|
230
249
|
}
|
|
231
250
|
}
|
|
232
251
|
|