mirror of
https://github.com/FBukovina/Atoll.git
synced 2026-10-27 15:14:33 +00:00
Update DynamicIsland Configuration
This commit is contained in:
parent
ddda04369d
commit
b900804acb
8 changed files with 333 additions and 11 deletions
50
DynamicIsland/components/Notch/DynamicIslandPillShape.swift
Normal file
50
DynamicIsland/components/Notch/DynamicIslandPillShape.swift
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
/*
|
||||
* Atoll (DynamicIsland)
|
||||
* Copyright (C) 2024-2026 Atoll Contributors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
import SwiftUI
|
||||
|
||||
/// A pill-shaped (capsule-like) clip shape used for the Dynamic Island mode
|
||||
/// on external and non-notched displays. Uses `.continuous` rounded corners
|
||||
/// for an Apple-style squircle appearance, inspired by DynamicNotchKit's
|
||||
/// floating style.
|
||||
struct DynamicIslandPillShape: Shape {
|
||||
var cornerRadius: CGFloat
|
||||
|
||||
var animatableData: CGFloat {
|
||||
get { cornerRadius }
|
||||
set { cornerRadius = newValue }
|
||||
}
|
||||
|
||||
func path(in rect: CGRect) -> Path {
|
||||
let resolvedRadius = min(cornerRadius, min(rect.width, rect.height) / 2)
|
||||
return Path(roundedRect: rect, cornerRadius: resolvedRadius, style: .continuous)
|
||||
}
|
||||
}
|
||||
|
||||
#Preview {
|
||||
VStack(spacing: 20) {
|
||||
DynamicIslandPillShape(cornerRadius: 16)
|
||||
.fill(.black)
|
||||
.frame(width: 185, height: 32)
|
||||
|
||||
DynamicIslandPillShape(cornerRadius: 24)
|
||||
.fill(.black)
|
||||
.frame(width: 640, height: 200)
|
||||
}
|
||||
.padding(20)
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue