Replace Stroke::none()
with Stroke::NONE
This commit is contained in:
parent
df01db2df1
commit
be6d23eed1
15 changed files with 30 additions and 28 deletions
|
@ -303,7 +303,7 @@ impl SidePanel {
|
||||||
// TOOD(emilk): distinguish resizable from non-resizable
|
// TOOD(emilk): distinguish resizable from non-resizable
|
||||||
ui.style().visuals.widgets.noninteractive.bg_stroke
|
ui.style().visuals.widgets.noninteractive.bg_stroke
|
||||||
} else {
|
} else {
|
||||||
Stroke::none()
|
Stroke::NONE
|
||||||
};
|
};
|
||||||
// TODO(emilk): draw line on top of all panels in this ui when https://github.com/emilk/egui/issues/1516 is done
|
// TODO(emilk): draw line on top of all panels in this ui when https://github.com/emilk/egui/issues/1516 is done
|
||||||
let resize_x = side.opposite().side_x(rect);
|
let resize_x = side.opposite().side_x(rect);
|
||||||
|
@ -752,7 +752,7 @@ impl TopBottomPanel {
|
||||||
// TOOD(emilk): distinguish resizable from non-resizable
|
// TOOD(emilk): distinguish resizable from non-resizable
|
||||||
ui.style().visuals.widgets.noninteractive.bg_stroke
|
ui.style().visuals.widgets.noninteractive.bg_stroke
|
||||||
} else {
|
} else {
|
||||||
Stroke::none()
|
Stroke::NONE
|
||||||
};
|
};
|
||||||
// TODO(emilk): draw line on top of all panels in this ui when https://github.com/emilk/egui/issues/1516 is done
|
// TODO(emilk): draw line on top of all panels in this ui when https://github.com/emilk/egui/issues/1516 is done
|
||||||
let resize_y = side.opposite().side_y(rect);
|
let resize_y = side.opposite().side_y(rect);
|
||||||
|
|
|
@ -66,10 +66,10 @@ impl std::ops::DerefMut for BarState {
|
||||||
|
|
||||||
fn set_menu_style(style: &mut Style) {
|
fn set_menu_style(style: &mut Style) {
|
||||||
style.spacing.button_padding = vec2(2.0, 0.0);
|
style.spacing.button_padding = vec2(2.0, 0.0);
|
||||||
style.visuals.widgets.active.bg_stroke = Stroke::none();
|
style.visuals.widgets.active.bg_stroke = Stroke::NONE;
|
||||||
style.visuals.widgets.hovered.bg_stroke = Stroke::none();
|
style.visuals.widgets.hovered.bg_stroke = Stroke::NONE;
|
||||||
style.visuals.widgets.inactive.bg_fill = Color32::TRANSPARENT;
|
style.visuals.widgets.inactive.bg_fill = Color32::TRANSPARENT;
|
||||||
style.visuals.widgets.inactive.bg_stroke = Stroke::none();
|
style.visuals.widgets.inactive.bg_stroke = Stroke::NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// The menu bar goes well in a [`TopBottomPanel::top`],
|
/// The menu bar goes well in a [`TopBottomPanel::top`],
|
||||||
|
|
|
@ -293,12 +293,12 @@ impl RichText {
|
||||||
let underline = if underline {
|
let underline = if underline {
|
||||||
crate::Stroke::new(1.0, line_color)
|
crate::Stroke::new(1.0, line_color)
|
||||||
} else {
|
} else {
|
||||||
crate::Stroke::none()
|
crate::Stroke::NONE
|
||||||
};
|
};
|
||||||
let strikethrough = if strikethrough {
|
let strikethrough = if strikethrough {
|
||||||
crate::Stroke::new(1.0, line_color)
|
crate::Stroke::new(1.0, line_color)
|
||||||
} else {
|
} else {
|
||||||
crate::Stroke::none()
|
crate::Stroke::NONE
|
||||||
};
|
};
|
||||||
|
|
||||||
let valign = if raised {
|
let valign = if raised {
|
||||||
|
|
|
@ -48,7 +48,7 @@ impl Widget for Link {
|
||||||
let underline = if response.hovered() || response.has_focus() {
|
let underline = if response.hovered() || response.has_focus() {
|
||||||
Stroke::new(visuals.fg_stroke.width, color)
|
Stroke::new(visuals.fg_stroke.width, color)
|
||||||
} else {
|
} else {
|
||||||
Stroke::none()
|
Stroke::NONE
|
||||||
};
|
};
|
||||||
|
|
||||||
ui.painter().add(epaint::TextShape {
|
ui.painter().add(epaint::TextShape {
|
||||||
|
|
|
@ -176,7 +176,7 @@ impl Widget for Label {
|
||||||
let underline = if response.has_focus() {
|
let underline = if response.has_focus() {
|
||||||
Stroke::new(1.0, response_color)
|
Stroke::new(1.0, response_color)
|
||||||
} else {
|
} else {
|
||||||
Stroke::none()
|
Stroke::NONE
|
||||||
};
|
};
|
||||||
|
|
||||||
let override_text_color = if text_galley.galley_has_color {
|
let override_text_color = if text_galley.galley_has_color {
|
||||||
|
|
|
@ -605,7 +605,7 @@ impl PlotItem for Polygon {
|
||||||
|
|
||||||
let fill = Rgba::from(stroke.color).to_opaque().multiply(fill_alpha);
|
let fill = Rgba::from(stroke.color).to_opaque().multiply(fill_alpha);
|
||||||
|
|
||||||
let shape = Shape::convex_polygon(values_tf.clone(), fill, Stroke::none());
|
let shape = Shape::convex_polygon(values_tf.clone(), fill, Stroke::NONE);
|
||||||
shapes.push(shape);
|
shapes.push(shape);
|
||||||
values_tf.push(*values_tf.first().unwrap());
|
values_tf.push(*values_tf.first().unwrap());
|
||||||
style.style_line(values_tf, *stroke, *highlight, shapes);
|
style.style_line(values_tf, *stroke, *highlight, shapes);
|
||||||
|
|
|
@ -78,12 +78,8 @@ impl Widget for ProgressBar {
|
||||||
|
|
||||||
let visuals = ui.style().visuals.clone();
|
let visuals = ui.style().visuals.clone();
|
||||||
let rounding = outer_rect.height() / 2.0;
|
let rounding = outer_rect.height() / 2.0;
|
||||||
ui.painter().rect(
|
ui.painter()
|
||||||
outer_rect,
|
.rect(outer_rect, rounding, visuals.extreme_bg_color, Stroke::NONE);
|
||||||
rounding,
|
|
||||||
visuals.extreme_bg_color,
|
|
||||||
Stroke::none(),
|
|
||||||
);
|
|
||||||
let inner_rect = Rect::from_min_size(
|
let inner_rect = Rect::from_min_size(
|
||||||
outer_rect.min,
|
outer_rect.min,
|
||||||
vec2(
|
vec2(
|
||||||
|
@ -103,7 +99,7 @@ impl Widget for ProgressBar {
|
||||||
inner_rect,
|
inner_rect,
|
||||||
rounding,
|
rounding,
|
||||||
Color32::from(Rgba::from(visuals.selection.bg_fill) * color_factor as f32),
|
Color32::from(Rgba::from(visuals.selection.bg_fill) * color_factor as f32),
|
||||||
Stroke::none(),
|
Stroke::NONE,
|
||||||
);
|
);
|
||||||
|
|
||||||
if animate {
|
if animate {
|
||||||
|
|
|
@ -49,7 +49,7 @@ impl FractalClock {
|
||||||
ui.expand_to_include_rect(painter.clip_rect());
|
ui.expand_to_include_rect(painter.clip_rect());
|
||||||
|
|
||||||
Frame::popup(ui.style())
|
Frame::popup(ui.style())
|
||||||
.stroke(Stroke::none())
|
.stroke(Stroke::NONE)
|
||||||
.show(ui, |ui| {
|
.show(ui, |ui| {
|
||||||
ui.set_max_width(270.0);
|
ui.set_max_width(270.0);
|
||||||
CollapsingHeader::new("Settings")
|
CollapsingHeader::new("Settings")
|
||||||
|
|
|
@ -165,13 +165,13 @@ fn format_from_style(
|
||||||
let underline = if emark_style.underline {
|
let underline = if emark_style.underline {
|
||||||
Stroke::new(1.0, color)
|
Stroke::new(1.0, color)
|
||||||
} else {
|
} else {
|
||||||
Stroke::none()
|
Stroke::NONE
|
||||||
};
|
};
|
||||||
|
|
||||||
let strikethrough = if emark_style.strikethrough {
|
let strikethrough = if emark_style.strikethrough {
|
||||||
Stroke::new(1.0, color)
|
Stroke::new(1.0, color)
|
||||||
} else {
|
} else {
|
||||||
Stroke::none()
|
Stroke::NONE
|
||||||
};
|
};
|
||||||
|
|
||||||
let valign = if emark_style.raised {
|
let valign = if emark_style.raised {
|
||||||
|
|
|
@ -358,7 +358,7 @@ impl Highlighter {
|
||||||
let underline = if underline {
|
let underline = if underline {
|
||||||
egui::Stroke::new(1.0, text_color)
|
egui::Stroke::new(1.0, text_color)
|
||||||
} else {
|
} else {
|
||||||
egui::Stroke::none()
|
egui::Stroke::NONE
|
||||||
};
|
};
|
||||||
job.sections.push(LayoutSection {
|
job.sections.push(LayoutSection {
|
||||||
leading_space: 0.0,
|
leading_space: 0.0,
|
||||||
|
|
|
@ -648,7 +648,7 @@ impl TextShape {
|
||||||
Self {
|
Self {
|
||||||
pos,
|
pos,
|
||||||
galley,
|
galley,
|
||||||
underline: Stroke::none(),
|
underline: Stroke::NONE,
|
||||||
override_text_color: None,
|
override_text_color: None,
|
||||||
angle: 0.0,
|
angle: 0.0,
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,6 +14,12 @@ pub struct Stroke {
|
||||||
|
|
||||||
impl Stroke {
|
impl Stroke {
|
||||||
/// Same as [`Stroke::default`].
|
/// Same as [`Stroke::default`].
|
||||||
|
pub const NONE: Stroke = Stroke {
|
||||||
|
width: 0.0,
|
||||||
|
color: Color32::TRANSPARENT,
|
||||||
|
};
|
||||||
|
|
||||||
|
#[deprecated = "Use Stroke::NONE instead"]
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
pub fn none() -> Self {
|
pub fn none() -> Self {
|
||||||
Self::new(0.0, Color32::TRANSPARENT)
|
Self::new(0.0, Color32::TRANSPARENT)
|
||||||
|
|
|
@ -1412,7 +1412,7 @@ impl Tessellator {
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
|
|
||||||
if *underline != Stroke::none() {
|
if *underline != Stroke::NONE {
|
||||||
self.scratchpad_path.clear();
|
self.scratchpad_path.clear();
|
||||||
self.scratchpad_path
|
self.scratchpad_path
|
||||||
.add_line_segment([row_rect.left_bottom(), row_rect.right_bottom()]);
|
.add_line_segment([row_rect.left_bottom(), row_rect.right_bottom()]);
|
||||||
|
|
|
@ -493,8 +493,8 @@ fn format_summary(job: &LayoutJob) -> FormatSummary {
|
||||||
let mut format_summary = FormatSummary::default();
|
let mut format_summary = FormatSummary::default();
|
||||||
for section in &job.sections {
|
for section in &job.sections {
|
||||||
format_summary.any_background |= section.format.background != Color32::TRANSPARENT;
|
format_summary.any_background |= section.format.background != Color32::TRANSPARENT;
|
||||||
format_summary.any_underline |= section.format.underline != Stroke::none();
|
format_summary.any_underline |= section.format.underline != Stroke::NONE;
|
||||||
format_summary.any_strikethrough |= section.format.strikethrough != Stroke::none();
|
format_summary.any_strikethrough |= section.format.strikethrough != Stroke::NONE;
|
||||||
}
|
}
|
||||||
format_summary
|
format_summary
|
||||||
}
|
}
|
||||||
|
@ -665,7 +665,7 @@ fn add_row_hline(
|
||||||
for glyph in &row.glyphs {
|
for glyph in &row.glyphs {
|
||||||
let (stroke, y) = stroke_and_y(glyph);
|
let (stroke, y) = stroke_and_y(glyph);
|
||||||
|
|
||||||
if stroke == Stroke::none() {
|
if stroke == Stroke::NONE {
|
||||||
end_line(line_start.take(), last_right_x);
|
end_line(line_start.take(), last_right_x);
|
||||||
} else if let Some((existing_stroke, start)) = line_start {
|
} else if let Some((existing_stroke, start)) = line_start {
|
||||||
if existing_stroke == stroke && start.y == y {
|
if existing_stroke == stroke && start.y == y {
|
||||||
|
|
|
@ -238,8 +238,8 @@ impl Default for TextFormat {
|
||||||
color: Color32::GRAY,
|
color: Color32::GRAY,
|
||||||
background: Color32::TRANSPARENT,
|
background: Color32::TRANSPARENT,
|
||||||
italics: false,
|
italics: false,
|
||||||
underline: Stroke::none(),
|
underline: Stroke::NONE,
|
||||||
strikethrough: Stroke::none(),
|
strikethrough: Stroke::NONE,
|
||||||
valign: Align::BOTTOM,
|
valign: Align::BOTTOM,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue