mirror of
https://github.com/danbulant/cushy
synced 2026-06-19 22:41:10 +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.
|
||||
- Cushy now has its own `KeyEvent` type, as winit's has private fields. This
|
||||
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
|
||||
|
||||
|
|
|
|||
|
|
@ -649,9 +649,15 @@ pub enum FlexibleDimension {
|
|||
Dimension(Dimension),
|
||||
}
|
||||
|
||||
impl FlexibleDimension {
|
||||
/// A dimension of 0 pixels.
|
||||
pub const ZERO: Self = Self::Dimension(Dimension::ZERO);
|
||||
impl Zero for FlexibleDimension {
|
||||
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 {
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
use std::fmt::Debug;
|
||||
|
||||
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::styles::{Edges, FlexibleDimension};
|
||||
|
|
|
|||
Loading…
Reference in a new issue