Skip to content

Commit 0bad1d0

Browse files
authored
Plot interaction methods (#766)
* move to a basic plot builder with callback * add some interaction methods * move interaction demo to its own panel
1 parent 6018c0e commit 0bad1d0

File tree

7 files changed

+277
-176
lines changed

7 files changed

+277
-176
lines changed

CHANGELOG.md

+3
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,15 @@ NOTE: [`epaint`](epaint/CHANGELOG.md), [`eframe`](eframe/CHANGELOG.md), [`egui_w
1212
* You can now read and write the cursor of a `TextEdit` ([#848](https://github.com/emilk/egui/pull/848)).
1313
* Most widgets containing text (`Label`, `Button` etc) now supports rich text ([#855](https://github.com/emilk/egui/pull/855)).
1414
* When using a custom font you can now specify a font index ([#873](https://github.com/emilk/egui/pull/873)).
15+
* You can now read the plot coordinates of the mouse when building a `Plot` ([#766](https://github.com/emilk/egui/pull/766)).
1516

1617
### Changed 🔧
1718
* Unifiy the four `Memory` data buckets (`data`, `data_temp`, `id_data` and `id_data_temp`) into a single `Memory::data`, with a new interface ([#836](https://github.com/emilk/egui/pull/836)).
1819
* `ui.add(Button::new("…").text_color(…))` is now `ui.button(RichText::new("…").color(…))` (same for `Label` )([#855](https://github.com/emilk/egui/pull/855)).
1920
* Replace `CtxRef::begin_frame` and `end_frame` with `CtxRef::run` ([#872](https://github.com/emilk/egui/pull/872)).
2021
* Replace `Ui::__test` with `egui::__run_test_ui` ([#872](https://github.com/emilk/egui/pull/872)).
2122
* Replace `scroll_delta` and `zoom_delta` in `RawInput` with `Event::Scroll` and `Event::Zoom`.
23+
* Plots now provide a `show` method that has to be used to add items to and show the plot ([#766](https://github.com/emilk/egui/pull/766)).
2224

2325
### Fixed 🐛
2426
* Fix `ComboBox` and other popups getting clipped to parent window ([#885](https://github.com/emilk/egui/pull/885)).
@@ -33,6 +35,7 @@ NOTE: [`epaint`](epaint/CHANGELOG.md), [`eframe`](eframe/CHANGELOG.md), [`egui_w
3335
* [sumibi-yakitori](https://github.com/sumibi-yakitori) ([#830](https://github.com/emilk/egui/pull/830))
3436
* [5225225](https://github.com/5225225): ([#849](https://github.com/emilk/egui/pull/849)).
3537
* [t18b219k](https://github.com/t18b219k): ([#868](https://github.com/emilk/egui/pull/868)).
38+
* [EmbersArc](https://github.com/EmbersArc): ([#766](https://github.com/emilk/egui/pull/766)).
3639

3740

3841
## 0.15.0 - 2021-10-24 - Syntax highlighting and hscroll

egui/src/widgets/plot/items.rs

+10
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,16 @@ impl Value {
3030
y: y.into(),
3131
}
3232
}
33+
34+
#[inline(always)]
35+
pub fn to_pos2(self) -> Pos2 {
36+
Pos2::new(self.x as f32, self.y as f32)
37+
}
38+
39+
#[inline(always)]
40+
pub fn to_vec2(self) -> Vec2 {
41+
Vec2::new(self.x as f32, self.y as f32)
42+
}
3343
}
3444

3545
// ----------------------------------------------------------------------------

0 commit comments

Comments
 (0)