Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/emilk/egui into comment-l…
Browse files Browse the repository at this point in the history
…inks
  • Loading branch information
4JX committed Apr 1, 2022
1 parent e454a52 commit 34e0cf8
Show file tree
Hide file tree
Showing 39 changed files with 1,956 additions and 72 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ NOTE: [`epaint`](epaint/CHANGELOG.md), [`eframe`](eframe/CHANGELOG.md), [`egui_w
* `ClippedMesh` has been replaced with `ClippedPrimitive` ([#1351](https://github.com/emilk/egui/pull/1351)).
* Renamed `Frame::margin` to `Frame::inner_margin`.
* Renamed `AlphaImage` to `FontImage` to discourage any other use for it ([#1412](https://github.com/emilk/egui/pull/1412)).
* `dark-light` (dark mode detection) is now an opt-in feature for `eframe` and `egui_glow` ([#1437](https://github.com/emilk/egui/pull/1437)).

### Fixed 🐛
* Fixed ComboBoxes always being rendered left-aligned ([#1304](https://github.com/emilk/egui/pull/1304)).
Expand Down
52 changes: 24 additions & 28 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions eframe/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ NOTE: [`egui_web`](../egui_web/CHANGELOG.md), [`egui-winit`](../egui-winit/CHANG
* You can now load/save state in `App::update`
* Changed `App::update` to take `&mut Frame` instead of `&Frame`.
* `Frame` is no longer `Clone` or `Sync`.
* Add `glow` (OpenGL) context to `Frame` ([#1425](https://github.com/emilk/egui/pull/1425)).


## 0.17.0 - 2022-02-22
Expand Down
2 changes: 2 additions & 0 deletions eframe/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ screen_reader = [
"egui_web/screen_reader",
]

dark-light = [ "egui-winit/dark-light"] # detect dark mode system preference


[dependencies]
egui = { version = "0.17.0", path = "../egui", default-features = false }
Expand Down
1 change: 1 addition & 0 deletions egui-winit/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ All notable changes to the `egui-winit` integration will be noted in this file.


## Unreleased
* Reexport `egui` crate


## 0.17.0 - 2022-02-22
Expand Down
2 changes: 2 additions & 0 deletions egui-winit/src/epi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ pub struct EpiIntegration {
impl EpiIntegration {
pub fn new(
integration_name: &'static str,
gl: std::rc::Rc<glow::Context>,
max_texture_side: usize,
window: &winit::window::Window,
storage: Option<Box<dyn epi::Storage>>,
Expand All @@ -169,6 +170,7 @@ impl EpiIntegration {
},
output: Default::default(),
storage,
gl,
};

if prefer_dark_mode == Some(true) {
Expand Down
1 change: 1 addition & 0 deletions egui-winit/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#![allow(clippy::manual_range_contains)]

pub use egui;
pub use winit;

pub mod clipboard;
Expand Down
6 changes: 3 additions & 3 deletions egui/src/containers/panel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ impl SidePanel {
let mut is_resizing = false;
if resizable {
let resize_id = id.with("__resize");
if let Some(pointer) = ui.ctx().latest_pointer_pos() {
if let Some(pointer) = ui.ctx().pointer_latest_pos() {
let we_are_on_top = ui
.ctx()
.layer_id_at(pointer)
Expand All @@ -217,9 +217,9 @@ impl SidePanel {
&& ui.input().pointer.any_down()
&& mouse_over_resize_line
{
ui.memory().interaction.drag_id = Some(resize_id);
ui.memory().set_dragged_id(resize_id);
}
is_resizing = ui.memory().interaction.drag_id == Some(resize_id);
is_resizing = ui.memory().is_being_dragged(resize_id);
if is_resizing {
let width = (pointer.x - side.side_x(panel_rect)).abs();
let width =
Expand Down
2 changes: 1 addition & 1 deletion egui/src/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -885,7 +885,7 @@ impl Context {
/// Latest reported pointer position.
/// When tapping a touch screen, this will be `None`.
#[inline(always)]
pub(crate) fn latest_pointer_pos(&self) -> Option<Pos2> {
pub fn pointer_latest_pos(&self) -> Option<Pos2> {
self.input().pointer.latest_pos()
}

Expand Down
2 changes: 1 addition & 1 deletion egui/src/introspection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ pub(crate) fn font_texture_ui(ui: &mut Ui, [width, height]: [usize; 2]) -> Respo
response
.on_hover_cursor(CursorIcon::ZoomIn)
.on_hover_ui_at_pointer(|ui| {
if let Some(pos) = ui.ctx().latest_pointer_pos() {
if let Some(pos) = ui.ctx().pointer_latest_pos() {
let (_id, zoom_rect) = ui.allocate_space(vec2(128.0, 128.0));
let u = remap_clamp(pos.x, rect.x_range(), 0.0..=tex_w);
let v = remap_clamp(pos.y, rect.y_range(), 0.0..=tex_h);
Expand Down
5 changes: 5 additions & 0 deletions egui/src/memory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -418,6 +418,11 @@ impl Memory {
self.interaction.drag_id == Some(id)
}

#[inline(always)]
pub fn set_dragged_id(&mut self, id: Id) {
self.interaction.drag_id = Some(id);
}

/// Forget window positions, sizes etc.
/// Can be used to auto-layout windows.
pub fn reset_areas(&mut self) {
Expand Down
4 changes: 2 additions & 2 deletions egui/src/style.rs
Original file line number Diff line number Diff line change
Expand Up @@ -636,7 +636,7 @@ impl Visuals {
widgets: Widgets::default(),
selection: Selection::default(),
hyperlink_color: Color32::from_rgb(90, 170, 255),
faint_bg_color: Color32::from_gray(24),
faint_bg_color: Color32::from_gray(35),
extreme_bg_color: Color32::from_gray(10), // e.g. TextEdit background
code_bg_color: Color32::from_gray(64),
window_rounding: Rounding::same(6.0),
Expand All @@ -658,7 +658,7 @@ impl Visuals {
widgets: Widgets::light(),
selection: Selection::light(),
hyperlink_color: Color32::from_rgb(0, 155, 255),
faint_bg_color: Color32::from_gray(245),
faint_bg_color: Color32::from_gray(242),
extreme_bg_color: Color32::from_gray(255), // e.g. TextEdit background
code_bg_color: Color32::from_gray(230),
window_shadow: Shadow::big_light(),
Expand Down
2 changes: 1 addition & 1 deletion egui/src/ui.rs
Original file line number Diff line number Diff line change
Expand Up @@ -792,7 +792,7 @@ impl Ui {
/// So one can think of `cursor` as a constraint on the available region.
///
/// If something has already been added, this will point to `style.spacing.item_spacing` beyond the latest child.
/// The cursor can thus be `style.spacing.item_spacing` pixels outside of the min_rect.
/// The cursor can thus be `style.spacing.item_spacing` pixels outside of the `min_rect`.
pub fn cursor(&self) -> Rect {
self.placer.cursor()
}
Expand Down
12 changes: 9 additions & 3 deletions egui_demo_lib/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,21 @@ all-features = true


[features]
default = ["chrono"]
default = ["datetime"]

# Enable additional checks if debug assertions are enabled (debug builds).
extra_debug_asserts = ["egui/extra_debug_asserts"]
# Always enable additional checks.
extra_asserts = ["egui/extra_asserts"]

datetime = ["egui_extras/chrono", "chrono"]
http = ["egui_extras", "ehttp", "image", "poll-promise"]
persistence = ["egui/persistence", "epi/persistence", "serde"]
persistence = [
"egui/persistence",
"epi/persistence",
"egui_extras/persistence",
"serde",
]
serialize = ["egui/serialize", "serde"]
syntax_highlighting = ["syntect"]

Expand All @@ -45,6 +51,7 @@ unicode_names2 = { version = "0.5.0", default-features = false }
# feature "http":
egui_extras = { version = "0.17.0", path = "../egui_extras", optional = true, features = [
"image",
"datepicker",
] }
ehttp = { version = "0.2.0", optional = true }
image = { version = "0.24", optional = true, default-features = false, features = [
Expand All @@ -64,7 +71,6 @@ serde = { version = "1", optional = true, features = ["derive"] }
[dev-dependencies]
criterion = { version = "0.3", default-features = false }


[[bench]]
name = "benchmark"
harness = false
2 changes: 2 additions & 0 deletions egui_demo_lib/src/apps/demo/demo_app_windows.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ impl Default for Demos {
Box::new(super::plot_demo::PlotDemo::default()),
Box::new(super::scrolling::Scrolling::default()),
Box::new(super::sliders::Sliders::default()),
Box::new(super::strip_demo::StripDemo::default()),
Box::new(super::table_demo::TableDemo::default()),
Box::new(super::text_edit::TextEdit::default()),
Box::new(super::widget_gallery::WidgetGallery::default()),
Box::new(super::window_options::WindowOptions::default()),
Expand Down
2 changes: 2 additions & 0 deletions egui_demo_lib/src/apps/demo/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ pub mod password;
pub mod plot_demo;
pub mod scrolling;
pub mod sliders;
pub mod strip_demo;
pub mod table_demo;
pub mod tests;
pub mod text_edit;
pub mod toggle_switch;
Expand Down
Loading

0 comments on commit 34e0cf8

Please sign in to comment.