我收到错误:像素项目矩阵不可逆,地图的this.state.viewport不会改变

问题描述 投票:0回答:1

我有mapbox的Geocoder组件(参见Map.jsx文件),当我搜索示例(键入搜索输入)'Kyiv'时,它运行良好,但'肯尼亚'没有,并在控制台中抛出错误。我在我的项目中使用react-map-gl-geocoder这是我的代码的链接:https://github.com/NetisGod/Viewpoints-issue

我无法理解为什么有些城市有效,但另一些城市没有

抛出控制台的错误:

Uncaught Error: Pixel project matrix not invertible
    at WebMercatorViewport.Viewport (bundle.js:93669)
    at new WebMercatorViewport (bundle.js:94106)
    at fitBounds (bundle.js:88838)
    at EventEmitter.Geocoder._this.handleResult (bundle.js:88997)
    at EventEmitter../node_modules/events/events.js.EventEmitter.emit (bundle.js:8857)
    at MapboxGeocoder._onChange (bundle.js:1932)
    at Suggestions../node_modules/suggestions/src/suggestions.js.Suggestions.value (bundle.js:143620)
    at List../node_modules/suggestions/src/list.js.List.handleMouseUp (bundle.js:143415)
    at List.<anonymous> (bundle.js:143409)

我需要让Geocoder搜索mapbox正常工作。

javascript reactjs maps mapbox mapbox-gl-js
1个回答
0
投票

解决方案很奇怪。有趣的是,我在MapGL组件上设置了一个高度和宽度,看起来像删除它并将其添加到视口状态对象修复了我的问题。

© www.soinside.com 2019 - 2024. All rights reserved.