You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: circularlayoutmanagerlib/src/main/java/com/leshchenko/circularlayoutmanagerlib/CircularRecyclerLayoutManager.kt
+5-3Lines changed: 5 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -50,11 +50,13 @@ class CircularRecyclerLayoutManager(
50
50
51
51
val circleRadius = firstCircleRadius + (itemWidth *1.5* circleOrderPosition)
52
52
53
-
val angleStep =
54
-
if (angleStepForCircles.isNaN()) anglePerItem.div(2) else angleStepForCircles
53
+
val angleStep =if (angleStepForCircles.isNaN()) anglePerItem.div(2) else angleStepForCircles
55
54
56
55
val direction =if (isClockwise) -1else1
57
-
val angle = (anglePerItem * position * direction) +if (circleOrderPosition.isDivideByTwo()) initialAngle else angleStep
56
+
val maxAngle = anglePerItem * itemsPerCircle
57
+
val angleCalculation = (anglePerItem * position * direction) % maxAngle
58
+
val angleOffset =if (circleOrderPosition.isDivideByTwo()) angleStep else0.0
59
+
val angle = (angleCalculation + angleOffset + initialAngle)
58
60
59
61
val positionData = calculatePosition(circleRadius, angle)
0 commit comments