react-native-spinkit icon indicating copy to clipboard operation
react-native-spinkit copied to clipboard

'Circle' type not in center

Open xilibro opened this issue 7 years ago • 3 comments

image image as you can see, not totally in center, how can i fix this issure

xilibro avatar Nov 09 '17 03:11 xilibro

image

xilibro avatar Nov 09 '17 03:11 xilibro

I do not know how to add a new pull request, so i put the solved code here. in animations/RTSpinKitCircleAnimation.m, i changed the following code: `

CGFloat radius = size.width / 2; 
CGFloat circleSize = size.width / 4;
CGFloat circleRadius = circleSize / 2; // added by xilibro 2017-11-09 15:39:59

for (NSInteger i=0; i < 8; i+=1) {
    CALayer *circle = [CALayer layer];

    CGFloat angle = i * M_PI_4; // M_PI_4 = 45°
    CGFloat x = radius + sinf(angle) * radius - circleRadius; // altered by xilibro 2017-11-09 
    CGFloat y = radius - cosf(angle) * radius - circleRadius; // altered by xilibro
   ... ...

` minus circleself's radius solved the issure. RTSpinKitFadingCircleAnimation.m use the same way to solve issure

xilibro avatar Nov 09 '17 07:11 xilibro

I also noticed that, only in iOS, the circle is shifted slightly to the right. I used fadingCircleAlt and substracted CGFloat circleRadius = size.width / 16; from x and y of the frame.

wumke avatar Feb 26 '19 13:02 wumke