ssanjun / react-swing

react-swing is a React component for implementing swing
http://ssanjun.github.io/examples/react-swing/
Other
40 stars 18 forks source link

Multiple card.throwIn doesn't work correctly #15

Closed ruslankryl closed 5 years ago

ruslankryl commented 6 years ago

If we get 5 cards and consistently swing 3, than call card.throwIn three times we do not get the desired stack — first card3.throwIn return the corerct card to the top of stack, but other calls will return next cards (card2, card1) behind the third

Steps:

Initial stack

card1 card2 card3 card4 card5

Swinging first 3..

State 1:

Stack

card4 card5

Trash

card3 card2 card1

Starting throwIn

card3.throwIn(0,0)

State 2:

Stack

card3 card4 card5

Trash

card2 card1

Continue throwIn

card2.throwIn(0,0)

State 3:

Stack

card3 card2 card4 card5

Trash

card1

Continue throwIn

card1.throwIn(0,0)

State 4:

Stack

card3 card2 card1 card4 card5

Trash empty

Probably this is a bug of the library Swing I duplicated the ticket https://github.com/gajus/swing/issues/123, but if you have ideas I will be glad. Thanx!

ssanjun commented 6 years ago

Hi @kryl ! I am sorry for late to reply.

I think, it is a bug of Swing. so I create PR to fix it. check it please. https://github.com/gajus/swing/pull/131

Thanks!

ruslankryl commented 6 years ago

Thanks!