Skip to content

Commit

Permalink
Feature/mapsios 271 puck 3d default scale (#1523) (#1531)
Browse files Browse the repository at this point in the history
* Apply mercator scale to puck 3D also when its modelScale is not set.
- When a modelScale is not set, assume it is [1,1,1] (real size) and apply mercator scale for it.
  • Loading branch information
maios authored and yunikkk committed Aug 24, 2022
1 parent 85a458c commit cc665ad
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ Mapbox welcomes participation and contributions from everyone.

## main

* Apply mercator scale to 3D puck also when its `modelScale` is not specified. ([#1523](https://github.com/mapbox/mapbox-maps-ios/pull/1523))

## 10.8.0-beta.1 - August 11, 2022

* Expose image property for compass ornament. ([#1468](https://github.com/mapbox/mapbox-maps-ios/pull/1468))
Expand Down
4 changes: 2 additions & 2 deletions Sources/MapboxMaps/Location/Puck/Puck3D.swift
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ internal final class Puck3D: Puck {
}

private var modelScale: Value<[Double]>? {
switch configuration.modelScale {
switch configuration.modelScale ?? .constant([1, 1, 1]) {
case .constant(let scales):
let maxZoom = 22.0
let minZoom = 0.5
Expand All @@ -159,7 +159,7 @@ internal final class Puck3D: Puck {
}
)

default: return configuration.modelScale
case .expression: return configuration.modelScale
}
}
}
2 changes: 1 addition & 1 deletion Tests/MapboxMapsTests/Location/Puck/Puck3DTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ final class Puck3DTests: XCTestCase {

func testDefaultModelScale() throws {
let stubbedModelScale = 1.0
configuration.modelScale = .constant([stubbedModelScale, stubbedModelScale, stubbedModelScale])
configuration.modelScale = .random(.constant([stubbedModelScale, stubbedModelScale, stubbedModelScale]))

recreatePuck()

Expand Down

0 comments on commit cc665ad

Please sign in to comment.