Closed jkomoros closed 7 years ago
The collection should take a stack and optionally print out all of the elements themselves (but how would you pass the element to use for front of card?)
collection takes the stack, each card takes the expanded component
There's a global animation coordinator element that all of the boardgame-card-collections work with. The game-view is responsible for creating it; all other boardgame-card-collections know that it exists because someone else created it.
Before setting the state, the coordinator calls Prepare(), then does databinding, then calls Animate().
When Prepare() is called, we go through each boardgame-card-collection, find all cards with Ids in it, and keep track of their:
Then the databinding happens, then animate() is called. We then basically do exactly the same thing as before, but setting transforms to unflip them all and animating to new locations--all via transforms.
If the boardgame-card-collection the card went to doesn't have an actual card, we create a stub to animate fade out and scale down as it flies, and when the animation is done we delete it.
At all times, be caerful that only one layout is done after databinding is done, so all of the many getClientBoundingRects only cause a single layout
Part of the problem we're having is that there are a lot of state transitions, and at each one we are measuring and setting transformations. In the memory case it's replacing a real animation with what is effectively a no-op animation.
Part of the problem is that to get the right getClientBoundingRect, we ahve to turn off transformations of the element to measure (thus breaking the animation), so even if we don't need to do a transformation in the end we've already messed with it.
There are two possible fixes:
1) Cards and components don't have any rotations applied (for example messy); that would be applied to the
I think the second option is probably preferable, because I can imagine a lot of cases where the rotation really should be on the element itself. Also, we only need to walk up until we find the offsetParent they both share (but wait, we won't know that until after the animate() at which point the info is gone...)
We've now moved all of the remaining tasks to other bugs, so this is done!
Card collection views handle animations.
Cards have a unique ID that is used by the collection to keep track of which one's which.
The render-view has a direct child of. Call Mark() right before databinding to capture a snapshot of where cards are, then Animate() right after databinding is (synchronously) done. Will go through and find all collections rooted below, and note where differences are and animate. (How do we get spacers in to animate? maybe just use margin-right on the card to the left, with no element in between)
Related to #347
TODO: figure out how to handle cards that transition from face down to face up