-
-
Notifications
You must be signed in to change notification settings - Fork 62
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
121 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
use crate::Parse; | ||
use torin::position::Position; | ||
|
||
#[derive(Debug, PartialEq, Eq)] | ||
pub struct ParsePositionError; | ||
|
||
impl Parse for Position { | ||
type Err = ParsePositionError; | ||
|
||
fn parse(value: &str) -> Result<Self, Self::Err> { | ||
Ok(match value { | ||
"absolute" => Position::Absolute, | ||
_ => Position::Stacked, | ||
}) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,13 @@ | ||
pub mod alignment; | ||
pub mod direction; | ||
pub mod gaps; | ||
pub mod position; | ||
pub mod size; | ||
|
||
pub mod prelude { | ||
pub use crate::alignment::*; | ||
pub use crate::direction::*; | ||
pub use crate::gaps::*; | ||
pub use crate::position::*; | ||
pub use crate::size::*; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#[derive(Default, PartialEq, Eq, Debug, Clone)] | ||
pub enum Position { | ||
#[default] | ||
Stacked, | ||
|
||
Absolute, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
#![cfg_attr( | ||
all(not(debug_assertions), target_os = "windows"), | ||
windows_subsystem = "windows" | ||
)] | ||
|
||
use freya::prelude::*; | ||
|
||
fn main() { | ||
launch_with_props(app, "Position", (400.0, 350.0)); | ||
} | ||
|
||
fn app(cx: Scope) -> Element { | ||
render!( | ||
rect { | ||
height: "100%", | ||
width: "100%", | ||
rect { | ||
height: "20%", | ||
width: "100%", | ||
background: "green", | ||
} | ||
rect { | ||
height: "100", | ||
width: "100", | ||
background: "red", | ||
position: "absolute", | ||
layer: "-1" | ||
} | ||
rect { | ||
height: "20%", | ||
width: "100%", | ||
background: "orange", | ||
} | ||
rect { | ||
height: "20%", | ||
width: "100%", | ||
background: "yellow", | ||
} | ||
} | ||
) | ||
} |