mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-22 22:25:57 +00:00
Adds trampoline for inserting and deletion of nodes
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.
This commit is contained in:
@@ -54,6 +54,11 @@ typedef std::map<unsigned long, id<ASLayoutable>, std::less<unsigned long>> ASCh
|
||||
return ASLayoutableTypeLayoutSpec;
|
||||
}
|
||||
|
||||
- (BOOL)canLayoutAsynchronous
|
||||
{
|
||||
return YES;
|
||||
}
|
||||
|
||||
#pragma mark - Layout
|
||||
|
||||
- (ASLayout *)measureWithSizeRange:(ASSizeRange)constrainedSize
|
||||
|
||||
@@ -46,8 +46,16 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
*/
|
||||
@protocol ASLayoutable <ASEnvironment, ASStackLayoutable, ASStaticLayoutable, ASLayoutablePrivate, ASLayoutableExtensibility>
|
||||
|
||||
/**
|
||||
* @abstract Returns type of layoutable
|
||||
*/
|
||||
@property (nonatomic, readonly) ASLayoutableType layoutableType;
|
||||
|
||||
/**
|
||||
* @abstract Returns if the layoutable can be used to layout in an asynchronous way on a background thread.
|
||||
*/
|
||||
@property (nonatomic, readonly) BOOL canLayoutAsynchronous;
|
||||
|
||||
/**
|
||||
* @abstract Calculate a layout based on given size range.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user