Digital ACT-191 ONEAPP-7013 story: Standard Peek supported for all Tablet viewports and layouts and for 1up layouts on Mobile viewports only.
This commit is contained in:
parent
6f5e94887e
commit
f13451ea37
@ -358,10 +358,34 @@ open class Carousel: View {
|
||||
if UIDevice.isIPad && peek == .minimum {
|
||||
peek = .standard
|
||||
}
|
||||
|
||||
// Standard(Default) Peek - Supported for all Tablet viewports and layouts. Supported only for 1up layouts on Mobile viewports.
|
||||
if peek == .standard && !UIDevice.isIPad && layout != CarouselScrollbar.Layout.oneUP {
|
||||
peek = .minimum
|
||||
}
|
||||
|
||||
updatePaginationControls()
|
||||
getSlotWidth()
|
||||
|
||||
addCarouselSlots()
|
||||
}
|
||||
|
||||
open override func reset() {
|
||||
super.reset()
|
||||
shouldUpdateView = false
|
||||
aspectRatio = .none
|
||||
layout = UIDevice.isIPad ? .threeUP : .oneUP
|
||||
pagination = .init(kind: .lowContrast, floating: true)
|
||||
paginationDisplay = .none
|
||||
paginationInset = UIDevice.isIPad ? VDSLayout.space3X : VDSLayout.space2X
|
||||
gutter = UIDevice.isIPad ? .twentyFourPX : .twelvePX
|
||||
peek = .standard
|
||||
width = nil
|
||||
}
|
||||
|
||||
//--------------------------------------------------
|
||||
// MARK: - Private Methods
|
||||
//--------------------------------------------------
|
||||
private func addCarouselSlots() {
|
||||
if containerView.frame.size.width > 0 {
|
||||
containerViewHeightConstraint?.isActive = false
|
||||
containerStackHeightConstraint?.isActive = false
|
||||
@ -408,22 +432,6 @@ open class Carousel: View {
|
||||
}
|
||||
}
|
||||
|
||||
open override func reset() {
|
||||
super.reset()
|
||||
shouldUpdateView = false
|
||||
aspectRatio = .none
|
||||
layout = UIDevice.isIPad ? .threeUP : .oneUP
|
||||
pagination = .init(kind: .lowContrast, floating: true)
|
||||
paginationDisplay = .none
|
||||
paginationInset = UIDevice.isIPad ? VDSLayout.space3X : VDSLayout.space2X
|
||||
gutter = UIDevice.isIPad ? .twentyFourPX : .twelvePX
|
||||
peek = .standard
|
||||
width = nil
|
||||
}
|
||||
|
||||
//--------------------------------------------------
|
||||
// MARK: - Private Methods
|
||||
//--------------------------------------------------
|
||||
private func ratioSize(for width: CGFloat) -> CGSize {
|
||||
var height: CGFloat = width
|
||||
|
||||
@ -543,10 +551,10 @@ open class Carousel: View {
|
||||
|
||||
func updateScrollPosition(position: Int, callbackText: String) {
|
||||
if carouselScrollBar.numberOfSlides > 0 {
|
||||
let contentOffsetWidth = scrollView.contentSize.width
|
||||
let scrollContentSizeWidth = scrollView.contentSize.width
|
||||
let totalPositions = totalPositions()
|
||||
let multiplier: Float = (position == 1) ? 0 : Float((position)-1) / Float(totalPositions)
|
||||
let xPos = (position == totalPositions) ? (contentOffsetWidth - containerView.frame.size.width) : CGFloat(Float(contentOffsetWidth) * multiplier)
|
||||
let xPos = (position == totalPositions) ? (scrollContentSizeWidth - containerView.frame.size.width) : CGFloat(Float(scrollContentSizeWidth) * multiplier)
|
||||
carouselScrollBar.scrubberId = position
|
||||
let yPos = scrollView.contentOffset.y
|
||||
scrollView.setContentOffset(CGPoint(x: xPos, y: yPos), animated: true)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user