diff --git a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/Miscellaneous/ListStoreLocator.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/Miscellaneous/ListStoreLocator.swift index 6f94dd13..6c1e65e5 100644 --- a/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/Miscellaneous/ListStoreLocator.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/Miscellaneous/ListStoreLocator.swift @@ -19,6 +19,7 @@ import Foundation public let leftSubBody = Label(fontStyle: .RegularBodySmall) public let rightLabel = Label(fontStyle: .BoldBodySmall) public var horizontalStack: Stack + private let rightLabelStackItem: StackItem public var stack: Stack public var sizeObject: MFSizeObject? = MFSizeObject(standardSize: 12, standardiPadPortraitSize: 18) @@ -28,8 +29,14 @@ import Foundation //------------------------------------------------------ public override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { + let horizontalStackModel = StackModel(molecules: [StackItemModel(horizontalAlignment: .fill), + StackItemModel(horizontalAlignment: .fill), + StackItemModel(horizontalAlignment: .trailing)], + axis: .horizontal, spacing: 8) + rightLabelStackItem = StackItem(andContain: rightLabel) + let horizontalStackItems = [StackItem(andContain: leftHeadline), StackItem(andContain: heart), rightLabelStackItem] //horizontal stack with leftHeadline, heart, rightLabel - horizontalStack = Stack.createStack(with: [(view: leftHeadline, model: StackItemModel(horizontalAlignment: .fill)), (view: heart, model: StackItemModel(horizontalAlignment: .fill)), (view: rightLabel, model: StackItemModel(horizontalAlignment: .trailing))], axis: .horizontal, spacing: 8) + horizontalStack = Stack(with: horizontalStackModel, stackItems: horizontalStackItems) //stack with all components stack = Stack.createStack(with: [horizontalStack, leftBody, leftSubBody], axis: .vertical, spacing: 0) @@ -76,6 +83,16 @@ import Foundation updateAccessibilityLabel() } + open override func alignAccessoryToHero() -> CGPoint? { + let heroCenter = super.alignAccessoryToHero() + + if let heroCenter = heroCenter { + let convertedPoint = horizontalStack.convert(heroCenter, from: self) + rightLabelStackItem.containerHelper.alignCenterVerticalConstraint?.constant = convertedPoint.y - horizontalStack.bounds.midY + } + return heroCenter + } + open override class func estimatedHeight(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? { return 120 }