Fixed Stack align when there is no direction.
This commit is contained in:
parent
d1283c37d7
commit
c52c80f0a5
|
@ -1,3 +1,6 @@
|
|||
* Window example headless screenshot does not use the color scheme?
|
||||
- Test older commit.
|
||||
|
||||
# Documentation
|
||||
|
||||
* Add build dependencies for each operating system on the main `README.md`.
|
||||
|
|
|
@ -199,6 +199,9 @@ impl StackDirection {
|
|||
/// Values are in the `0.0..=1.0` range where 0 is 20º or more from a single direction and 1 is 0º or 90º.
|
||||
pub fn direction_scale(&self) -> Factor2d {
|
||||
let scale = self.direction_factor(LayoutDirection::LTR).abs().yx();
|
||||
if scale.x == 0.fct() && scale.y == 0.fct() {
|
||||
return Factor2d::new(1.0, 1.0);
|
||||
}
|
||||
let angle = scale.y.0.atan2(scale.x.0).to_degrees();
|
||||
if angle <= 20.0 {
|
||||
Factor2d::new(1.0 - angle / 20.0, 0.0)
|
||||
|
|
|
@ -1,4 +1,39 @@
|
|||
//! Window service, widget, events, commands and types.
|
||||
//!
|
||||
//! The [`Window!`](struct@Window) widget declares a window root.
|
||||
//!
|
||||
//! The example below declares a window that can toggle if it can close.
|
||||
//!
|
||||
//! ```
|
||||
//! # fn main() {}
|
||||
//! use zero_ui::prelude::*;
|
||||
//!
|
||||
//! fn app() {
|
||||
//! APP.defaults().run_window(async { window() });
|
||||
//! }
|
||||
//!
|
||||
//! fn window() -> window::WindowRoot {
|
||||
//! let allow_close = var(true);
|
||||
//! Window! {
|
||||
//! on_close_requested = hn!(allow_close, |args: &window::WindowCloseRequestedArgs| {
|
||||
//! if !allow_close.get() {
|
||||
//! args.propagation().stop();
|
||||
//! }
|
||||
//! });
|
||||
//!
|
||||
//! title = "Title";
|
||||
//! child_align = layout::Align::CENTER;
|
||||
//! child = Toggle! {
|
||||
//! child = Text!(allow_close.map(|a| formatx!("allow_close = {a:?}")));
|
||||
//! checked = allow_close;
|
||||
//! }
|
||||
//! }
|
||||
//! }
|
||||
//! ```
|
||||
//!
|
||||
//! The [`WINDOWS`] service can be used to open, manage and close windows.
|
||||
//!
|
||||
//! !!: TODO
|
||||
//!
|
||||
//! # Full API
|
||||
//!
|
||||
|
|
Loading…
Reference in New Issue