slot 0.0.1
A real time UI render framework
载入中...
搜索中...
未找到
TrailingPosition.h
浏览该文件的文档.
1/*
2 * Copyright (c) Meta Platforms, Inc. and affiliates.
3 *
4 * This source code is licensed under the MIT license found in the
5 * LICENSE file in the root directory of this source tree.
6 */
7
8#pragma once
9
10#include <yoga/Yoga.h>
12#include <yoga/event/event.h>
13#include <yoga/node/Node.h>
14
15namespace facebook::yoga {
16
17// Given an offset to an edge, returns the offset to the opposite edge on the
18// same axis. This assumes that the width/height of both nodes is determined at
19// this point.
21 float position,
22 FlexDirection axis,
23 const yoga::Node* const containingNode,
24 const yoga::Node* const node) {
25 return containingNode->getLayout().measuredDimension(dimension(axis)) -
26 node->getLayout().measuredDimension(dimension(axis)) - position;
27}
28
30 const yoga::Node* const node,
31 yoga::Node* const child,
32 const FlexDirection axis) {
33 child->setLayoutPosition(
35 child->getLayout().position(flexStartEdge(axis)), axis, node, child),
36 flexEndEdge(axis));
37}
38
39inline bool needsTrailingPosition(const FlexDirection axis) {
40 return axis == FlexDirection::RowReverse ||
42}
43
44} // namespace facebook::yoga
Definition Benchmark.cpp:19
PhysicalEdge flexEndEdge(FlexDirection flexDirection)
Definition FlexDirection.h:68
void setChildTrailingPosition(const yoga::Node *const node, yoga::Node *const child, const FlexDirection axis)
Definition TrailingPosition.h:29
bool needsTrailingPosition(const FlexDirection axis)
Definition TrailingPosition.h:39
PhysicalEdge flexStartEdge(FlexDirection flexDirection)
Definition FlexDirection.h:53
float getPositionOfOppositeEdge(float position, FlexDirection axis, const yoga::Node *const containingNode, const yoga::Node *const node)
Definition TrailingPosition.h:20
Dimension dimension(FlexDirection flexDirection)
Definition FlexDirection.h:105
FlexDirection
Definition FlexDirection.h:18