Skip to content

Commit

Permalink
Revert "Add _scenegraphLoader property to ScenegraphLayer (#3258)"
Browse files Browse the repository at this point in the history
This reverts commit e443afe.
  • Loading branch information
georgios-uber committed Jun 20, 2019
1 parent e443afe commit 3371bee
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 34 deletions.
5 changes: 0 additions & 5 deletions docs/layers/scenegraph-layer.md
Expand Up @@ -71,11 +71,6 @@ Can be a URL of an object. You need to provide the `fetch` function to load the
Can also be a luma.gl [ScenegraphNode](http://uber.github.io/luma.gl/#/documentation/api-reference/), or a `Promise` that resolves to one.
The layer calls _delete()_ on _scenegraph_ when a new one is provided or the layer is finalized.

##### `_scenegraphLoader` (Object, optional)

If you provide a URL for `scenegraph` you can optionally provide a `_scenegraphLoader` to load the URL.
Read more about loaders [here](https://loaders.gl/docs/developer-guide/get-started).
If not provided `loaders.gl` will select one automatically from [registered loaders](https://loaders.gl/docs/api-reference/core/register-loaders).

### Render Options

Expand Down
8 changes: 1 addition & 7 deletions modules/mesh-layers/src/scenegraph-layer/scenegraph-layer.js
Expand Up @@ -34,16 +34,10 @@ const DEFAULT_COLOR = [255, 255, 255, 255];

const defaultProps = {
scenegraph: {type: 'object', value: null, async: true},
_scenegraphLoader: null,

fetch: (url, {propName, layer}) => {
if (propName === 'scenegraph') {
const options = layer.getLoadOptions();

if (layer.props._scenegraphLoader) {
return load(url, layer.props._scenegraphLoader, options);
}
return load(url, options);
return load(url, layer.getLoadOptions());
}

return fetch(url).then(response => response.json());
Expand Down
22 changes: 0 additions & 22 deletions test/modules/layers/scenegraph-layer.spec.js
Expand Up @@ -126,25 +126,3 @@ test('ScenegraphLayer#tests', t => {

t.end();
});

test('ScenegraphLayer#defaultProps.fetch', async t => {
const loadOptions = {
load: true
};
const url = new ArrayBuffer();
const propName = 'scenegraph';
const layer = {
props: {
_scenegraphLoader: {
parse: () => 9,
loadAndParse: () => 9,
extensions: '.glb'
}
},
getLoadOptions: () => loadOptions
};

const loaded = await ScenegraphLayer.defaultProps.fetch(url, {propName, layer});
t.ok(loaded === 9, 'Using loader success');
t.end();
});

0 comments on commit 3371bee

Please sign in to comment.