Skip to content

Commit 3418eb5

Browse files
authored
Make Plot::highlight take a boolean (#1159)
1 parent 9d59696 commit 3418eb5

File tree

2 files changed

+21
-20
lines changed

2 files changed

+21
-20
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ NOTE: [`epaint`](epaint/CHANGELOG.md), [`eframe`](eframe/CHANGELOG.md), [`egui_w
3232
* Replaced `Style::body_text_style` with more generic `Style::text_styles` ([#1154](https://github.com/emilk/egui/pull/1154)).
3333
* `TextStyle` is no longer `Copy` ([#1154](https://github.com/emilk/egui/pull/1154)).
3434
* Replaced `TextEdit::text_style` with `TextEdit::font` ([#1154](https://github.com/emilk/egui/pull/1154)).
35+
* `Plot::highlight` now takes a `bool` argument ([#1159](https://github.com/emilk/egui/pull/1159)),
3536

3637
### Fixed 🐛
3738
* Context menu now respects the theme ([#1043](https://github.com/emilk/egui/pull/1043))

egui/src/widgets/plot/items/mod.rs

+20-20
Original file line numberDiff line numberDiff line change
@@ -117,8 +117,8 @@ impl HLine {
117117
}
118118

119119
/// Highlight this line in the plot by scaling up the line.
120-
pub fn highlight(mut self) -> Self {
121-
self.highlight = true;
120+
pub fn highlight(mut self, highlight: bool) -> Self {
121+
self.highlight = highlight;
122122
self
123123
}
124124

@@ -227,8 +227,8 @@ impl VLine {
227227
}
228228

229229
/// Highlight this line in the plot by scaling up the line.
230-
pub fn highlight(mut self) -> Self {
231-
self.highlight = true;
230+
pub fn highlight(mut self, highlight: bool) -> Self {
231+
self.highlight = highlight;
232232
self
233233
}
234234

@@ -338,8 +338,8 @@ impl Line {
338338
}
339339

340340
/// Highlight this line in the plot by scaling up the line.
341-
pub fn highlight(mut self) -> Self {
342-
self.highlight = true;
341+
pub fn highlight(mut self, highlight: bool) -> Self {
342+
self.highlight = highlight;
343343
self
344344
}
345345

@@ -506,8 +506,8 @@ impl Polygon {
506506

507507
/// Highlight this polygon in the plot by scaling up the stroke and reducing the fill
508508
/// transparency.
509-
pub fn highlight(mut self) -> Self {
510-
self.highlight = true;
509+
pub fn highlight(mut self, highlight: bool) -> Self {
510+
self.highlight = highlight;
511511
self
512512
}
513513

@@ -635,8 +635,8 @@ impl Text {
635635
}
636636

637637
/// Highlight this text in the plot by drawing a rectangle around it.
638-
pub fn highlight(mut self) -> Self {
639-
self.highlight = true;
638+
pub fn highlight(mut self, highlight: bool) -> Self {
639+
self.highlight = highlight;
640640
self
641641
}
642642

@@ -763,8 +763,8 @@ impl Points {
763763
}
764764

765765
/// Highlight these points in the plot by scaling up their markers.
766-
pub fn highlight(mut self) -> Self {
767-
self.highlight = true;
766+
pub fn highlight(mut self, highlight: bool) -> Self {
767+
self.highlight = highlight;
768768
self
769769
}
770770

@@ -979,8 +979,8 @@ impl Arrows {
979979
}
980980

981981
/// Highlight these arrows in the plot.
982-
pub fn highlight(mut self) -> Self {
983-
self.highlight = true;
982+
pub fn highlight(mut self, highlight: bool) -> Self {
983+
self.highlight = highlight;
984984
self
985985
}
986986

@@ -1105,8 +1105,8 @@ impl PlotImage {
11051105
}
11061106

11071107
/// Highlight this image in the plot.
1108-
pub fn highlight(mut self) -> Self {
1109-
self.highlight = true;
1108+
pub fn highlight(mut self, highlight: bool) -> Self {
1109+
self.highlight = highlight;
11101110
self
11111111
}
11121112

@@ -1295,8 +1295,8 @@ impl BarChart {
12951295
}
12961296

12971297
/// Highlight all plot elements.
1298-
pub fn highlight(mut self) -> Self {
1299-
self.highlight = true;
1298+
pub fn highlight(mut self, highlight: bool) -> Self {
1299+
self.highlight = highlight;
13001300
self
13011301
}
13021302

@@ -1458,8 +1458,8 @@ impl BoxPlot {
14581458
}
14591459

14601460
/// Highlight all plot elements.
1461-
pub fn highlight(mut self) -> Self {
1462-
self.highlight = true;
1461+
pub fn highlight(mut self, highlight: bool) -> Self {
1462+
self.highlight = highlight;
14631463
self
14641464
}
14651465

0 commit comments

Comments
 (0)