mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-09-09 14:10:05 +00:00
Currently measurement always needs to happen on the main thread if implicit hierarchy management is enabled as adding and removing from nodes needs to happen on the main thread. We now will trampoline to the main thread to do the insertion and deletion of nodes. This also resolves the issue that can occur if a node is already loaded deep in the layout hierarchy in the layout that the node is transforming to. Before insertion or deletion is happening we need to crawl the layout hierarchy to check that though.
63 lines
1.7 KiB
Objective-C
63 lines
1.7 KiB
Objective-C
//
|
|
// ASLayoutTransition.h
|
|
// AsyncDisplayKit
|
|
//
|
|
// Created by Huy Nguyen on 3/8/16.
|
|
//
|
|
// Copyright (c) 2014-present, Facebook, Inc. All rights reserved.
|
|
// This source code is licensed under the BSD-style license found in the
|
|
// LICENSE file in the root directory of this source tree. An additional grant
|
|
// of patent rights can be found in the PATENTS file in the same directory.
|
|
//
|
|
|
|
#import "ASDimension.h"
|
|
#import "_ASTransitionContext.h"
|
|
|
|
@class ASDisplayNode;
|
|
@class ASLayout;
|
|
|
|
@interface ASLayoutTransition : NSObject <_ASTransitionContextLayoutDelegate>
|
|
|
|
/**
|
|
* Node to apply layout transition on
|
|
*/
|
|
@property (nonatomic, readonly, weak) ASDisplayNode *node;
|
|
|
|
/**
|
|
* Previous layout to transition from
|
|
*/
|
|
@property (nonatomic, readonly, strong) ASLayout *previousLayout;
|
|
|
|
/**
|
|
* Pending layout to transition to
|
|
*/
|
|
@property (nonatomic, readonly, strong) ASLayout *pendingLayout;
|
|
|
|
/**
|
|
* Returns if the layout transition can happen asynchronously
|
|
*/
|
|
@property (nonatomic, readonly, assign) BOOL canTransitionAsynchronous;
|
|
|
|
/**
|
|
* Returns a newly initialized layout transition
|
|
*/
|
|
- (instancetype)initWithNode:(ASDisplayNode *)node pendingLayout:(ASLayout *)pendingLayout previousLayout:(ASLayout *)previousLayout NS_DESIGNATED_INITIALIZER;
|
|
- (instancetype)init NS_UNAVAILABLE;
|
|
|
|
/**
|
|
* Insert and remove subnodes that where added or removed between the previousLayout and the pendingLayout
|
|
*/
|
|
- (void)applySubnodeTransition;
|
|
|
|
/**
|
|
* Insert all new subnodes that where added between the previous layout and the pending layout
|
|
*/
|
|
- (void)applySubnodeInsertions;
|
|
|
|
/**
|
|
* Remove all subnodes that are removed between the previous layout and the pending layout
|
|
*/
|
|
- (void)applySubnodeRemovals;
|
|
|
|
@end
|