Skip to content

Commit

Permalink
Add Rocket annotation graphic and transition it over the snapshot image.
Browse files Browse the repository at this point in the history
  • Loading branch information
CypherPoet authored and CypherPoet committed Jan 30, 2020
1 parent 85b7673 commit d26ac2b
Show file tree
Hide file tree
Showing 20 changed files with 1,202 additions and 19 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
{
"images" : [
{
"idiom" : "universal",
"filename" : "RocketLightMode.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "RocketLightMode-1.png",
"appearances" : [
{
"appearance" : "luminosity",
"value" : "light"
}
],
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "RocketDarkMode.png",
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "RocketLightMode@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "RocketLightMode@2x-1.png",
"appearances" : [
{
"appearance" : "luminosity",
"value" : "light"
}
],
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "RocketDarkMode@2x.png",
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "RocketLightMode@3x.png",
"scale" : "3x"
},
{
"idiom" : "universal",
"filename" : "RocketLightMode@3x-1.png",
"appearances" : [
{
"appearance" : "luminosity",
"value" : "light"
}
],
"scale" : "3x"
},
{
"idiom" : "universal",
"filename" : "RocketDarkMode@3x.png",
"appearances" : [
{
"appearance" : "luminosity",
"value" : "dark"
}
],
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ extension MapSnapshotServicing {
func takeSnapshot(
with size: CGSize,
at coordinate: CLLocationCoordinate2D,
latitudeSpan: CLLocationDegrees = 0.15,
longitudeSpan: CLLocationDegrees = 0.15
latitudeSpan: CLLocationDegrees = 1.75,
longitudeSpan: CLLocationDegrees = 1.75
) -> Future<MKMapSnapshotter.Snapshot, Error> {
let span = MKCoordinateSpan(latitudeDelta: latitudeSpan, longitudeDelta: longitudeSpan)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import CypherPoetSwiftUIKit


struct PadDetailsView {
@Environment(\.horizontalSizeClass) var horizontalSizeClass
@ObservedObject var viewModel: ViewModel

var onFavoriteToggled: ((Pad) -> Void)?
Expand All @@ -23,31 +24,35 @@ extension PadDetailsView: View {

var body: some View {
GeometryReader { geometry in
List {
VStack {
if self.viewModel.mapSnapshotImage != nil {
Image(uiImage: self.viewModel.mapSnapshotImage!)
.resizable()
.scaledToFit()
.listRowInsets(.init(top: 0, leading: 0, bottom: 0, trailing: 0))
self.snapshotImageSection
.transition(
AnyTransition
.move(edge: .bottom)
.animation(Animation.easeOut(duration: 0.5))
)
}

self.coordinateHeader
.padding(.vertical)

if self.viewModel.webLinkData.isEmpty == false {
self.linksSection

List {
self.coordinateHeader
.padding(.vertical)

if self.viewModel.webLinkData.isEmpty == false {
self.linksSection
}

self.optionsSection
}

self.optionsSection
}
.embedInScrollView(axes: .vertical)
}
.embedInScrollView(axes: .vertical)
.navigationBarTitle(Text(viewModel.padNameText), displayMode: .inline)
.onAppear {
self.viewModel.takeMapSnapshot(
size: CGSize(
width: UIScreen.main.bounds.width,
height: UIScreen.main.bounds.width * 0.75
height: UIScreen.main.bounds.height * self.snapshotHeightRatio
)
)
}
Expand All @@ -57,12 +62,34 @@ extension PadDetailsView: View {

// MARK: - Computeds
extension PadDetailsView {

var snapshotHeightRatio: CGFloat {
horizontalSizeClass == .compact ? 0.35 : 0.60
}
}


// MARK: - View Variables
extension PadDetailsView {

private var snapshotImageSection: some View {
ZStack {
Image(uiImage: self.viewModel.mapSnapshotImage!)
.resizable()
.scaledToFit()
.zIndex(0)

Image("RocketAnnotation")
.resizable()
.scaledToFit()
.frame(width: 80, height: 80)
.offset(x: 0, y: -40)
.transition(.move(edge: .bottom))
.animation(Animation.spring().delay(0.3))
.zIndex(1)
}
}

private var coordinateHeader: some View {
HStack(spacing: 12) {
Spacer()
Expand All @@ -74,10 +101,10 @@ extension PadDetailsView {
.clipShape(Circle())

Group {
Text("Lat: ").fontWeight(.bold)
Text("Latitude: ").fontWeight(.bold)
+ Text(self.viewModel.latitudeText)

Text("Lon: ").fontWeight(.bold)
Text("Longitude: ").fontWeight(.bold)
+ Text(self.viewModel.longitudeText)
}
.embedInCompactableStack()
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit d26ac2b

Please sign in to comment.