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

View File

@@ -885,9 +885,8 @@ export default class App extends React.Component<any, AppState> {
}
onFileSelected = (e: File[]) => {
var file = e[0];
var pmt = new PMTiles(new FileSource(file));
console.log("App.onFileSelected", pmt);
const file = e[0];
const pmt = new PMTiles(new FileSource(file));
this.setState({
file: pmt
})

View File

@@ -295,10 +295,10 @@ class AppToolbarInternal extends React.Component<AppToolbarInternalProps> {
<Dropzone onDrop={this.props.onFileSelected}>
{({getRootProps, getInputProps}) => (
<div {...getRootProps({className: 'dropzone maputnik-toolbar-link'})}>
<input {...getInputProps()} />
Drop file here
</div>
<div {...getRootProps({className: 'dropzone maputnik-toolbar-link'})}>
<input {...getInputProps()} />
Drop file here
</div>
)}
</Dropzone>
</div>

View File

@@ -139,12 +139,12 @@ class MapMaplibreGlInternal extends React.Component<MapMaplibreGlInternalProps,
}
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
if (map) {
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;
console.log("layerNames for inspect:", layerNames);
@@ -166,7 +166,7 @@ class MapMaplibreGlInternal extends React.Component<MapMaplibreGlInternalProps,
localIdeographFontFamily: false
} satisfies MapOptions;
let protocol = this.state.protocol;
const protocol = this.state.protocol;
MapLibreGl.addProtocol("pmtiles", protocol!.tile);
const map = new MapLibreGl.Map(mapOpts);