重新定位时,Mapbox默认的罗盘视图会产生奇怪的结果

问题描述:

我遇到的情况是必须将地图框指南针视图重新定位到其他位置.现在,当我旋转地图时,如果将其他点作为其(compassView)轴,则指南针视图将旋转,这给我一个奇怪的结果.屏幕快照已附加,黑色mapBox默认指南针图标正在旋转,请参阅屏幕快照.这是MapBox的SDK错误吗?如果是这样,有什么解决方法吗?和调整?我很困惑.需要专家的建议.预先感谢.

I have a situation where I have to reposition the map box compass view to a different location. The compassView is now rotating when I rotate the map taking some other point as its(compassView) axis and gives me a weird outcome. Screenshot is attached, the black mapBox default compass icon is rotating, refer the screenshots. Is this a MapBox sdk bug? if so, are there any work around? And tweaks? I am confused. Expert advices needed. Thanks in advance.

嘿,我发现了另一种方法,可以在地图框中获得与指南针相同的结果.我放置了一个按钮,然后

Hey I found another method where I will get the same result of the compass in the map box. I've placed a button and then

func mapViewRegionIsChanging(_ mapView: MGLMapView) {
    compassViewUpdate(direction: Double(bearing))

指南针内部的更新方法

func compassViewUpdate(direction:Double) {

    self.compassButton.transform = CGAffineTransform(rotationAngle: CGFloat(-direction.degreesToRadians))
}

@Sarang这里是一个解决方法.编码愉快.

@Sarang here is a work around. Happy coding.