Refactor alignment types into an alignment module

This commit is contained in:
Héctor Ramón Jiménez 2021-09-20 15:09:55 +07:00
parent 5fae6e59ff
commit a0ad399622
No known key found for this signature in database
GPG key ID: 140CC052C94F138E
54 changed files with 402 additions and 377 deletions

View file

@ -11,7 +11,7 @@ use iced::slider::{self, Slider};
use iced::time;
use iced::window;
use iced::{
Application, Checkbox, Column, Command, Container, CrossAlign, Element,
Alignment, Application, Checkbox, Column, Command, Container, Element,
Length, Row, Settings, Subscription, Text,
};
use preset::Preset;
@ -158,10 +158,10 @@ impl Application for GameOfLife {
mod grid {
use crate::Preset;
use iced::{
alignment,
canvas::event::{self, Event},
canvas::{self, Cache, Canvas, Cursor, Frame, Geometry, Path, Text},
mouse, Color, Element, HorizontalAlignment, Length, Point, Rectangle,
Size, Vector, VerticalAlignment,
mouse, Color, Element, Length, Point, Rectangle, Size, Vector,
};
use rustc_hash::{FxHashMap, FxHashSet};
use std::future::Future;
@ -498,8 +498,8 @@ mod grid {
color: Color::WHITE,
size: 14.0,
position: Point::new(frame.width(), frame.height()),
horizontal_alignment: HorizontalAlignment::Right,
vertical_alignment: VerticalAlignment::Bottom,
horizontal_alignment: alignment::Horizontal::Right,
vertical_alignment: alignment::Vertical::Bottom,
..Text::default()
};
@ -844,7 +844,7 @@ impl Controls {
let speed_controls = Row::new()
.width(Length::Fill)
.align_items(CrossAlign::Center)
.align_items(Alignment::Center)
.spacing(10)
.push(
Slider::new(
@ -860,7 +860,7 @@ impl Controls {
Row::new()
.padding(10)
.spacing(20)
.align_items(CrossAlign::Center)
.align_items(Alignment::Center)
.push(playback_controls)
.push(speed_controls)
.push(