Skip to content

Commit

Permalink
Merge pull request #2 from dydxprotocol/mike/trcl-3095-orderbook-asks…
Browse files Browse the repository at this point in the history
…-lost-the-animation

TRCL-3095 : Orderbook asks lost the animation
  • Loading branch information
ruixhuang authored Nov 6, 2023
2 parents 497ca6a + 28e5812 commit 6bbae21
Showing 1 changed file with 10 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -96,34 +96,19 @@ public class dydxOrderbookSideViewModel: PlatformViewModel, Equatable {
let additionalLineHeight: CGFloat = intendedLineHeight * (numLinesToDisplayExact.truncatingRemainder(dividingBy: 1)) / numLinesToDisplayFloored
let actualLineHeight: CGFloat = intendedLineHeight + additionalLineHeight

switch self.displayStyle {
case .sideBySide:
LazyVStack(spacing: spacing) {

LazyVStack(spacing: spacing) {

ForEach(lines.prefix(numLinesToDisplayInt), id: \.self.id) { line in
AnyView(
self.cell(line: line, maxDepth: maxDepth, fixedHeight: actualLineHeight)
)
.id(line.id)
}

Spacer()
ForEach(lines.prefix(numLinesToDisplayInt), id: \.self.id) { line in
AnyView(
self.cell(line: line, maxDepth: maxDepth, fixedHeight: actualLineHeight)
)
.id(line.id)
}
.topAligned()

case .topDown:
LazyVStack(spacing: spacing) {
ForEach(lines.prefix(numLinesToDisplayInt), id: \.self.id) { line in
AnyView(
self.cell(line: line, maxDepth: maxDepth, fixedHeight: actualLineHeight)
)
.id(line.id)
}
Spacer()
}
.topAligned()

Spacer()
}
.animation(.default, value: lines) // Here the animation is applied to the LazyVStack
.topAligned()
}
}
}
Expand Down

0 comments on commit 6bbae21

Please sign in to comment.