mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2026-03-09 17:51:56 +00:00
moved baseline alignment to a layout spec.
This commit is contained in:
@@ -1,35 +1,48 @@
|
||||
//
|
||||
// ASStackTextLayoutSpec.h
|
||||
// AsyncDisplayKit
|
||||
//
|
||||
// Created by ricky cancro on 8/19/15.
|
||||
// Copyright (c) 2015 Facebook. All rights reserved.
|
||||
//
|
||||
/*
|
||||
* 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 <AsyncDisplayKit/ASStackLayoutSpec.h>
|
||||
|
||||
/** Orientation of children along cross axis */
|
||||
typedef NS_ENUM(NSUInteger, ASStackTextLayoutBaselineAlignment) {
|
||||
ASStackTextLayoutBaselineAlignmentNone,
|
||||
/** Children align along the first baseline of the stack. Only available for horizontal stack nodes */
|
||||
ASStackTextLayoutBaselineAlignmentFirst,
|
||||
/** Children align along the last baseline of the stack. Only available for horizontal stack nodes */
|
||||
ASStackTextLayoutBaselineAlignmentLast,
|
||||
/** No baseline alignment. This is only valid for a vertical stack */
|
||||
ASStackTextLayoutBaselineAlignmentNone,
|
||||
/** Align all children to the first baseline. This is only valid for a horizontal stack */
|
||||
ASStackTextLayoutBaselineAlignmentFirst,
|
||||
/** Align all children to the last baseline. This is useful when a text node wraps and you want to align
|
||||
to the bottom baseline. This is only valid for a horizontal stack */
|
||||
ASStackTextLayoutBaselineAlignmentLast,
|
||||
};
|
||||
|
||||
|
||||
typedef struct {
|
||||
/** Specifies the direction children are stacked in. */
|
||||
ASStackLayoutSpecStyle stackLayoutStyle;
|
||||
|
||||
ASStackTextLayoutBaselineAlignment baselineAlignment;
|
||||
/** Describes how the stack will be laid out */
|
||||
ASStackLayoutSpecStyle stackLayoutStyle;
|
||||
|
||||
/** The type of baseline alignment */
|
||||
ASStackTextLayoutBaselineAlignment baselineAlignment;
|
||||
} ASStackTextLayoutSpecStyle;
|
||||
|
||||
@interface ASStackTextLayoutSpec : ASLayoutSpec
|
||||
|
||||
/**
|
||||
A specialized version of a stack layout that aligns its children on a baseline. This spec only works with
|
||||
ASStackTextLayoutable children.
|
||||
|
||||
If the spec is created with a horizontal direction, the children will be laid on a common baseline.
|
||||
If the spec is created with a vertical direction, a child's vertical spacing will be measured from its
|
||||
baseline instead of from the child's bounding box.
|
||||
*/
|
||||
@interface ASStackTextLayoutSpec : ASLayoutSpec <ASStackTextLayoutable>
|
||||
|
||||
/**
|
||||
@param style Specifies how children are laid out.
|
||||
@param children ASLayoutable children to be positioned.
|
||||
@param children ASTextLayoutable children to be positioned.
|
||||
*/
|
||||
+ (instancetype)newWithStyle:(ASStackTextLayoutSpecStyle)style children:(NSArray *)children;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user