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
|
@ -9,11 +9,11 @@ use std::sync::Arc;
|
|||
use std::time::Duration;
|
||||
|
||||
use gpui::{
|
||||
actions, point, quad, AnyElement, App, Bounds, ClipboardItem, CursorStyle, DispatchPhase,
|
||||
Edges, Entity, FocusHandle, Focusable, FontStyle, FontWeight, GlobalElementId, Hitbox, Hsla,
|
||||
KeyContext, Length, MouseDownEvent, MouseEvent, MouseMoveEvent, MouseUpEvent, Point, Render,
|
||||
Stateful, StrikethroughStyle, StyleRefinement, StyledText, Task, TextLayout, TextRun,
|
||||
TextStyle, TextStyleRefinement,
|
||||
actions, point, quad, AnyElement, App, BorderStyle, Bounds, ClipboardItem, CursorStyle,
|
||||
DispatchPhase, Edges, Entity, FocusHandle, Focusable, FontStyle, FontWeight, GlobalElementId,
|
||||
Hitbox, Hsla, KeyContext, Length, MouseDownEvent, MouseEvent, MouseMoveEvent, MouseUpEvent,
|
||||
Point, Render, Stateful, StrikethroughStyle, StyleRefinement, StyledText, Task, TextLayout,
|
||||
TextRun, TextStyle, TextStyleRefinement,
|
||||
};
|
||||
use language::{Language, LanguageRegistry, Rope};
|
||||
use parser::{parse_links_only, parse_markdown, MarkdownEvent, MarkdownTag, MarkdownTagEnd};
|
||||
|
@ -353,6 +353,7 @@ impl MarkdownElement {
|
|||
self.style.selection_background_color,
|
||||
Edges::default(),
|
||||
Hsla::transparent_black(),
|
||||
BorderStyle::default(),
|
||||
));
|
||||
} else {
|
||||
window.paint_quad(quad(
|
||||
|
@ -364,6 +365,7 @@ impl MarkdownElement {
|
|||
self.style.selection_background_color,
|
||||
Edges::default(),
|
||||
Hsla::transparent_black(),
|
||||
BorderStyle::default(),
|
||||
));
|
||||
|
||||
if end_position.y > start_position.y + start_line_height {
|
||||
|
@ -376,6 +378,7 @@ impl MarkdownElement {
|
|||
self.style.selection_background_color,
|
||||
Edges::default(),
|
||||
Hsla::transparent_black(),
|
||||
BorderStyle::default(),
|
||||
));
|
||||
}
|
||||
|
||||
|
@ -388,6 +391,7 @@ impl MarkdownElement {
|
|||
self.style.selection_background_color,
|
||||
Edges::default(),
|
||||
Hsla::transparent_black(),
|
||||
BorderStyle::default(),
|
||||
));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue