The initial zoom value and final zoom value are 16.8... I checked them. I found something possibly relevant in the documentation for Here Explore:
Any method that modifies the state of the camera will be enqueued and the state will only be updated after drawing the next frame. https://developer.here.com/documentation/ios-sdk-explore/4.11.2.0/api_reference/Classes/MapCamera.html Could this note be related to this situation?
import heresdk
import UIKit
class ViewController: UIViewController {
var mapView : MapView!
override func viewDidLoad() {
super.viewDidLoad()
// Initialize MapView without a storyboard.
mapView = MapView(frame: view.bounds)
view.addSubview(mapView)
// Load the map scene using a map scheme to render the map with.
mapView.mapScene.loadScene(mapScheme: MapScheme.normalDay, completion: onLoadScene)
}
// Completion handler when loading a map scene.
private func onLoadScene(mapError: MapError?) {
guard mapError == nil else {
print("Error: Map scene not loaded, \(String(describing: mapError))")
return
}
// Configure the map.
let camera = mapView.camera
// mapView.mapScene.setLayerVisibility(layerName: MapScene.Layers.landmarks, visibility: VisibilityState.visible)
let coordinates = [GeoCoordinates(latitude: 51, longitude: 10),
GeoCoordinates(latitude: 49, longitude: 13.3946),
GeoCoordinates(latitude: 52.53894, longitude: 13.39194),
GeoCoordinates(latitude: 52.54014, longitude: 13.37958)]
if let box = GeoBox.containing(geoCoordinates: coordinates) {
var cameraUpdate = MapCameraUpdateFactory.lookAt(area: box)
camera.applyUpdate(cameraUpdate)
var zoomLevel = camera.state.zoomLevel
//zoom level must decrease here according to me but it actually increases
camera.zoomTo(zoomLevel: zoomLevel - 3)
var finalzoom = camera.state.zoomLevel
let geoPolyline = try! GeoPolyline(vertices: coordinates)
let lineColor = UIColor(red: 0, green: 0.56, blue: 0.54, alpha: 0.63)
let mapPolyline = MapPolyline(geometry: geoPolyline,
widthInPixels: 30,
color: lineColor)
mapView.mapScene.addMapPolyline(mapPolyline)
}
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
mapView.handleLowMemory()
}
}