|
5 | 5 | */
|
6 | 6 | 'use strict';
|
7 | 7 |
|
8 |
| -const REVISION = '178'; |
| 8 | +const REVISION = '179dev'; |
9 | 9 |
|
10 | 10 | /**
|
11 | 11 | * Represents mouse buttons and interaction types in context of controls.
|
@@ -43308,6 +43308,13 @@ class LoadingManager {
|
43308 | 43308 | */
|
43309 | 43309 | this.onError = onError;
|
43310 | 43310 |
|
| 43311 | + /** |
| 43312 | + * Used for aborting ongoing requests in loaders using this manager. |
| 43313 | + * |
| 43314 | + * @type {AbortController} |
| 43315 | + */ |
| 43316 | + this.abortController = new AbortController(); |
| 43317 | + |
43311 | 43318 | /**
|
43312 | 43319 | * This should be called by any loader using the manager when the loader
|
43313 | 43320 | * starts loading an item.
|
@@ -43508,6 +43515,22 @@ class LoadingManager {
|
43508 | 43515 |
|
43509 | 43516 | };
|
43510 | 43517 |
|
| 43518 | + /** |
| 43519 | + * Can be used to abort ongoing loading requests in loaders using this manager. |
| 43520 | + * The abort only works if the loaders implement {@link Loader#abort} and `AbortSignal.any()` |
| 43521 | + * is supported in the browser. |
| 43522 | + * |
| 43523 | + * @return {LoadingManager} A reference to this loading manager. |
| 43524 | + */ |
| 43525 | + this.abort = function () { |
| 43526 | + |
| 43527 | + this.abortController.abort(); |
| 43528 | + this.abortController = new AbortController(); |
| 43529 | + |
| 43530 | + return this; |
| 43531 | + |
| 43532 | + }; |
| 43533 | + |
43511 | 43534 | }
|
43512 | 43535 |
|
43513 | 43536 | }
|
@@ -43587,6 +43610,7 @@ class Loader {
|
43587 | 43610 | * This method needs to be implemented by all concrete loaders. It holds the
|
43588 | 43611 | * logic for loading assets from the backend.
|
43589 | 43612 | *
|
| 43613 | + * @abstract |
43590 | 43614 | * @param {string} url - The path/URL of the file to be loaded.
|
43591 | 43615 | * @param {Function} onLoad - Executed when the loading process has been finished.
|
43592 | 43616 | * @param {onProgressCallback} [onProgress] - Executed while the loading is in progress.
|
@@ -43617,6 +43641,7 @@ class Loader {
|
43617 | 43641 | * This method needs to be implemented by all concrete loaders. It holds the
|
43618 | 43642 | * logic for parsing the asset into three.js entities.
|
43619 | 43643 | *
|
| 43644 | + * @abstract |
43620 | 43645 | * @param {any} data - The data to parse.
|
43621 | 43646 | */
|
43622 | 43647 | parse( /* data */ ) {}
|
@@ -43691,6 +43716,18 @@ class Loader {
|
43691 | 43716 |
|
43692 | 43717 | }
|
43693 | 43718 |
|
| 43719 | + /** |
| 43720 | + * This method can be implemented in loaders for aborting ongoing requests. |
| 43721 | + * |
| 43722 | + * @abstract |
| 43723 | + * @return {Loader} A reference to this instance. |
| 43724 | + */ |
| 43725 | + abort() { |
| 43726 | + |
| 43727 | + return this; |
| 43728 | + |
| 43729 | + } |
| 43730 | + |
43694 | 43731 | }
|
43695 | 43732 |
|
43696 | 43733 | /**
|
@@ -43773,6 +43810,14 @@ class FileLoader extends Loader {
|
43773 | 43810 | */
|
43774 | 43811 | this.responseType = '';
|
43775 | 43812 |
|
| 43813 | + /** |
| 43814 | + * Used for aborting requests. |
| 43815 | + * |
| 43816 | + * @private |
| 43817 | + * @type {AbortController} |
| 43818 | + */ |
| 43819 | + this._abortController = new AbortController(); |
| 43820 | + |
43776 | 43821 | }
|
43777 | 43822 |
|
43778 | 43823 | /**
|
@@ -43839,7 +43884,7 @@ class FileLoader extends Loader {
|
43839 | 43884 | const req = new Request( url, {
|
43840 | 43885 | headers: new Headers( this.requestHeader ),
|
43841 | 43886 | credentials: this.withCredentials ? 'include' : 'same-origin',
|
43842 |
| - // An abort controller could be added within a future PR |
| 43887 | + signal: ( typeof AbortSignal.any === 'function' ) ? AbortSignal.any( [ this._abortController.signal, this.manager.abortController.signal ] ) : this._abortController.signal |
43843 | 43888 | } );
|
43844 | 43889 |
|
43845 | 43890 | // record states ( avoid data race )
|
@@ -44056,6 +44101,20 @@ class FileLoader extends Loader {
|
44056 | 44101 |
|
44057 | 44102 | }
|
44058 | 44103 |
|
| 44104 | + /** |
| 44105 | + * Aborts ongoing fetch requests. |
| 44106 | + * |
| 44107 | + * @return {FileLoader} A reference to this instance. |
| 44108 | + */ |
| 44109 | + abort() { |
| 44110 | + |
| 44111 | + this._abortController.abort(); |
| 44112 | + this._abortController = new AbortController(); |
| 44113 | + |
| 44114 | + return this; |
| 44115 | + |
| 44116 | + } |
| 44117 | + |
44059 | 44118 | }
|
44060 | 44119 |
|
44061 | 44120 | /**
|
@@ -48655,6 +48714,14 @@ class ImageBitmapLoader extends Loader {
|
48655 | 48714 | */
|
48656 | 48715 | this.options = { premultiplyAlpha: 'none' };
|
48657 | 48716 |
|
| 48717 | + /** |
| 48718 | + * Used for aborting requests. |
| 48719 | + * |
| 48720 | + * @private |
| 48721 | + * @type {AbortController} |
| 48722 | + */ |
| 48723 | + this._abortController = new AbortController(); |
| 48724 | + |
48658 | 48725 | }
|
48659 | 48726 |
|
48660 | 48727 | /**
|
@@ -48743,6 +48810,7 @@ class ImageBitmapLoader extends Loader {
|
48743 | 48810 | const fetchOptions = {};
|
48744 | 48811 | fetchOptions.credentials = ( this.crossOrigin === 'anonymous' ) ? 'same-origin' : 'include';
|
48745 | 48812 | fetchOptions.headers = this.requestHeader;
|
| 48813 | + fetchOptions.signal = ( typeof AbortSignal.any === 'function' ) ? AbortSignal.any( [ this._abortController.signal, this.manager.abortController.signal ] ) : this._abortController.signal; |
48746 | 48814 |
|
48747 | 48815 | const promise = fetch( url, fetchOptions ).then( function ( res ) {
|
48748 | 48816 |
|
@@ -48780,6 +48848,20 @@ class ImageBitmapLoader extends Loader {
|
48780 | 48848 |
|
48781 | 48849 | }
|
48782 | 48850 |
|
| 48851 | + /** |
| 48852 | + * Aborts ongoing fetch requests. |
| 48853 | + * |
| 48854 | + * @return {ImageBitmapLoader} A reference to this instance. |
| 48855 | + */ |
| 48856 | + abort() { |
| 48857 | + |
| 48858 | + this._abortController.abort(); |
| 48859 | + this._abortController = new AbortController(); |
| 48860 | + |
| 48861 | + return this; |
| 48862 | + |
| 48863 | + } |
| 48864 | + |
48783 | 48865 | }
|
48784 | 48866 |
|
48785 | 48867 | let _context;
|
@@ -56747,34 +56829,34 @@ class CameraHelper extends LineSegments {
|
56747 | 56829 |
|
56748 | 56830 | // near
|
56749 | 56831 |
|
56750 |
| - setPoint( 'n1', pointMap, geometry, _camera, - w, - h, nearZ ); |
56751 |
| - setPoint( 'n2', pointMap, geometry, _camera, w, - h, nearZ ); |
56752 |
| - setPoint( 'n3', pointMap, geometry, _camera, - w, h, nearZ ); |
| 56832 | + setPoint( 'n1', pointMap, geometry, _camera, -1, -1, nearZ ); |
| 56833 | + setPoint( 'n2', pointMap, geometry, _camera, w, -1, nearZ ); |
| 56834 | + setPoint( 'n3', pointMap, geometry, _camera, -1, h, nearZ ); |
56753 | 56835 | setPoint( 'n4', pointMap, geometry, _camera, w, h, nearZ );
|
56754 | 56836 |
|
56755 | 56837 | // far
|
56756 | 56838 |
|
56757 |
| - setPoint( 'f1', pointMap, geometry, _camera, - w, - h, 1 ); |
56758 |
| - setPoint( 'f2', pointMap, geometry, _camera, w, - h, 1 ); |
56759 |
| - setPoint( 'f3', pointMap, geometry, _camera, - w, h, 1 ); |
| 56839 | + setPoint( 'f1', pointMap, geometry, _camera, -1, -1, 1 ); |
| 56840 | + setPoint( 'f2', pointMap, geometry, _camera, w, -1, 1 ); |
| 56841 | + setPoint( 'f3', pointMap, geometry, _camera, -1, h, 1 ); |
56760 | 56842 | setPoint( 'f4', pointMap, geometry, _camera, w, h, 1 );
|
56761 | 56843 |
|
56762 | 56844 | // up
|
56763 | 56845 |
|
56764 | 56846 | setPoint( 'u1', pointMap, geometry, _camera, w * 0.7, h * 1.1, nearZ );
|
56765 |
| - setPoint( 'u2', pointMap, geometry, _camera, - w * 0.7, h * 1.1, nearZ ); |
| 56847 | + setPoint( 'u2', pointMap, geometry, _camera, -1 * 0.7, h * 1.1, nearZ ); |
56766 | 56848 | setPoint( 'u3', pointMap, geometry, _camera, 0, h * 2, nearZ );
|
56767 | 56849 |
|
56768 | 56850 | // cross
|
56769 | 56851 |
|
56770 |
| - setPoint( 'cf1', pointMap, geometry, _camera, - w, 0, 1 ); |
| 56852 | + setPoint( 'cf1', pointMap, geometry, _camera, -1, 0, 1 ); |
56771 | 56853 | setPoint( 'cf2', pointMap, geometry, _camera, w, 0, 1 );
|
56772 |
| - setPoint( 'cf3', pointMap, geometry, _camera, 0, - h, 1 ); |
| 56854 | + setPoint( 'cf3', pointMap, geometry, _camera, 0, -1, 1 ); |
56773 | 56855 | setPoint( 'cf4', pointMap, geometry, _camera, 0, h, 1 );
|
56774 | 56856 |
|
56775 |
| - setPoint( 'cn1', pointMap, geometry, _camera, - w, 0, nearZ ); |
| 56857 | + setPoint( 'cn1', pointMap, geometry, _camera, -1, 0, nearZ ); |
56776 | 56858 | setPoint( 'cn2', pointMap, geometry, _camera, w, 0, nearZ );
|
56777 |
| - setPoint( 'cn3', pointMap, geometry, _camera, 0, - h, nearZ ); |
| 56859 | + setPoint( 'cn3', pointMap, geometry, _camera, 0, -1, nearZ ); |
56778 | 56860 | setPoint( 'cn4', pointMap, geometry, _camera, 0, h, nearZ );
|
56779 | 56861 |
|
56780 | 56862 | geometry.getAttribute( 'position' ).needsUpdate = true;
|
|
0 commit comments