Skip to content

Commit

Permalink
1
Browse files Browse the repository at this point in the history
  • Loading branch information
FulcrumOne committed Nov 7, 2024
1 parent a763d3b commit e563efe
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 21 deletions.
15 changes: 6 additions & 9 deletions Sources/Internal/View Models/ViewModel+CentreStack.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,6 @@ extension VM { class CentreStack: ViewModel {
// MARK: Overridden Methods
override func recalculatePopupHeight(_ heightCandidate: CGFloat, _ popup: AnyPopup) async -> CGFloat { await recalculatePopupHeight(heightCandidate) }
override func calculateHeightForActivePopup() -> CGFloat? { _calculateHeightForActivePopup() }
override func calculatePopupPadding() -> EdgeInsets { _calculatePopupPadding() }
override func calculateCornerRadius() -> [PopupAlignment : CGFloat] { _calculateCornerRadius() }
override func calculateVerticalFixedSize(for popup: AnyPopup) -> Bool { _calculateVerticalFixedSize(for: popup) }
}}


Expand All @@ -41,8 +38,8 @@ private extension VM.CentreStack {
}

// MARK: Popup Padding
private extension VM.CentreStack {
func _calculatePopupPadding() -> EdgeInsets { .init(
extension VM.CentreStack {
func calculatePopupPadding() -> EdgeInsets { .init(
top: calculateVerticalPopupPadding(for: .top),
leading: calculateLeadingPopupPadding(),
bottom: calculateVerticalPopupPadding(for: .bottom),
Expand All @@ -68,8 +65,8 @@ private extension VM.CentreStack {
}

// MARK: Corner Radius
private extension VM.CentreStack {
func _calculateCornerRadius() -> [PopupAlignment : CGFloat] {[
extension VM.CentreStack {
func calculateCornerRadius() -> [PopupAlignment : CGFloat] {[
.top: getActivePopupConfig().cornerRadius,
.bottom: getActivePopupConfig().cornerRadius
]}
Expand All @@ -83,8 +80,8 @@ extension VM.CentreStack {
}

// MARK: Fixed Size
private extension VM.CentreStack {
func _calculateVerticalFixedSize(for popup: AnyPopup) -> Bool {
extension VM.CentreStack {
func calculateVerticalFixedSize(for popup: AnyPopup) -> Bool {
activePopupHeight != calculateLargeScreenHeight()
}
}
Expand Down
15 changes: 6 additions & 9 deletions Sources/Internal/View Models/ViewModel+VerticalStack.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,6 @@ extension VM { class VerticalStack: ViewModel {
// MARK: Overridden Methods
override func recalculatePopupHeight(_ heightCandidate: CGFloat, _ popup: AnyPopup) async -> CGFloat { await _recalculatePopupHeight(heightCandidate, popup) }
override func calculateHeightForActivePopup() -> CGFloat? { _calculateHeightForActivePopup() }
override func calculatePopupPadding() -> EdgeInsets { _calculatePopupPadding() }
override func calculateCornerRadius() -> [PopupAlignment : CGFloat] { _calculateCornerRadius() }
override func calculateVerticalFixedSize(for popup: AnyPopup) -> Bool { _calculateVerticalFixedSize(for: popup) }
}}


Expand Down Expand Up @@ -84,8 +81,8 @@ private extension VM.VerticalStack {
}

// MARK: Popup Padding
private extension VM.VerticalStack {
func _calculatePopupPadding() -> EdgeInsets { .init(
extension VM.VerticalStack {
func calculatePopupPadding() -> EdgeInsets { .init(
top: calculateVerticalPopupPadding(for: .top),
leading: calculateLeadingPopupPadding(),
bottom: calculateVerticalPopupPadding(for: .bottom),
Expand Down Expand Up @@ -213,8 +210,8 @@ private extension VM.VerticalStack {
}

// MARK: Corner Radius
private extension VM.VerticalStack {
func _calculateCornerRadius() -> [PopupAlignment: CGFloat] {
extension VM.VerticalStack {
func calculateCornerRadius() -> [PopupAlignment: CGFloat] {
let cornerRadiusValue = calculateCornerRadiusValue(getActivePopupConfig())
return [
.top: calculateTopCornerRadius(cornerRadiusValue),
Expand All @@ -240,8 +237,8 @@ private extension VM.VerticalStack {
}

// MARK: Fixed Size
private extension VM.VerticalStack {
func _calculateVerticalFixedSize(for popup: AnyPopup) -> Bool { switch popup.config.heightMode {
extension VM.VerticalStack {
func calculateVerticalFixedSize(for popup: AnyPopup) -> Bool { switch popup.config.heightMode {
case .fullscreen, .large: false
case .auto: activePopupHeight != calculateLargeScreenHeight()
}}
Expand Down
3 changes: 0 additions & 3 deletions Sources/Internal/View Models/ViewModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,6 @@ enum VM {}
// MARK: Methods to Override
nonisolated func recalculatePopupHeight(_ heightCandidate: CGFloat, _ popup: AnyPopup) async -> CGFloat { fatalError() }
func calculateHeightForActivePopup() -> CGFloat? { fatalError() }
func calculatePopupPadding() -> EdgeInsets { fatalError() }
func calculateCornerRadius() -> [PopupAlignment: CGFloat] { fatalError() }
func calculateVerticalFixedSize(for popup: AnyPopup) -> Bool { fatalError() }

// MARK: Initializer
init<Config: LocalConfig>(_ config: Config.Type) { self.alignment = .init(Config.self) }
Expand Down

0 comments on commit e563efe

Please sign in to comment.