Removing bars indicator animation
Removing dispatch to main thread during initial template load
This commit is contained in:
parent
e0caceaf61
commit
012d677b0f
@ -123,6 +123,7 @@ open class BarsIndicatorView: CarouselIndicator {
|
||||
bottomAnchor.constraint(equalTo: stackView.bottomAnchor),
|
||||
trailingAnchor.constraint(equalTo: stackView.trailingAnchor)
|
||||
])
|
||||
bounds = CGRectMake(0, 0, 100, Padding.One)
|
||||
}
|
||||
|
||||
//--------------------------------------------------
|
||||
@ -262,17 +263,12 @@ open class BarsIndicatorView: CarouselIndicator {
|
||||
refreshAccessibilityLabels()
|
||||
}
|
||||
|
||||
let expression = { [self] in
|
||||
barReferences[previousIndex].backgroundColor = isEnabled ? indicatorColor : disabledIndicatorColor
|
||||
barReferences[previousIndex].constraint?.constant = IndicatorBar.unselectedHeight
|
||||
barReferences[previousIndex].layer.cornerRadius = IndicatorBar.unselectedCornerRadius
|
||||
barReferences[newIndex].backgroundColor = isEnabled ? currentIndicatorColor : disabledIndicatorColor
|
||||
barReferences[newIndex].constraint?.constant = IndicatorBar.selectedHeight
|
||||
barReferences[newIndex].layer.cornerRadius = IndicatorBar.selectedCornerRadius
|
||||
layoutIfNeeded()
|
||||
}
|
||||
|
||||
// Perform the animation.
|
||||
isAnimated ? UIView.animate(withDuration: 0.25) { expression() } : expression()
|
||||
barReferences[previousIndex].backgroundColor = isEnabled ? indicatorColor : disabledIndicatorColor
|
||||
barReferences[previousIndex].constraint?.constant = IndicatorBar.unselectedHeight
|
||||
barReferences[previousIndex].layer.cornerRadius = IndicatorBar.unselectedCornerRadius
|
||||
barReferences[newIndex].backgroundColor = isEnabled ? currentIndicatorColor : disabledIndicatorColor
|
||||
barReferences[newIndex].constraint?.constant = IndicatorBar.selectedHeight
|
||||
barReferences[newIndex].layer.cornerRadius = IndicatorBar.selectedCornerRadius
|
||||
layoutIfNeeded()
|
||||
}
|
||||
}
|
||||
|
||||
@ -264,7 +264,7 @@ import MVMCore
|
||||
self.pageModel = newPageModel
|
||||
|
||||
// Run through the differences between separate page model trees.
|
||||
var pageUpdatedModels = [MoleculeModelProtocol]()
|
||||
//var pageUpdatedModels = [MoleculeModelProtocol]()
|
||||
if let originalModel, // We had a prior.
|
||||
let newPageModel = newPageModel as? TemplateModelProtocol,
|
||||
originalModel.id != newPageModel.id {
|
||||
@ -279,17 +279,13 @@ import MVMCore
|
||||
// Notify the manager of new data.
|
||||
// Warning: Some flows cause table reloads. Until the UI update is decoupled, should be after the updateUI.
|
||||
manager?.newDataReceived?(in: self)
|
||||
|
||||
// Dispatch to decouple execution. First massage data through template classes, then render.
|
||||
Task { @MainActor in
|
||||
|
||||
if allUpdatedMolecules.isEmpty || isFirstRender {
|
||||
debugLog("Performing full page render...")
|
||||
updateUI()
|
||||
} else {
|
||||
debugLog("Performing partial render of \(allUpdatedMolecules) molecules...")
|
||||
updateUI(for: allUpdatedMolecules)
|
||||
}
|
||||
|
||||
if allUpdatedMolecules.isEmpty || isFirstRender {
|
||||
debugLog("Performing full page render...")
|
||||
updateUI()
|
||||
} else {
|
||||
debugLog("Performing partial render of \(allUpdatedMolecules) molecules...")
|
||||
updateUI(for: allUpdatedMolecules)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user