diff options
Diffstat (limited to '')
-rw-r--r-- | native/src/layout/flex.rs | 27 |
1 files changed, 12 insertions, 15 deletions
diff --git a/native/src/layout/flex.rs b/native/src/layout/flex.rs index dfb5288b..5fbcbca0 100644 --- a/native/src/layout/flex.rs +++ b/native/src/layout/flex.rs @@ -16,11 +16,8 @@ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. - -use crate::{ - layout::{Limits, Node}, - CrossAlign, Element, Padding, Point, Size, -}; +use crate::layout::{Limits, Node}; +use crate::{Alignment, Element, Padding, Point, Size}; /// The main axis of a flex layout. #[derive(Debug)] @@ -65,7 +62,7 @@ pub fn resolve<Message, Renderer>( limits: &Limits, padding: Padding, spacing: f32, - align_items: CrossAlign, + align_items: Alignment, items: &[Element<'_, Message, Renderer>], ) -> Node where @@ -82,7 +79,7 @@ where let mut nodes: Vec<Node> = Vec::with_capacity(items.len()); nodes.resize(items.len(), Node::default()); - if align_items == CrossAlign::Fill { + if align_items == Alignment::Fill { let mut fill_cross = axis.cross(limits.min()); items.iter().for_each(|child| { @@ -116,13 +113,13 @@ where .fill_factor(); if fill_factor == 0 { - let (min_width, min_height) = if align_items == CrossAlign::Fill { + let (min_width, min_height) = if align_items == Alignment::Fill { axis.pack(0.0, cross) } else { axis.pack(0.0, 0.0) }; - let (max_width, max_height) = if align_items == CrossAlign::Fill { + let (max_width, max_height) = if align_items == Alignment::Fill { axis.pack(available, cross) } else { axis.pack(available, max_cross) @@ -138,7 +135,7 @@ where available -= axis.main(size); - if align_items != CrossAlign::Fill { + if align_items != Alignment::Fill { cross = cross.max(axis.cross(size)); } @@ -165,13 +162,13 @@ where max_main }; - let (min_width, min_height) = if align_items == CrossAlign::Fill { + let (min_width, min_height) = if align_items == Alignment::Fill { axis.pack(min_main, cross) } else { axis.pack(min_main, axis.cross(limits.min())) }; - let (max_width, max_height) = if align_items == CrossAlign::Fill { + let (max_width, max_height) = if align_items == Alignment::Fill { axis.pack(max_main, cross) } else { axis.pack(max_main, max_cross) @@ -184,7 +181,7 @@ where let layout = child.layout(renderer, &child_limits); - if align_items != CrossAlign::Fill { + if align_items != Alignment::Fill { cross = cross.max(axis.cross(layout.size())); } @@ -207,7 +204,7 @@ where match axis { Axis::Horizontal => { node.align( - CrossAlign::Start, + Alignment::Start, align_items, Size::new(0.0, cross), ); @@ -215,7 +212,7 @@ where Axis::Vertical => { node.align( align_items, - CrossAlign::Start, + Alignment::Start, Size::new(cross, 0.0), ); } |