mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Fabric: Add and subtract operations for RectangleEdges<T>
Summary: We will use it soon for `EdgeInsets` Changelog: [Internal] Fabric-specific internal change. Reviewed By: sammy-SC Differential Revision: D18444732 fbshipit-source-id: f03aa2a8889d426095a954d88f9cb6172c3e376e
This commit is contained in:
committed by
Facebook Github Bot
parent
d5ec68f841
commit
fa3ab5c653
@@ -141,6 +141,26 @@ struct RectangleEdges {
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
RectangleEdges<T> operator+(
|
||||
RectangleEdges<T> const &lhs,
|
||||
RectangleEdges<T> const &rhs) {
|
||||
return RectangleEdges<T>{lhs.left + rhs.left,
|
||||
lhs.top + rhs.top,
|
||||
lhs.right + rhs.right,
|
||||
lhs.bottom + rhs.bottom};
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
RectangleEdges<T> operator-(
|
||||
RectangleEdges<T> const &lhs,
|
||||
RectangleEdges<T> const &rhs) {
|
||||
return RectangleEdges<T>{lhs.left - rhs.left,
|
||||
lhs.top - rhs.top,
|
||||
lhs.right - rhs.right,
|
||||
lhs.bottom - rhs.bottom};
|
||||
}
|
||||
|
||||
/*
|
||||
* Generic data structure describes some values associated with *corners*
|
||||
* of a rectangle.
|
||||
|
||||
Reference in New Issue
Block a user