mirror of
https://github.com/Astatin3/IntroToWebAuthoring.git
synced 2026-06-09 00:28:00 -06:00
Work on constraint layout
This commit is contained in:
@@ -1,12 +1,16 @@
|
||||
use crate::views::{Bounds, View};
|
||||
use crate::views::{Bounds, LayoutView, View};
|
||||
|
||||
pub struct VerticalLayout {
|
||||
pub views: Vec<Box<dyn View>>,
|
||||
pub views: Vec<Box<dyn LayoutView>>,
|
||||
pub bounds: (Option<Bounds>, Option<Bounds>),
|
||||
}
|
||||
|
||||
impl VerticalLayout {
|
||||
pub fn new(views: Vec<Box<dyn View>>) -> Self {
|
||||
Self { views }
|
||||
pub fn new(views: Vec<Box<dyn LayoutView>>) -> Self {
|
||||
Self {
|
||||
views,
|
||||
bounds: (None, None),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,6 +38,12 @@ impl View for VerticalLayout {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl LayoutView for VerticalLayout {
|
||||
fn set_bounds(&mut self, width: Option<Bounds>, height: Option<Bounds>) {
|
||||
self.bounds = (width, height);
|
||||
}
|
||||
|
||||
fn bounds(&self, pw: f32, ph: f32) -> (Bounds, Bounds) {
|
||||
let (mut maxx, mut totaly): (f32, f32) = (0., 0.);
|
||||
|
||||
Reference in New Issue
Block a user