Add support for dashed borders to GPUI (#27139)
Features: * Scales dash spacing with border width. * Laying out dashes around rounded corners. * Varying border widths with rounded corners - now uses an ellipse for the inner edge of the border. * When there are no rounded corners, each straight border is laid out separately, so that the dashes to meet at the corners. * All sides of each dash are antialiased.   Release Notes: - N/A --------- Co-authored-by: Michael Sloan <michael@zed.dev> Co-authored-by: Ben <ben@zed.dev>
This commit is contained in:
parent
2fe2028e20
commit
cd1e56d6c7
14 changed files with 869 additions and 159 deletions
|
@ -1,7 +1,8 @@
|
|||
use crate::{
|
||||
self as gpui, px, relative, rems, AbsoluteLength, AlignItems, CursorStyle, DefiniteLength,
|
||||
Fill, FlexDirection, FlexWrap, Font, FontStyle, FontWeight, Hsla, JustifyContent, Length,
|
||||
SharedString, StrikethroughStyle, StyleRefinement, TextOverflow, UnderlineStyle, WhiteSpace,
|
||||
self as gpui, px, relative, rems, AbsoluteLength, AlignItems, BorderStyle, CursorStyle,
|
||||
DefiniteLength, Fill, FlexDirection, FlexWrap, Font, FontStyle, FontWeight, Hsla,
|
||||
JustifyContent, Length, SharedString, StrikethroughStyle, StyleRefinement, TextOverflow,
|
||||
UnderlineStyle, WhiteSpace,
|
||||
};
|
||||
use crate::{TextAlign, TextStyleRefinement};
|
||||
pub use gpui_macros::{
|
||||
|
@ -361,6 +362,12 @@ pub trait Styled: Sized {
|
|||
self
|
||||
}
|
||||
|
||||
/// Sets the border style of the element.
|
||||
fn border_dashed(mut self) -> Self {
|
||||
self.style().border_style = Some(BorderStyle::Dashed);
|
||||
self
|
||||
}
|
||||
|
||||
/// Returns a mutable reference to the text style that has been configured on this element.
|
||||
fn text_style(&mut self) -> &mut Option<TextStyleRefinement> {
|
||||
let style: &mut StyleRefinement = self.style();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue