Shuffle icon indicating copy to clipboard operation
Shuffle copied to clipboard

Added lock to move the card on an axis

Open andre991 opened this issue 5 years ago • 9 comments

Added the Axis enum to allow card to move from a unique axis or both. Issue #64

andre991 avatar May 22 '20 22:05 andre991

@mac-gallagher I added an enum to drag card from a unique axis.

andre991 avatar May 22 '20 22:05 andre991

Hey @andre991 thanks for opening this pull request. I tried the same thing after you opened #64, but the cards behave unexpectedly in the example project. If you drag horizontally, the card slides downwards because there is a rotation angle on the card animation options. It may require some changes to card.layer.anchorPoint. Let me know if you figure anything out

mac-gallagher avatar May 23 '20 02:05 mac-gallagher

Hi @mac-gallagher I will test this in example project, but in my project the animation looks normal. The rotation is work perfectly for me. You have an gif to share?

andre991 avatar May 23 '20 11:05 andre991

Here's what a horizontal swipe looks like with Axis.all (current behavior in Shuffle). Notice how the center of the card stays on the horizontal axis

horizontal_swipe_all 2020-05-23 17_05_52

and here is a horizontal swipe with Axis.horizontal:

horizontal_swipe_horizontal 2020-05-23 16_56_52

mac-gallagher avatar May 24 '20 00:05 mac-gallagher

Hi @mac-gallagher, sorry for the delay.

The axis is to block card movement for other Axis.

Look at the mouse movement.

andre991 avatar May 29 '20 21:05 andre991

Axis.all The card movements in all axis. ezgif com-video-to-gif

andre991 avatar May 29 '20 21:05 andre991

Axis.horizontal The card movements only in horizontal axis(see the mouse). ezgif com-video-to-gif (1)

andre991 avatar May 29 '20 21:05 andre991

Codecov Report

Merging #65 into master will decrease coverage by 1.0%. The diff coverage is 44.4%.

@@           Coverage Diff            @@
##           master     #65     +/-   ##
========================================
- Coverage    82.3%   81.2%   -1.1%     
========================================
  Files          13      14      +1     
  Lines         656     672     +16     
========================================
+ Hits          540     546      +6     
- Misses        116     126     +10     
Impacted Files Coverage Δ
...le/SwipeCardStack/CardStackTransformProvider.swift 0.0% <ø> (ø)
Sources/Shuffle/Axis.swift 37.5% <37.5%> (ø)
...rces/Shuffle/SwipeCard/CardTransformProvider.swift 100.0% <100.0%> (ø)
Sources/Shuffle/SwipeCard/SwipeView.swift 100.0% <100.0%> (ø)

codecov-commenter avatar May 29 '20 21:05 codecov-commenter

Hey @andre991 yes I understand - your change blocks the card movements in the specified directions just fine. However, I would expect everything else to remain the same. The card follows different trajectories for a horizontal drag with Axis.all and Axis.horizontal. They will need to be the same before merging this change

mac-gallagher avatar May 29 '20 22:05 mac-gallagher