Skip to content

0.28.0 - Sizing pass, and better eframe web

Compare
Choose a tag to compare
@emilk emilk released this 03 Jul 13:02
· 215 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

✨ Highlights

🧳 Migration

  • Update MSRV to 1.76 (#4411)
  • The wrap/truncate functions on Label/Button/ComboBox no longer take bools as arguments. Use .wrap_mode(…) instead for more fine control (#4556)
  • Style::wrap has been deprecated in favor of Style::wrap_mode (#4556)
  • Ui::new and ui.child_ui now takes a new parameter for the UiStack (#4588)
  • The extra_asserts and extra_debug_asserts feature flags have been removed (#4478)
  • Remove Event::Scroll and handle it in egui. Use Event::MouseWheel instead (#4524)
  • Event::Zoom is no longer emitted on ctrl+scroll. Use InputState::smooth_scroll_delta instead (#4524)
  • ui.set_enabled and set_visbile have been deprecated (#4614)
  • DragValue::clamp_range renamed to range ((#4728)

⭐ Added

  • Overload operators for Rect + Margin, Rect - Margin etc #4277 by @emilk
  • Add Window::order #4301 by @alexparlett
  • Add a way to specify Undoer settings and construct Undoers more easily #4357 by @valadaptive
  • Add xtask crate #4293 by @YgorSouza
  • Add ViewportCommand::RequestCut, RequestCopy and RequestPaste to trigger clipboard actions #4035 by @bu5hm4nn
  • Added ability to define colors at UV coordinates along a path #4353 by @murl-digital
  • Add a Display impl for Vec2, Pos2, and Rect #4428 by @tgross35
  • Easing functions #4630 by @emilk
  • Add Options::line_scroll_speed and scroll_zoom_speed #4532 by @emilk
  • Add TextEdit::hint_text_font #4517 by @zaaarf
  • Add Options::reduce_texture_memory to free up RAM #4431 by @varphone
  • Add support for text truncation to egui::Style #4556 by @abey79
  • Add Response::show_tooltip_ui and show_tooltip_text #4580 by @emilk
  • Add opacity and multiply_opacity functions to Ui and Painter #4586 by @emilk
  • Add Key::Quote #4683 by @mkeeter
  • Improve backtraces when hovering widgets with modifiers pressed #4696 by @emilk
  • Add PopupCloseBehavior #4636 by @Umatriz
  • Add basic test for egui accesskit output #4716 by @Wcubed
  • Add clamp_to_range option to DragValue, rename clamp_range to range (deprecating the former) #4728 by @Wumpf
  • Add Style::number_formatter as the default used by DragValue #4740 by @emilk

🔧 Changed

  • Improve the UI for changing the egui theme #4257 by @emilk
  • Change the resize cursor when you reach the resize limit #4275 by @emilk
  • Make TextEdit an atomic widget #4276 by @emilk
  • Rename fn scroll2 to fn scroll #4282 by @emilk
  • Change Frame::multiply_with_opacity to multiply in gamma space #4283 by @emilk
  • Use parent Uis style for popups #4325 by @alexparlett
  • Take rounding into account when using Slider::trailing_fill #4308 by @rustbasic
  • Allow users to create viewports larger than monitor on Windows & macOS #4337 by @lopo12123
  • Improve ViewportBuilder::with_icon() documentation #4408 by @roccoblues
  • include_image! now accepts expressions #4521 by @YgorSouza
  • Remove scroll latency for smooth trackpads #4526 by @emilk
  • Smooth out zooming with discreet scroll wheel #4530 by @emilk
  • Make TextEdit::return_key optional #4543 by @doonv
  • Better spacing and sizes for (menu) buttons #4558 by @emilk
  • ComboBox: fix justified layout of popup if wider than parent button #4570 by @emilk
  • Make Area state public #4576 by @emilk
  • Don't persist Area size #4749 by @emilk
  • Round text galley sizes to nearest UI point size #4578 by @emilk
  • Once you have waited for a tooltip to show, show the next one right away #4585 by @emilk
  • Fade in windows, tooltips, popups, etc #4587 by @emilk
  • Make egu::menu types public #4544 by @sor-ca
  • The default constrain rect for Area/Window is now ctx.screen_rect #4590 by @emilk
  • Constrain Areas to screen by default #4591 by @emilk
  • Grid: set the sizing_pass flag during the initial sizing pass #4612 by @emilk
  • Remove special case for 0 in DragValue default formatter #4639 by @YgorSouza
  • Abort drags when pressing escape key #4678 by @emilk
  • Allow setting a layer as a sublayer of another #4690 by @YgorSouza
  • Close context menus with Escape #4711 by @emilk
  • Cancel DragValue edit if Escape is pressed #4713 by @YgorSouza
  • The default parser for DragValue and Slider now ignores whitespace #4739 by @emilk
  • Disabled widgets are now also disabled in the accesskit output #4750 by @Wcubed
  • Make it easier to grab the handle of a floating scroll bar #4754 by @emilk
  • When debugging widget rects on hover, show width and height #4762 by @emilk
  • Make sure all tooltips close if you open a menu in the same layer #4766 by @emilk

🐛 Fixed

  • Fix wrong replacement function in deprecation notice of drag_released* #4314 by @sornas
  • Consider layer transform when positioning text agent #4319 by @juancampa
  • Fix incorrect line breaks #4377 by @juancampa
  • Fix hex_color! macro by re-exporting color_hex crate from ecolor #4372 by @dataphract
  • Change Ui::allocate_painter to inherit properties from Ui #4343 by @varphone
  • Fix Panel incorrect size #4351 by @zhatuokun
  • Improve IME support with new Event::Ime #4358 by @rustbasic
  • Disable interaction for ScrollArea and Plot when UI is disabled #4457 by @varphone
  • Don't panic when replacement glyph is not found #4542 by @RyanBluth
  • Fix Ui::scroll_with_delta only scrolling if the ScrollArea is focused #4303 by @lucasmerlin
  • Handle tooltips so large that they cover the widget #4623 by @emilk
  • ScrollArea: Prevent drag interaction outside the area #4611 by @s-nie
  • Fix buggy interaction with widgets outside of clip rect #4675 by @emilk
  • Make sure contents of a panel don't overflow #4676 by @emilk
  • Fix: Response::hover_pos returns incorrect positions with layer transforms #4679 by @Creative0708
  • Fix: Menu popups and tooltips don't respect layer transforms #4708 by @Creative0708
  • Bug fix: report latest area size in Area::show response #4710 by @emilk
  • Ensure Window scroll bars are at the window edges #4733 by @emilk
  • Prevent TextEdit widgets from sending fake primary clicks #4751 by @Aliremu
  • Fix text selection when there's multiple viewports #4760 by @emilk
  • Use correct cursor icons when resizing panels too wide or narrow #4769 by @emilk

eframe changelog

✨ Highlights

The eframe web canvas now works properly when its a small part of a larger web page.
Previously this caused a lot of weird bugs, such as the eframe canvas stealing focus, and resizing the canvas in annoying ways.
Now it should all work seamlessly to have an eframe canvas as part of a web page, including having multiple different eframe apps next to each other.
As part of that the eframe canvas can now be focused (or not), just like an <input> HTML element.

We've also implemented a better method for sizing and positioning the canvas so that it yields pixel-perfect rendering on all known browsers except for Desktop Safari.
What this means is that text is much less likely to be blurry on web for users (#4536 by @jprochazk).

⭐ Added

🔧 Changed

🐛 Fixed

🧳 Migration

Wrap app creator in a Result

Applications can now return an error during the app creation (#4565 by @emilk), so you now need to wrap your Box<dyn App> in a Result like so:

- eframe::run_native("My App", options, Box::new(|cc| Box::new(MyApp::new(cc))));
+ eframe::run_native("My App", options, Box::new(|cc| Ok(Box::new(MyApp::new(cc)))));

Change web CSS

To make the eframe canvas fill the entire web browser, set its CSS to:

top: 0;
left: 0;
width: 100%;
height: 100%;

See index.html and #4536 for details.

Web canvas focus

If you are using eframe for a fullscreen app, you should call .focus() on your canvas during startup:

document.getElementById("the_canvas_id").focus();