Skip to content

Commit 7693217

Browse files
committed
cleaned up props name and console logging
1 parent 486ede5 commit 7693217

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

src/components/App.tsx

+4-4
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ type AppState = {
131131
debug: boolean
132132
}
133133
fileHandle: FileSystemFileHandle | null
134-
file: PMTiles | null
134+
localPMTiles: PMTiles | null
135135
}
136136

137137
export default class App extends React.Component<any, AppState> {
@@ -288,7 +288,7 @@ export default class App extends React.Component<any, AppState> {
288288
debugToolbox: false,
289289
},
290290
fileHandle: null,
291-
file: null
291+
localPMTiles: null
292292
}
293293

294294
this.layerWatcher = new LayerWatcher({
@@ -743,7 +743,7 @@ export default class App extends React.Component<any, AppState> {
743743
onChange={this.onMapChange}
744744
options={this.state.maplibreGlDebugOptions}
745745
inspectModeEnabled={this.state.mapState === "inspect"}
746-
file={this.state.file}
746+
localPMTiles={this.state.localPMTiles}
747747
highlightedLayer={this.state.mapStyle.layers[this.state.selectedLayerIndex]}
748748
onLayerSelect={this.onLayerSelect} />
749749
}
@@ -888,7 +888,7 @@ export default class App extends React.Component<any, AppState> {
888888
const file = e[0];
889889
const pmt = new PMTiles(new FileSource(file));
890890
this.setState({
891-
file: pmt
891+
localPMTiles: pmt
892892
})
893893
}
894894

src/components/MapMaplibreGl.tsx

+4-4
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ type MapMaplibreGlInternalProps = {
6666
}
6767
replaceAccessTokens(mapStyle: StyleSpecification): StyleSpecification
6868
onChange(value: {center: LngLat, zoom: number}): unknown
69-
file: PMTiles | null;
69+
localPMTiles: PMTiles | null;
7070
} & WithTranslation;
7171

7272
type MapMaplibreGlState = {
@@ -138,16 +138,16 @@ class MapMaplibreGlInternal extends React.Component<MapMaplibreGlInternalProps,
138138
}, 500);
139139
}
140140

141-
if (this.props.file) {
142-
const file = this.props.file;
141+
if (this.props.localPMTiles) {
142+
const file = this.props.localPMTiles;
143143
this.state.protocol!.add(file); // this is necessary for non-HTTP sources
144144

145145
if (map) {
146146
file.getMetadata().then((metadata: any) => {
147147
const layerNames = metadata.vector_layers.map((e: LayerSpecification) => e.id);
148148

149+
// used by maplibre-gl-inspect to pick up inspectable layers
149150
map.style.sourceCaches["source"]._source.vectorLayerIds = layerNames;
150-
console.log("layerNames for inspect:", layerNames);
151151
});
152152
}
153153
}

0 commit comments

Comments
 (0)