From 54c697dd9d165f3d024075cbf728d27de6a7e232 Mon Sep 17 00:00:00 2001 From: "Hedden, Kyle Matthew" Date: Thu, 23 May 2024 16:18:46 -0400 Subject: [PATCH] Digital PCT265 story PCT-135: Carousel item clipping VDS conditional approach. --- MVMCoreUI/Atomic/Atoms/Views/TileContainer.swift | 4 ++++ MVMCoreUI/Atomic/Atoms/Views/Tilelet.swift | 10 ++++++++++ MVMCoreUI/Atomic/Molecules/Items/CarouselItem.swift | 5 ++++- .../OtherHandlers/MVMCoreUIViewConstrainingProtocol.h | 2 ++ 4 files changed, 20 insertions(+), 1 deletion(-) diff --git a/MVMCoreUI/Atomic/Atoms/Views/TileContainer.swift b/MVMCoreUI/Atomic/Atoms/Views/TileContainer.swift index e00c2784..6296f640 100644 --- a/MVMCoreUI/Atomic/Atoms/Views/TileContainer.swift +++ b/MVMCoreUI/Atomic/Atoms/Views/TileContainer.swift @@ -136,4 +136,8 @@ open class TileContainer: VDS.TileContainer, VDSMoleculeViewProtocol{ extension TileContainer: MVMCoreUIViewConstrainingProtocol { public func horizontalAlignment() -> UIStackView.Alignment { .leading } + + public func isClippable() -> Bool { + return false + } } diff --git a/MVMCoreUI/Atomic/Atoms/Views/Tilelet.swift b/MVMCoreUI/Atomic/Atoms/Views/Tilelet.swift index 58a91de5..8ed4fd55 100644 --- a/MVMCoreUI/Atomic/Atoms/Views/Tilelet.swift +++ b/MVMCoreUI/Atomic/Atoms/Views/Tilelet.swift @@ -134,3 +134,13 @@ open class Tilelet: VDS.Tilelet, VDSMoleculeViewProtocol{ } } } + +extension Tilelet: MVMCoreUIViewConstrainingProtocol { + + // Investigate later. + //public func horizontalAlignment() -> UIStackView.Alignment { .leading } + + public func isClippable() -> Bool { + return false + } +} diff --git a/MVMCoreUI/Atomic/Molecules/Items/CarouselItem.swift b/MVMCoreUI/Atomic/Molecules/Items/CarouselItem.swift index 9e9e0bc2..5350e71c 100644 --- a/MVMCoreUI/Atomic/Molecules/Items/CarouselItem.swift +++ b/MVMCoreUI/Atomic/Molecules/Items/CarouselItem.swift @@ -7,6 +7,7 @@ // import Foundation +import VDS open class CarouselItem: MoleculeCollectionViewCell, CarouselItemProtocol { @@ -17,12 +18,14 @@ open class CarouselItem: MoleculeCollectionViewCell, CarouselItemProtocol { open override func addMolecule(_ molecule: MoleculeViewProtocol) { super.addMolecule(molecule) + + clipsToBounds = (molecule as? MVMCoreUIViewConstrainingProtocol)?.isClippable?() ?? true + contentView.sendSubviewToBack(molecule) } open override func setupView() { super.setupView() - clipsToBounds = true // Needed for container view corner rounding of subviews. // Covers the card when peaking. peakingCover.backgroundColor = .white diff --git a/MVMCoreUI/OtherHandlers/MVMCoreUIViewConstrainingProtocol.h b/MVMCoreUI/OtherHandlers/MVMCoreUIViewConstrainingProtocol.h index 12aaacdb..c4680824 100644 --- a/MVMCoreUI/OtherHandlers/MVMCoreUIViewConstrainingProtocol.h +++ b/MVMCoreUI/OtherHandlers/MVMCoreUIViewConstrainingProtocol.h @@ -37,4 +37,6 @@ /// Containing Views can tell the contained if they should use vertical margins. - (void)shouldSetVerticalMargins:(BOOL)shouldSet; +- (BOOL)isClippable; + @end