Skip to content

Commit

Permalink
Bump loaders and fix infinite updateState calls (#4061)
Browse files Browse the repository at this point in the history
  • Loading branch information
Xintong Xia authored Dec 20, 2019
1 parent 4e7a6a1 commit de8baba
Show file tree
Hide file tree
Showing 15 changed files with 93 additions and 124 deletions.
4 changes: 2 additions & 2 deletions examples/layer-browser/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
"start-local-production": "webpack-dev-server --env.local --env.production --progress --hot --open"
},
"dependencies": {
"@loaders.gl/ply": "^2.0.0-beta.5",
"@loaders.gl/gltf": "^2.0.0-beta.5",
"@loaders.gl/ply": "^2.0.0-beta.7",
"@loaders.gl/gltf": "^2.0.0-beta.7",
"@luma.gl/experimental": "^8.0.0-beta.3",
"@luma.gl/debug": "^8.0.0-beta.2",
"colorbrewer": "^1.0.0",
Expand Down
6 changes: 3 additions & 3 deletions examples/playground/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
},
"dependencies": {
"deck.gl": "^8.0.0-beta",
"@loaders.gl/csv": "^2.0.0-beta.5",
"@loaders.gl/core": "^2.0.0-beta.5",
"@loaders.gl/draco": "^2.0.0-beta.5",
"@loaders.gl/csv": "^2.0.0-beta.7",
"@loaders.gl/core": "^2.0.0-beta.7",
"@loaders.gl/draco": "^2.0.0-beta.7",
"@luma.gl/constants": "^8.0.0-beta.3",
"brace": "^0.11.1",
"react": "~16.9.0",
Expand Down
2 changes: 1 addition & 1 deletion examples/website/3d-tiles/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
},
"dependencies": {
"deck.gl": "^8.0.0-beta",
"@loaders.gl/draco": "^2.0.0-beta.5",
"@loaders.gl/draco": "^2.0.0-beta.7",
"react": "^16.8.0",
"react-dom": "^16.8.0",
"react-map-gl": "^5.0.0"
Expand Down
2 changes: 1 addition & 1 deletion examples/website/mesh/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"start-local": "webpack-dev-server --env.local --progress --hot --open"
},
"dependencies": {
"@loaders.gl/obj": "^2.0.0-beta.5",
"@loaders.gl/obj": "^2.0.0-beta.7",
"deck.gl": "^8.0.0-beta",
"react": "^16.3.0",
"react-dom": "^16.3.0",
Expand Down
4 changes: 2 additions & 2 deletions examples/website/point-cloud/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
"start-local": "webpack-dev-server --env.local --progress --hot --open"
},
"dependencies": {
"@loaders.gl/las": "^2.0.0-beta.5",
"@loaders.gl/ply": "^2.0.0-beta.5",
"@loaders.gl/las": "^2.0.0-beta.7",
"@loaders.gl/ply": "^2.0.0-beta.7",
"deck.gl": "^8.0.0-beta",
"react": "^16.3.0",
"react-dom": "^16.3.0"
Expand Down
2 changes: 1 addition & 1 deletion examples/website/scenegraph-layer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
},
"dependencies": {
"deck.gl": "^8.0.0-beta",
"@loaders.gl/gltf": "^2.0.0-beta.5",
"@loaders.gl/gltf": "^2.0.0-beta.7",
"react": "^16.3.0",
"react-dom": "^16.3.0",
"react-map-gl": "^5.0.0"
Expand Down
4 changes: 2 additions & 2 deletions modules/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@
"prepublishOnly": "npm run build-debugger && npm run build-bundle && npm run build-bundle -- --env.dev"
},
"dependencies": {
"@loaders.gl/core": "^2.0.0-beta.5",
"@loaders.gl/images": "^2.0.0-beta.5",
"@loaders.gl/core": "^2.0.0-beta.7",
"@loaders.gl/images": "^2.0.0-beta.7",
"@luma.gl/core": "^8.0.0-beta.4",
"@math.gl/web-mercator": "^3.1.1",
"gl-matrix": "^3.0.0",
Expand Down
6 changes: 3 additions & 3 deletions modules/geo-layers/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@
"prepublishOnly": "npm run build-bundle && npm run build-bundle -- --env.dev"
},
"dependencies": {
"@loaders.gl/3d-tiles": "^2.0.0-beta.5",
"@loaders.gl/core": "^2.0.0-beta.5",
"@loaders.gl/gltf": "^2.0.0-beta.5",
"@loaders.gl/3d-tiles": "^2.0.0-beta.7",
"@loaders.gl/core": "^2.0.0-beta.7",
"@loaders.gl/gltf": "^2.0.0-beta.7",
"@math.gl/culling": "^3.1.1",
"@math.gl/geospatial": "^3.1.1",
"@math.gl/web-mercator": "^3.1.1",
Expand Down
20 changes: 11 additions & 9 deletions modules/geo-layers/src/tile-3d-layer/tile-3d-layer.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,19 +39,21 @@ export default class Tile3DLayer extends CompositeLayer {
return changeFlags.somethingChanged;
}

async updateState({props, oldProps}) {
updateState({props, oldProps, changeFlags}) {
if (props.data && props.data !== oldProps.data) {
await this._loadTileset(props.data);
this._loadTileset(props.data);
} else if (
(props._ionAccessToken || props._ionAssetId) &&
(props._ionAccessToken !== oldProps._ionAccessToken ||
props._ionAssetId !== oldProps._ionAssetId)
) {
await this._loadTilesetFromIon(props._ionAccessToken, props._ionAssetId);
this._loadTilesetFromIon(props._ionAccessToken, props._ionAssetId);
}

const {tileset3d} = this.state;
await this._updateTileset(tileset3d);
if (changeFlags.viewportChanged) {
const {tileset3d} = this.state;
this._updateTileset(tileset3d);
}
}

async _loadTileset(tilesetUrl, fetchOptions, ionMetadata) {
Expand All @@ -64,7 +66,6 @@ export default class Tile3DLayer extends CompositeLayer {
onTileLoad: tileHeader => {
this.props.onTileLoad(tileHeader);
this._updateTileset(tileset3d);
this.setNeedsUpdate();
},
onTileUnload: this.props.onTileUnload,
onTileLoadFail: this.props.onTileError,
Expand All @@ -80,25 +81,26 @@ export default class Tile3DLayer extends CompositeLayer {
});

if (tileset3d) {
this._updateTileset(tileset3d);
this.props.onTilesetLoad(tileset3d);
}
}

async _loadTilesetFromIon(ionAccessToken, ionAssetId) {
const ionMetadata = await _getIonTilesetMetadata(ionAccessToken, ionAssetId);
const {url, headers} = ionMetadata;
return await this._loadTileset(url, {headers}, ionMetadata);
await this._loadTileset(url, {headers}, ionMetadata);
}

async _updateTileset(tileset3d) {
_updateTileset(tileset3d) {
const {timeline, viewport} = this.context;
if (!timeline || !viewport || !tileset3d) {
return;
}

// use Date.now() as frame identifier for now and later used to filter layers for rendering
const frameState = getFrameState(viewport, Date.now());
await tileset3d.update(frameState);
tileset3d.update(frameState);
this._updateLayerMap(frameState.frameNumber);
}

Expand Down
6 changes: 3 additions & 3 deletions modules/jupyter-widget/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@
"@deck.gl/layers": "8.0.0-beta.2",
"@deck.gl/mesh-layers": "8.0.0-beta.2",
"@jupyter-widgets/base": "^2",
"@loaders.gl/3d-tiles": "^2.0.0-beta.5",
"@loaders.gl/core": "^2.0.0-beta.5",
"@loaders.gl/csv": "^2.0.0-beta.5",
"@loaders.gl/3d-tiles": "^2.0.0-beta.7",
"@loaders.gl/core": "^2.0.0-beta.7",
"@loaders.gl/csv": "^2.0.0-beta.7",
"@luma.gl/constants": "^8.0.0-beta.4",
"mapbox-gl": "^1.2.1"
},
Expand Down
2 changes: 1 addition & 1 deletion modules/layers/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"prepublishOnly": "npm run build-bundle && npm run build-bundle -- --env.dev"
},
"dependencies": {
"@loaders.gl/images": "^2.0.0-beta.5",
"@loaders.gl/images": "^2.0.0-beta.7",
"@mapbox/tiny-sdf": "^1.1.0",
"earcut": "^2.0.6"
},
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@
"@luma.gl/test-utils": "^8.0.0-beta.4",
"@probe.gl/bench": "^3.2.0",
"@probe.gl/test-utils": "^3.2.0",
"@loaders.gl/csv": "^2.0.0-beta.5",
"@loaders.gl/polyfills": "^2.0.0-beta.5",
"@loaders.gl/csv": "^2.0.0-beta.7",
"@loaders.gl/polyfills": "^2.0.0-beta.7",
"babel-loader": "^8.0.0",
"babel-plugin-inline-webgl-constants": "^1.0.1",
"babel-plugin-remove-glsl-comments": "^0.1.0",
Expand Down
2 changes: 1 addition & 1 deletion website-gatsby/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"deploy": "NODE_DEBUG=gh-pages gh-pages -d public"
},
"dependencies": {
"@loaders.gl/las": "^2.0.0-beta.5",
"@loaders.gl/las": "^2.0.0-beta.7",
"@luma.gl/addons": "^8.0.0-beta.2",
"@luma.gl/constants": "^8.0.0-beta.2",
"@luma.gl/core": "^8.0.0-beta.2",
Expand Down
8 changes: 4 additions & 4 deletions website/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@
"lint": "eslint src --ignore-pattern workers"
},
"dependencies": {
"@loaders.gl/csv": "^2.0.0-beta.5",
"@loaders.gl/core": "^2.0.0-beta.5",
"@loaders.gl/draco": "^2.0.0-beta.5",
"@loaders.gl/las": "^2.0.0-beta.5",
"@loaders.gl/csv": "^2.0.0-beta.7",
"@loaders.gl/core": "^2.0.0-beta.7",
"@loaders.gl/draco": "^2.0.0-beta.7",
"@loaders.gl/las": "^2.0.0-beta.7",
"@mapbox/vector-tile": "^1.3.1",
"@tweenjs/tween.js": "^16.7.0",
"autobind-decorator": "^1.3.3",
Expand Down
Loading

0 comments on commit de8baba

Please sign in to comment.