|
6 | 6 | // Copyright © 2024 zhangjc. All rights reserved.
|
7 | 7 | //
|
8 | 8 |
|
9 |
| -#import "GaiaPagerLayout.h" |
| 9 | +#import "GXPagerLayout.h" |
10 | 10 |
|
11 |
| -typedef NS_ENUM(NSUInteger, GaiaLayoutItemDirection) { |
12 |
| - GaiaLayoutItemDirectionLeft, |
13 |
| - GaiaLayoutItemDirectionCenter, |
14 |
| - GaiaLayoutItemDirectionRight, |
| 11 | +typedef NS_ENUM(NSUInteger, GXLayoutItemDirection) { |
| 12 | + GXLayoutItemDirectionLeft, |
| 13 | + GXLayoutItemDirectionCenter, |
| 14 | + GXLayoutItemDirectionRight, |
15 | 15 | };
|
16 | 16 |
|
17 | 17 | @interface GXPagerLayoutConfig ()
|
@@ -140,13 +140,13 @@ - (CGFloat)minimumInteritemSpacing {
|
140 | 140 | return _layout.itemSpacing;
|
141 | 141 | }
|
142 | 142 |
|
143 |
| -- (GaiaLayoutItemDirection)directionWithCenterX:(CGFloat)centerX { |
144 |
| - GaiaLayoutItemDirection direction = GaiaLayoutItemDirectionRight; |
| 143 | +- (GXLayoutItemDirection)directionWithCenterX:(CGFloat)centerX { |
| 144 | + GXLayoutItemDirection direction = GXLayoutItemDirectionRight; |
145 | 145 | CGFloat contentCenterX = self.collectionView.contentOffset.x + CGRectGetWidth(self.collectionView.frame) / 2;
|
146 | 146 | if (ABS(centerX - contentCenterX) < 0.5) {
|
147 |
| - direction = GaiaLayoutItemDirectionCenter; |
| 147 | + direction = GXLayoutItemDirectionCenter; |
148 | 148 | }else if (centerX - contentCenterX < 0) {
|
149 |
| - direction = GaiaLayoutItemDirectionLeft; |
| 149 | + direction = GXLayoutItemDirectionLeft; |
150 | 150 | }
|
151 | 151 | return direction;
|
152 | 152 | }
|
@@ -232,13 +232,13 @@ - (void)applyLinearTransformToAttributes:(UICollectionViewLayoutAttributes *)att
|
232 | 232 | - (void)applyLinearTransformToAttributes:(UICollectionViewLayoutAttributes *)attributes scale:(CGFloat)scale alpha:(CGFloat)alpha {
|
233 | 233 | CGAffineTransform transform = CGAffineTransformMakeScale(scale, scale);
|
234 | 234 | if (_layout.adjustSpacingWhenScroling) {
|
235 |
| - GaiaLayoutItemDirection direction = [self directionWithCenterX:attributes.center.x]; |
| 235 | + GXLayoutItemDirection direction = [self directionWithCenterX:attributes.center.x]; |
236 | 236 | CGFloat translate = 0;
|
237 | 237 | switch (direction) {
|
238 |
| - case GaiaLayoutItemDirectionLeft: |
| 238 | + case GXLayoutItemDirectionLeft: |
239 | 239 | translate = 1.15 * attributes.size.width * (1 - scale) / 2;
|
240 | 240 | break;
|
241 |
| - case GaiaLayoutItemDirectionRight: |
| 241 | + case GXLayoutItemDirectionRight: |
242 | 242 | translate = -1.15 * attributes.size.width * (1 - scale) / 2;
|
243 | 243 | break;
|
244 | 244 | default:
|
@@ -268,15 +268,15 @@ - (void)applyCoverflowTransformToAttributes:(UICollectionViewLayoutAttributes *)
|
268 | 268 | }
|
269 | 269 |
|
270 | 270 | - (void)applyCoverflowTransformToAttributes:(UICollectionViewLayoutAttributes *)attributes angle:(CGFloat)angle alpha:(CGFloat)alpha {
|
271 |
| - GaiaLayoutItemDirection direction = [self directionWithCenterX:attributes.center.x]; |
| 271 | + GXLayoutItemDirection direction = [self directionWithCenterX:attributes.center.x]; |
272 | 272 | CATransform3D transform3D = CATransform3DIdentity;
|
273 | 273 | transform3D.m34 = -0.002;
|
274 | 274 | CGFloat translate = 0;
|
275 | 275 | switch (direction) {
|
276 |
| - case GaiaLayoutItemDirectionLeft: |
| 276 | + case GXLayoutItemDirectionLeft: |
277 | 277 | translate = (1 - cos(angle * 1.2 * M_PI)) * attributes.size.width;
|
278 | 278 | break;
|
279 |
| - case GaiaLayoutItemDirectionRight: |
| 279 | + case GXLayoutItemDirectionRight: |
280 | 280 | translate = -(1 - cos(angle * 1.2 * M_PI)) * attributes.size.width;
|
281 | 281 | angle = -angle;
|
282 | 282 | break;
|
|
0 commit comments