mirror of
https://github.com/maputnik/editor.git
synced 2026-08-25 06:27:25 +00:00
make it clearer that the added protocol is for PMTiles only
This commit is contained in:
@@ -75,7 +75,7 @@ type MapMaplibreGlState = {
|
|||||||
geocoder: MaplibreGeocoder | null;
|
geocoder: MaplibreGeocoder | null;
|
||||||
zoomControl: ZoomControl | null;
|
zoomControl: ZoomControl | null;
|
||||||
zoom?: number;
|
zoom?: number;
|
||||||
protocol: Protocol | null;
|
pmtilesProtocol: Protocol | null;
|
||||||
};
|
};
|
||||||
|
|
||||||
class MapMaplibreGlInternal extends React.Component<MapMaplibreGlInternalProps, MapMaplibreGlState> {
|
class MapMaplibreGlInternal extends React.Component<MapMaplibreGlInternalProps, MapMaplibreGlState> {
|
||||||
@@ -95,7 +95,7 @@ class MapMaplibreGlInternal extends React.Component<MapMaplibreGlInternalProps,
|
|||||||
inspect: null,
|
inspect: null,
|
||||||
geocoder: null,
|
geocoder: null,
|
||||||
zoomControl: null,
|
zoomControl: null,
|
||||||
protocol: new Protocol({metadata: true})
|
pmtilesProtocol: new Protocol({metadata: true})
|
||||||
}
|
}
|
||||||
i18next.on('languageChanged', () => {
|
i18next.on('languageChanged', () => {
|
||||||
this.forceUpdate();
|
this.forceUpdate();
|
||||||
@@ -140,7 +140,7 @@ class MapMaplibreGlInternal extends React.Component<MapMaplibreGlInternalProps,
|
|||||||
|
|
||||||
if (this.props.localPMTiles) {
|
if (this.props.localPMTiles) {
|
||||||
const file = this.props.localPMTiles;
|
const file = this.props.localPMTiles;
|
||||||
this.state.protocol!.add(file); // this is necessary for non-HTTP sources
|
this.state.pmtilesProtocol!.add(file); // this is necessary for non-HTTP sources
|
||||||
|
|
||||||
if (map) {
|
if (map) {
|
||||||
file.getMetadata().then((metadata: any) => {
|
file.getMetadata().then((metadata: any) => {
|
||||||
@@ -166,8 +166,7 @@ class MapMaplibreGlInternal extends React.Component<MapMaplibreGlInternalProps,
|
|||||||
localIdeographFontFamily: false
|
localIdeographFontFamily: false
|
||||||
} satisfies MapOptions;
|
} satisfies MapOptions;
|
||||||
|
|
||||||
const protocol = this.state.protocol;
|
MapLibreGl.addProtocol("pmtiles", this.state.pmtilesProtocol!.tile);
|
||||||
MapLibreGl.addProtocol("pmtiles", protocol!.tile);
|
|
||||||
|
|
||||||
const map = new MapLibreGl.Map(mapOpts);
|
const map = new MapLibreGl.Map(mapOpts);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user