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