Merge branch 'bugfix/page_control_visibility' into 'develop'

Correcting layout issue

See merge request BPHV_MIPS/mvm_core_ui!424
This commit is contained in:
Pfeil, Scott Robert 2020-05-07 15:49:49 -04:00
commit 1d2465d345
4 changed files with 14 additions and 17 deletions

View File

@ -134,6 +134,7 @@ open class BarsIndicatorView: CarouselIndicator {
public override func assessTouchOf(_ touchPoint_X: CGFloat) {
currentIndex = barReferences.firstIndex { $0.0.frame.maxX >= touchPoint_X && $0.0.frame.minX <= touchPoint_X } ?? 0
performAction()
}
open override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {

View File

@ -48,13 +48,10 @@ open class CarouselIndicator: Control, CarouselPageControlProtocol {
previousIndex = currentIndex
carouselIndicatorModel?.currentIndex = newIndex
if previousIndex != newIndex {
updateUI(previousIndex: previousIndex,
newIndex: newIndex,
totalCount: numberOfPages,
isAnimated: carouselIndicatorModel?.animated ?? true)
performAction()
}
updateUI(previousIndex: previousIndex,
newIndex: newIndex,
totalCount: numberOfPages,
isAnimated: carouselIndicatorModel?.animated ?? true)
}
}
@ -141,11 +138,13 @@ open class CarouselIndicator: Control, CarouselPageControlProtocol {
func incrementCurrentIndex() {
currentIndex = (currentIndex + 1) % numberOfPages
performAction()
}
func decrementCurrentIndex() {
let newIndex = currentIndex - 1
currentIndex = newIndex < 0 ? numberOfPages - 1 : newIndex
performAction()
}
/// Increments the currentIndex value.

View File

@ -26,10 +26,8 @@ open class Carousel: View {
/// The index of the page, does not include dummy cells.
public var pageIndex: Int {
get {
return loop ? currentIndex - 2 : currentIndex
}
set(newIndex) {
get { return loop ? currentIndex - 2 : currentIndex }
set (newIndex) {
currentIndex = loop ? newIndex + 2 : newIndex
}
}
@ -90,6 +88,7 @@ open class Carousel: View {
}
}
//--------------------------------------------------
// MARK: - MVMCoreViewProtocol
//--------------------------------------------------
@ -194,7 +193,7 @@ open class Carousel: View {
pagingView = MoleculeObjectMapping.shared()?.createMolecule(molecule, delegateObject: delegateObject) as? (UIView & CarouselPageControlProtocol)
}
addPaging(view: pagingView , position: (CGFloat(molecule?.position ?? 20)))
addPaging(view: pagingView, position: (CGFloat(molecule?.position ?? 20)))
}
/// Registers the cells with the collection view
@ -213,9 +212,7 @@ open class Carousel: View {
/// Returns the (identifier, class) of the molecule for the given map.
func getMoleculeInfo(with molecule: MoleculeModelProtocol, delegateObject: MVMCoreUIDelegateObject?) -> (identifier: String, class: AnyClass, molecule: MoleculeModelProtocol)? {
guard let className = MoleculeObjectMapping.shared()?.getMoleculeClass(molecule) else {
return nil
}
guard let className = MoleculeObjectMapping.shared()?.getMoleculeClass(molecule) else { return nil }
return (className.nameForReuse(with: molecule, delegateObject) ?? molecule.moleculeName, className, molecule)
}

View File

@ -45,8 +45,8 @@ extension MoleculeViewProtocol {
}
// Do nothing, optionals.
public func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {}
public func reset() {}
public func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) { }
public func reset() { }
public static func estimatedHeight(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? {
return nil