Commit 05763bee authored by Oliver Wiese's avatar Oliver Wiese

add roundedCorners

parent 98d14226
......@@ -154,6 +154,7 @@
47C8225B24379EAE005BCE73 /* MessageViewMain.swift in Sources */ = {isa = PBXBuildFile; fileRef = 47C8224E24379EAE005BCE73 /* MessageViewMain.swift */; };
47C8225D24379EAE005BCE73 /* ReadViewCoordinator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 47C8225124379EAE005BCE73 /* ReadViewCoordinator.swift */; };
47C8225E24379EAE005BCE73 /* ReadMainView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 47C8225224379EAE005BCE73 /* ReadMainView.swift */; };
47C822602437A143005BCE73 /* CornerRounder.swift in Sources */ = {isa = PBXBuildFile; fileRef = 47C8225F2437A143005BCE73 /* CornerRounder.swift */; };
47CD5AAA2012368D00E771A1 /* logging_pk.asc in Resources */ = {isa = PBXBuildFile; fileRef = 47CD5AA82012368D00E771A1 /* logging_pk.asc */; };
47CD5AAD2012369400E771A1 /* support_pk2.asc in Resources */ = {isa = PBXBuildFile; fileRef = 47CD5AAC2012369300E771A1 /* support_pk2.asc */; };
47CEAC98222541B40075B7DC /* MailSession.swift in Sources */ = {isa = PBXBuildFile; fileRef = 47CEAC97222541B40075B7DC /* MailSession.swift */; };
......@@ -597,6 +598,7 @@
47C8224E24379EAE005BCE73 /* MessageViewMain.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MessageViewMain.swift; sourceTree = "<group>"; };
47C8225124379EAE005BCE73 /* ReadViewCoordinator.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ReadViewCoordinator.swift; sourceTree = "<group>"; };
47C8225224379EAE005BCE73 /* ReadMainView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ReadMainView.swift; sourceTree = "<group>"; };
47C8225F2437A143005BCE73 /* CornerRounder.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CornerRounder.swift; sourceTree = "<group>"; };
47CD5AA82012368D00E771A1 /* logging_pk.asc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = logging_pk.asc; path = keys/logging_pk.asc; sourceTree = "<group>"; };
47CD5AAC2012369300E771A1 /* support_pk2.asc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = support_pk2.asc; path = keys/support_pk2.asc; sourceTree = "<group>"; };
47CEAC97222541B40075B7DC /* MailSession.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MailSession.swift; sourceTree = "<group>"; };
......@@ -1136,6 +1138,7 @@
476406932416B54D00C7D426 /* Geometry */ = {
isa = PBXGroup;
children = (
47C8225F2437A143005BCE73 /* CornerRounder.swift */,
476406942416B54D00C7D426 /* Stroke.swift */,
);
path = Geometry;
......@@ -2225,6 +2228,7 @@
4751C7002344D37C006B2A4D /* SecretKey+CoreDataClass.swift in Sources */,
A1AEBA5921E808CB00C84E59 /* IntroYesNoViewController.swift in Sources */,
A1EB05941D956931008659C1 /* InboxCellDelegator.swift in Sources */,
47C822602437A143005BCE73 /* CornerRounder.swift in Sources */,
8428A85D1F436A05007649A5 /* Badges.swift in Sources */,
971D404A2428C87E002FCD31 /* BadgeCaseView.swift in Sources */,
47C8225B24379EAE005BCE73 /* MessageViewMain.swift in Sources */,
......
//
// CornerRounder.swift
// enzevalos_iphone
//
// Created by hanneh00 on 18.03.20.
// Copyright © 2020 fu-berlin. All rights reserved.
//
import SwiftUI
struct RoundedCorners: View {
var color: Color = .blue
var tl: CGFloat = 0.0
var tr: CGFloat = 0.0
var bl: CGFloat = 0.0
var br: CGFloat = 0.0
var body: some View {
GeometryReader { geometry in
Path { path in
let w = geometry.size.width
let h = geometry.size.height
// Make sure we do not exceed the size of the rectangle
let tr = min(min(self.tr, h/2), w/2)
let tl = min(min(self.tl, h/2), w/2)
let bl = min(min(self.bl, h/2), w/2)
let br = min(min(self.br, h/2), w/2)
path.move(to: CGPoint(x: w / 2.0, y: 0))
path.addLine(to: CGPoint(x: w - tr, y: 0))
path.addArc(center: CGPoint(x: w - tr, y: tr), radius: tr, startAngle: Angle(degrees: -90), endAngle: Angle(degrees: 0), clockwise: false)
path.addLine(to: CGPoint(x: w, y: h - br))
path.addArc(center: CGPoint(x: w - br, y: h - br), radius: br, startAngle: Angle(degrees: 0), endAngle: Angle(degrees: 90), clockwise: false)
path.addLine(to: CGPoint(x: bl, y: h))
path.addArc(center: CGPoint(x: bl, y: h - bl), radius: bl, startAngle: Angle(degrees: 90), endAngle: Angle(degrees: 180), clockwise: false)
path.addLine(to: CGPoint(x: 0, y: tl))
path.addArc(center: CGPoint(x: tl, y: tl), radius: tl, startAngle: Angle(degrees: 180), endAngle: Angle(degrees: 270), clockwise: false)
}
.fill(self.color)
}
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment