mirror of
https://github.com/danbulant/cushy
synced 2026-07-07 20:20:46 +00:00
FlexibleDimension now implements Zero
This commit is contained in:
parent
adb51dba7e
commit
5556d2ea6d
3 changed files with 13 additions and 4 deletions
|
|
@ -45,6 +45,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||||
- `Dynamic<Children>::wrap` has been renamed to `into_wrap` for consistency.
|
- `Dynamic<Children>::wrap` has been renamed to `into_wrap` for consistency.
|
||||||
- Cushy now has its own `KeyEvent` type, as winit's has private fields. This
|
- Cushy now has its own `KeyEvent` type, as winit's has private fields. This
|
||||||
prevented simulating input in a `VirtualWindow`.
|
prevented simulating input in a `VirtualWindow`.
|
||||||
|
- `FlexibleDimension::ZERO` has been removed, and now `FlexibleDimension`
|
||||||
|
implements `Zero` which defines an associated constant of the same name and
|
||||||
|
purpose.
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -649,9 +649,15 @@ pub enum FlexibleDimension {
|
||||||
Dimension(Dimension),
|
Dimension(Dimension),
|
||||||
}
|
}
|
||||||
|
|
||||||
impl FlexibleDimension {
|
impl Zero for FlexibleDimension {
|
||||||
/// A dimension of 0 pixels.
|
const ZERO: Self = Self::Dimension(Dimension::ZERO);
|
||||||
pub const ZERO: Self = Self::Dimension(Dimension::ZERO);
|
|
||||||
|
fn is_zero(&self) -> bool {
|
||||||
|
match self {
|
||||||
|
FlexibleDimension::Auto => false,
|
||||||
|
FlexibleDimension::Dimension(dim) => dim.is_zero(),
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Debug for FlexibleDimension {
|
impl Debug for FlexibleDimension {
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
use std::fmt::Debug;
|
use std::fmt::Debug;
|
||||||
|
|
||||||
use figures::units::UPx;
|
use figures::units::UPx;
|
||||||
use figures::{Fraction, IntoSigned, Point, Rect, ScreenScale, Size};
|
use figures::{Fraction, IntoSigned, Point, Rect, ScreenScale, Size, Zero};
|
||||||
|
|
||||||
use crate::context::{AsEventContext, EventContext, LayoutContext};
|
use crate::context::{AsEventContext, EventContext, LayoutContext};
|
||||||
use crate::styles::{Edges, FlexibleDimension};
|
use crate::styles::{Edges, FlexibleDimension};
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue