Skip to content

Commit

Permalink
Update AlignType+Extension.swift
Browse files Browse the repository at this point in the history
  • Loading branch information
eonist committed Sep 22, 2023
1 parent 0e29cb4 commit 773ad79
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions Sources/Spatial/align/AlignType/AlignType+Extension.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,28 @@ import Foundation
*/
extension AlignType {
/**
* - Fixme: ⚠️️ add doc
*/
* Extension to `AlignType` enum to provide a computed property for the axis type.
* Returns the axis type (horizontal or vertical) based on the alignment type.
*/
public var axis: Axis {
switch self {
// If the alignment is top, bottom, or center vertical, return vertical alignment
case .top, .bottom, .centerVer: return .ver
// If the alignment is left, right, or center horizontal, return horizontal alignment
case .left, .right, .centerHor: return .hor
}
}
/**
* - Fixme: ⚠️️ add doc
*/
* Extension to `AlignType` enum to provide a computed property for the axis type.
* Returns the axis type (start, middle, or end) based on the alignment type.
*/
public var axisType: AxisType {
switch self {
// If the alignment is top or left, return start alignment
case .top, .left: return .start
// If the alignment is center horizontal or center vertical, return middle alignment
case .centerHor, .centerVer: return .middle
// If the alignment is bottom or right, return end alignment
case .bottom, .right: return .end
}
}
Expand Down

0 comments on commit 773ad79

Please # to comment.