Skip to content

Commit

Permalink
v8 audit Layer#isLoaded implementations (#8290)
Browse files Browse the repository at this point in the history
Signed-off-by: Chris Gervang <chris@gervang.com>
  • Loading branch information
chrisgervang committed Jan 12, 2024
1 parent f19670d commit 64c4a01
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 2 deletions.
6 changes: 5 additions & 1 deletion modules/geo-layers/src/terrain-layer/terrain-layer.ts
Expand Up @@ -136,7 +136,7 @@ export default class TerrainLayer<ExtraPropsT extends {} = {}> extends Composite

state!: {
isTiled?: boolean;
terrain: MeshAttributes;
terrain?: MeshAttributes;
zRange?: ZRange | null;
};

Expand Down Expand Up @@ -343,6 +343,10 @@ export default class TerrainLayer<ExtraPropsT extends {} = {}> extends Composite
);
}

if (!elevationData) {
return null;
}

const SubLayerClass = this.getSubLayerClass('mesh', SimpleMeshLayer);
return new SubLayerClass(
this.getSubLayerProps({
Expand Down
2 changes: 1 addition & 1 deletion modules/geo-layers/src/wms-layer/wms-layer.ts
Expand Up @@ -85,7 +85,7 @@ export class WMSLayer<ExtraPropsT extends {} = {}> extends CompositeLayer<
/** Returns true if all async resources are loaded */
get isLoaded(): boolean {
// Track the explicit loading done by this layer
return Boolean(this.state) && this.state.loadCounter === 0 && super.isLoaded;
return this.state?.loadCounter === 0 && super.isLoaded;
}

/** Lets deck.gl know that we want viewport change events */
Expand Down
4 changes: 4 additions & 0 deletions modules/mesh-layers/src/scenegraph-layer/scenegraph-layer.ts
Expand Up @@ -240,6 +240,10 @@ export default class ScenegraphLayer<DataT = any, ExtraPropsT extends {} = {}> e
this._deleteScenegraph();
}

get isLoaded(): boolean {
return this.state?.scenegraph && super.isLoaded;
}

private _updateScenegraph(): void {
const props = this.props;
const {gl} = this.context;
Expand Down
Expand Up @@ -348,6 +348,10 @@ export default class SimpleMeshLayer<DataT = any, ExtraPropsT extends {} = {}> e
.draw();
}

get isLoaded(): boolean {
return this.state?.model && super.isLoaded;
}

protected getModel(mesh: Mesh): Model {
const model = new Model(this.context.gl, {
...this.getShaders(),
Expand Down

0 comments on commit 64c4a01

Please sign in to comment.