Skip to content

Commit

Permalink
Update to latest version, remove unwanted code
Browse files Browse the repository at this point in the history
  • Loading branch information
HarelM committed Mar 13, 2024
1 parent 180e470 commit b910214
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 21 deletions.
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"dependencies": {
"@mapbox/mapbox-gl-rtl-text": "^0.2.3",
"@maplibre/maplibre-gl-geocoder": "^1.5.0",
"@maplibre/maplibre-gl-inspect": "^1.5.2",
"@maplibre/maplibre-gl-inspect": "^1.6.0",
"@maplibre/maplibre-gl-style-spec": "^20.1.0",
"@mdi/js": "^6.6.96",
"@mdi/react": "^1.5.0",
Expand Down
20 changes: 4 additions & 16 deletions src/components/MapMaplibreGl.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,7 @@ export default class MapMaplibreGl extends React.Component<MapMaplibreGlProps, M
if (!props.mapStyle.metadata) {
props.mapStyle.metadata = {};
}
(props.mapStyle.metadata as any)['maplibregl-inspect:inspect'] = false;
}
console.log('setting style', props.mapStyle.metadata);
this.state.map.setStyle(
this.props.replaceAccessTokens(props.mapStyle),
{diff: true}
Expand All @@ -124,23 +122,13 @@ export default class MapMaplibreGl extends React.Component<MapMaplibreGlProps, M
this.updateMapFromProps(this.props);

if(this.state.inspect && this.props.inspectModeEnabled !== this.state.inspect._showInspectMap) {
// HACK: Fix for <https://github.com/maplibre/maputnik/issues/576>, while we wait for a proper fix.
// eslint-disable-next-line
this.state.inspect._popupBlocked = false;
this.state.inspect.toggleInspector()
}
if (this.state.inspect && this.props.inspectModeEnabled) {
this.state.inspect!.setOriginalStyle(this.props.replaceAccessTokens(this.props.mapStyle));
this.state.inspect!.render();
}
if (map) {
if (this.props.inspectModeEnabled) {
// HACK: We need to work out why we need to do this and what's causing
// this error. I'm assuming an issue with maplibre-gl update and
// mapbox-gl-inspect.
try {
//this.state.inspect.render();
} catch(err) {
console.error("FIXME: Caught error", err);
}
}

map.showTileBoundaries = this.props.options?.showTileBoundaries!;
map.showCollisionBoxes = this.props.options?.showCollisionBoxes!;
map.showOverdrawInspector = this.props.options?.showOverdrawInspector!;
Expand Down

0 comments on commit b910214

Please sign in to comment.