mirror of
https://github.com/DioxusLabs/dioxus
synced 2024-11-23 12:43:08 +00:00
update tui to use taffy dimention directly (#501)
This commit is contained in:
parent
d090b24f8d
commit
39cbc82107
2 changed files with 10 additions and 9 deletions
|
@ -1,8 +1,7 @@
|
|||
use dioxus_native_core::layout_attributes::UnitSystem;
|
||||
use std::io::Stdout;
|
||||
use taffy::{
|
||||
geometry::Point,
|
||||
prelude::{Layout, Size},
|
||||
prelude::{Dimension, Layout, Size},
|
||||
Taffy,
|
||||
};
|
||||
use tui::{backend::CrosstermBackend, layout::Rect, style::Color};
|
||||
|
@ -252,8 +251,9 @@ impl RinkWidget for &Node {
|
|||
BorderStyle::Hidden => 0.0,
|
||||
BorderStyle::None => 0.0,
|
||||
_ => match border.radius {
|
||||
UnitSystem::Percent(p) => p * area.width as f32 / 100.0,
|
||||
UnitSystem::Point(p) => p,
|
||||
Dimension::Percent(p) => p * area.width as f32 / 100.0,
|
||||
Dimension::Points(p) => p,
|
||||
_ => todo!(),
|
||||
}
|
||||
.abs()
|
||||
.min((area.width as f32 / RADIUS_MULTIPLIER[0]) / 2.0)
|
||||
|
|
|
@ -31,11 +31,12 @@
|
|||
|
||||
use dioxus_core::Attribute;
|
||||
use dioxus_native_core::{
|
||||
layout_attributes::{parse_value, UnitSystem},
|
||||
layout_attributes::parse_value,
|
||||
node_ref::{AttributeMask, NodeMask, NodeView},
|
||||
state::ParentDepState,
|
||||
};
|
||||
use dioxus_native_core_macro::sorted_str_slice;
|
||||
use taffy::prelude::*;
|
||||
|
||||
use crate::style::{RinkColor, RinkStyle};
|
||||
|
||||
|
@ -127,8 +128,8 @@ impl Borders {
|
|||
pub struct BorderEdge {
|
||||
pub color: Option<RinkColor>,
|
||||
pub style: BorderStyle,
|
||||
pub width: UnitSystem,
|
||||
pub radius: UnitSystem,
|
||||
pub width: Dimension,
|
||||
pub radius: Dimension,
|
||||
}
|
||||
|
||||
impl Default for BorderEdge {
|
||||
|
@ -136,8 +137,8 @@ impl Default for BorderEdge {
|
|||
Self {
|
||||
color: None,
|
||||
style: BorderStyle::None,
|
||||
width: UnitSystem::Point(0.0),
|
||||
radius: UnitSystem::Point(0.0),
|
||||
width: Dimension::Points(0.0),
|
||||
radius: Dimension::Points(0.0),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue