fixed lint errors

This commit is contained in:
prusswan
2025-01-24 12:24:15 +08:00
parent cdfe88ffc0
commit 9db49eee23
3 changed files with 9 additions and 10 deletions
+2 -3
View File
@@ -885,9 +885,8 @@ export default class App extends React.Component<any, AppState> {
} }
onFileSelected = (e: File[]) => { onFileSelected = (e: File[]) => {
var file = e[0]; const file = e[0];
var pmt = new PMTiles(new FileSource(file)); const pmt = new PMTiles(new FileSource(file));
console.log("App.onFileSelected", pmt);
this.setState({ this.setState({
file: pmt file: pmt
}) })
+4 -4
View File
@@ -295,10 +295,10 @@ class AppToolbarInternal extends React.Component<AppToolbarInternalProps> {
<Dropzone onDrop={this.props.onFileSelected}> <Dropzone onDrop={this.props.onFileSelected}>
{({getRootProps, getInputProps}) => ( {({getRootProps, getInputProps}) => (
<div {...getRootProps({className: 'dropzone maputnik-toolbar-link'})}> <div {...getRootProps({className: 'dropzone maputnik-toolbar-link'})}>
<input {...getInputProps()} /> <input {...getInputProps()} />
Drop file here Drop file here
</div> </div>
)} )}
</Dropzone> </Dropzone>
</div> </div>
+3 -3
View File
@@ -139,12 +139,12 @@ class MapMaplibreGlInternal extends React.Component<MapMaplibreGlInternalProps,
} }
if (this.props.file) { if (this.props.file) {
let file = this.props.file; const file = this.props.file;
this.state.protocol!.add(file); // this is necessary for non-HTTP sources this.state.protocol!.add(file); // this is necessary for non-HTTP sources
if (map) { if (map) {
file.getMetadata().then((metadata: any) => { file.getMetadata().then((metadata: any) => {
let layerNames = metadata.vector_layers.map((e: LayerSpecification) => e.id); const layerNames = metadata.vector_layers.map((e: LayerSpecification) => e.id);
map.style.sourceCaches["source"]._source.vectorLayerIds = layerNames; map.style.sourceCaches["source"]._source.vectorLayerIds = layerNames;
console.log("layerNames for inspect:", layerNames); console.log("layerNames for inspect:", layerNames);
@@ -166,7 +166,7 @@ class MapMaplibreGlInternal extends React.Component<MapMaplibreGlInternalProps,
localIdeographFontFamily: false localIdeographFontFamily: false
} satisfies MapOptions; } satisfies MapOptions;
let protocol = this.state.protocol; const protocol = this.state.protocol;
MapLibreGl.addProtocol("pmtiles", protocol!.tile); MapLibreGl.addProtocol("pmtiles", protocol!.tile);
const map = new MapLibreGl.Map(mapOpts); const map = new MapLibreGl.Map(mapOpts);