Skip to content

0.27.0 - Nicer menus and new hit test logic

Compare
Choose a tag to compare
@emilk emilk released this 26 Mar 16:21
· 71 commits to master since this release

egui is an easy-to-use immediate mode GUI for Rust that runs on both web and native.

Try it now: https://www.egui.rs/

egui development is sponsored by Rerun, a startup building an SDK for visualizing streams of multimodal data.

egui changelog

The hit test logic (what is the user clicking on?) has been completely rewritten, and should now be much more accurate and helpful.
The hit test and interaction logic is run at the start of the frame, using the widgets rects from the previous frame, but the latest mouse coordinates.
It enabled getting a Response for a widget before creating it using Context::read_response.
This will in the future unlock more powerful widget styling options.
The new hit test also allows clicking slightly outside a button and still hit it, improving the support for touch screens.

The menus have also been improved so that they both act and feel better, with no change in API.
Included in this is much nicer looking shadows, supporting an offset.

Screenshot 2024-03-26 at 17 00 23

⚠️ BREAKING

  • Response::clicked* and Response::dragged* may lock the Context, so don't call it from a Context-locking closure.
  • Response::clicked_by will no longer be true if clicked with keyboard. Use Response::clicked instead.
  • Memory::focus has been renamed Memory::focused
  • Area::new now takes an Id by argument #4115
  • Change the definition of clicked_by #4192

☰ Menu related improvements

  • Add some distance between parent menu and submenu #4230
  • Add Area::sense and improve hit-testing of buttons in menus #4234
  • Improve logic for when submenus are kept open #4166
  • Better align menus with the button that opened them #4233
  • Hide hover UI when showing the context menu #4138 (thanks @abey79!)
  • CSS-like Shadow with offset, spread, and blur #4232
  • On touch screens, press-and-hold equals a secondary click #4195

⭐ Added

  • Add with_taskbar to viewport builder #3958 (thanks @AnotherNathan!)
  • Add F21 to F35 key bindings #4004 (thanks @oscargus!)
  • Add Options::debug_paint_interactive_widgets #4018
  • Add Ui::set_opacity #3965 (thanks @YgorSouza!)
  • Add Response::paint_debug_info() to make it easy to visualize a widget's id and state #4056 (thanks @abey79!)
  • Add layer transforms, interaction in layer #3906 (thanks @Tweoss!)
  • Add ColorImage::from_gray_iter #3536 (thanks @wangxiaochuTHU!)
  • Add API for raw mouse motion #4063 (thanks @GiantBlargg!)
  • Add accessibility to ProgressBar and Spinner #4139 (thanks @DataTriny!)
  • Add x11 window type settings to viewport builder #4175 (thanks @psethwick!)
  • Add an API for customizing the return key in TextEdit #4085 (thanks @lemon-sh!)
  • Convenience const fn for Margin, Rounding and Shadow #4080 (thanks @0Qwel!)
  • Serde feature: add serde derives to input related structs #4100 (thanks @gweisert!)
  • Give each menu Area an id distinct from the id of what was clicked #4114
  • epaint: Added Shape::{scale,translate} wrappers #4090 (thanks @varphone!)
  • A Window can now be resizable in only one direction #4155
  • Add EllipseShape #4122 (thanks @TheTacBanana!)
  • Adjustable Slider rail height #4092 (thanks @rustbasic!)
  • Expose state override for HeaderResponse #4200 (thanks @Zeenobit!)

🔧 Changed

  • TextEdit: Change margin property to egui::Margin type #3993 (thanks @bu5hm4nn!)
  • New widget interaction logic #4026
  • ui.dnd_drop_zone() now returns InnerResponse. #4079 (thanks @sowbug!)
  • Support interacting with the background of a Ui #4074
  • Quickly animate scroll when calling ui.scroll_to_cursor etc #4119
  • Don't clear modifier state on focus change #4157 (thanks @ming08108!)
  • Prevent egui::Window from becoming larger than viewport #4199 (thanks @rustbasic!)
  • Don't show URLs when hovering hyperlinks #4218

🐛 Fixed

  • Fix incorrect handling of item spacing in Window title bar #3995 (thanks @varphone!)
  • Make on_disabled_hover_ui respect tooltip_delay #4012 (thanks @YgorSouza!)
  • Fix TextEdit being too short whenever there is horizontal margin #4005 (thanks @gweisert!)
  • Fix Response::interact and Ui:interact_with_hovered #4013
  • Fix: Response.interact_pointer_pos is Some on click and drag released #4014
  • Fix custom Window Frames #4009 (thanks @varphone!)
  • Fix: images with background color now respects rounding #4029 (thanks @vincent-sparks!)
  • Fixed the incorrect display of the Window frame with a wide border or large rounding #4032 (thanks @varphone!)
  • TextEdit: fix crash when hitting SHIFT + TAB around non-ASCII text #3984 (thanks @rustbasic!)
  • Fix two ScrollArea bugs: leaking scroll target and broken animation to target offset #4174 (thanks @abey79!)
  • Fix bug in Context::parent_viewport_id #4190 (thanks @rustbasic!)
  • Remove unnecessary allocation in RepaintCause::new #4146 (thanks @valsteen!)

eframe changelog

  • Update to document-features 0.2.8 #4003
  • Added App::raw_input_hook allows for the manipulation or filtering of raw input events #4008 (thanks @varphone!)

Desktop/Native

Web

  • Add webgpu feature by default to wgpu #4124 (thanks @ctaggart!)
  • Update kb modifiers from web mouse events #4156 (thanks @ming08108!)
  • Fix crash on request_animation_frame when destroying web runner #4169 (thanks @jprochazk!)
  • Fix bug parsing url query with escaped & or = #4172
  • Location::query_map: support repeated key #4183