mirror of
https://github.com/maputnik/editor.git
synced 2026-08-26 15:07:41 +00:00
cleaned up props name and console logging
This commit is contained in:
@@ -131,7 +131,7 @@ type AppState = {
|
|||||||
debug: boolean
|
debug: boolean
|
||||||
}
|
}
|
||||||
fileHandle: FileSystemFileHandle | null
|
fileHandle: FileSystemFileHandle | null
|
||||||
file: PMTiles | null
|
localPMTiles: PMTiles | null
|
||||||
}
|
}
|
||||||
|
|
||||||
export default class App extends React.Component<any, AppState> {
|
export default class App extends React.Component<any, AppState> {
|
||||||
@@ -288,7 +288,7 @@ export default class App extends React.Component<any, AppState> {
|
|||||||
debugToolbox: false,
|
debugToolbox: false,
|
||||||
},
|
},
|
||||||
fileHandle: null,
|
fileHandle: null,
|
||||||
file: null
|
localPMTiles: null
|
||||||
}
|
}
|
||||||
|
|
||||||
this.layerWatcher = new LayerWatcher({
|
this.layerWatcher = new LayerWatcher({
|
||||||
@@ -743,7 +743,7 @@ export default class App extends React.Component<any, AppState> {
|
|||||||
onChange={this.onMapChange}
|
onChange={this.onMapChange}
|
||||||
options={this.state.maplibreGlDebugOptions}
|
options={this.state.maplibreGlDebugOptions}
|
||||||
inspectModeEnabled={this.state.mapState === "inspect"}
|
inspectModeEnabled={this.state.mapState === "inspect"}
|
||||||
file={this.state.file}
|
localPMTiles={this.state.localPMTiles}
|
||||||
highlightedLayer={this.state.mapStyle.layers[this.state.selectedLayerIndex]}
|
highlightedLayer={this.state.mapStyle.layers[this.state.selectedLayerIndex]}
|
||||||
onLayerSelect={this.onLayerSelect} />
|
onLayerSelect={this.onLayerSelect} />
|
||||||
}
|
}
|
||||||
@@ -888,7 +888,7 @@ export default class App extends React.Component<any, AppState> {
|
|||||||
const file = e[0];
|
const file = e[0];
|
||||||
const pmt = new PMTiles(new FileSource(file));
|
const pmt = new PMTiles(new FileSource(file));
|
||||||
this.setState({
|
this.setState({
|
||||||
file: pmt
|
localPMTiles: pmt
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ type MapMaplibreGlInternalProps = {
|
|||||||
}
|
}
|
||||||
replaceAccessTokens(mapStyle: StyleSpecification): StyleSpecification
|
replaceAccessTokens(mapStyle: StyleSpecification): StyleSpecification
|
||||||
onChange(value: {center: LngLat, zoom: number}): unknown
|
onChange(value: {center: LngLat, zoom: number}): unknown
|
||||||
file: PMTiles | null;
|
localPMTiles: PMTiles | null;
|
||||||
} & WithTranslation;
|
} & WithTranslation;
|
||||||
|
|
||||||
type MapMaplibreGlState = {
|
type MapMaplibreGlState = {
|
||||||
@@ -138,16 +138,16 @@ class MapMaplibreGlInternal extends React.Component<MapMaplibreGlInternalProps,
|
|||||||
}, 500);
|
}, 500);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.props.file) {
|
if (this.props.localPMTiles) {
|
||||||
const file = this.props.file;
|
const file = this.props.localPMTiles;
|
||||||
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) => {
|
||||||
const layerNames = metadata.vector_layers.map((e: LayerSpecification) => e.id);
|
const layerNames = metadata.vector_layers.map((e: LayerSpecification) => e.id);
|
||||||
|
|
||||||
|
// used by maplibre-gl-inspect to pick up inspectable layers
|
||||||
map.style.sourceCaches["source"]._source.vectorLayerIds = layerNames;
|
map.style.sourceCaches["source"]._source.vectorLayerIds = layerNames;
|
||||||
console.log("layerNames for inspect:", layerNames);
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user