Github user cxfeng1 commented on a diff in the pull request:

    https://github.com/apache/incubator-weex/pull/581#discussion_r132130697
  
    --- Diff: ios/sdk/WeexSDK/Sources/Layout/WXComponent+Layout.m ---
    @@ -112,6 +115,211 @@ - (NSUInteger)_childrenCountForLayout
         return (int)(count);
     }
     
    +
    +#pragma mark LayoutAnimationDisplayLink
    +- (void)_startLayoutAnimationDisplayLink
    +{
    +    WXAssertComponentThread();
    +    if (!_layoutAnimationDisplayLink) {
    +        _layoutAnimationDisplayLink = [CADisplayLink 
displayLinkWithTarget:self 
selector:@selector(_handleLayoutAnimationDisplayLink)];
    +        [_layoutAnimationDisplayLink addToRunLoop:[NSRunLoop 
currentRunLoop] forMode:NSDefaultRunLoopMode];
    +    }
    +    else{
    +        [self _awakeLayoutAnimationDisplayLink];
    +    }
    +    
    +}
    +
    +- (void)_stopLayoutAnimationDisplayLink
    +{
    +    WXAssertComponentThread();
    +    if (_layoutAnimationDisplayLink) {
    +        [_layoutAnimationDisplayLink invalidate];
    +        _layoutAnimationDisplayLink = nil;
    +    }
    +}
    +
    +- (void)_suspendLayoutAnimationDisplayLink
    +{
    +    WXAssertComponentThread();
    +    if(_layoutAnimationDisplayLink && !_layoutAnimationDisplayLink.paused)
    +    {
    +        _layoutAnimationDisplayLink.paused = YES;
    +    }
    +}
    +
    +
    +- (void)_awakeLayoutAnimationDisplayLink
    +{
    +    WXAssertComponentThread();
    +    if (_layoutAnimationDisplayLink && _layoutAnimationDisplayLink.paused) 
{
    +        _layoutAnimationDisplayLink.paused = NO;
    +    }
    +}
    +
    +- (void)_handleLayoutAnimationDisplayLink
    +{
    +    WXAssertComponentThread();
    +    int count = _layoutAnimationDuration * 60 / 1000;
    +    if (_layoutAnimationCount >= count) {
    +        [self _suspendLayoutAnimationDisplayLink];
    +        [self _resetProcessAnimationParameter];
    +        return;
    +    }
    +    else
    +    {
    +        [self _calculateLayoutAnimationProcessingStyle];
    +    }
    +    _layoutAnimationCount ++;
    +}
    +
    +
    +- (void)_resetProcessAnimationParameter
    +{
    +    
    +    _layoutAnimationCount = 0;
    +    _layoutAnimationDuration = 0;
    +    _widthInfo = nil;
    +    _heightInfo = nil;
    +    _leftInfo = nil;
    +    _rightInfo = nil;
    +    _topInfo = nil;
    +    _bottomInfo = nil;
    +}
    +
    +- (void)_handleLayoutAnimationWithStyles:(NSDictionary *)styles
    +{
    +    [self _suspendLayoutAnimationDisplayLink];
    +    
    +    if (!_addStyles) {
    +        _fromStyles = [NSMutableDictionary 
dictionaryWithDictionary:self.styles];
    +        _addStyles = [NSMutableDictionary dictionaryWithDictionary:styles];
    +    }
    +    else
    +    {
    +        [_addStyles addEntriesFromDictionary:styles];
    +    }//保证_addStyles是唯一的
    --- End diff --
    
    Use English Comments.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to