Commit graph

153 commits

Author SHA1 Message Date
Luke Jones
be4a5be145
egui_glow: update example to latest glutin (#2396)
This lifts the context handling from commit hash 8eb687c as this does
all the required handling for us that the older glutin once did.
2022-12-06 10:02:20 +01:00
Emil Ernerfeldt
b8a1670781 Change demo keyboard shortcuts to some that work in the browser 2022-12-05 17:57:11 +01:00
Emil Ernerfeldt
a86ec5a749 Remove extra separator in color test 2022-12-05 17:38:38 +01:00
Emil Ernerfeldt
8ae4d49e6e More changelog updates 2022-12-05 17:38:30 +01:00
Mike Krüger
ee2582964d
Added KeyRepeat event. (#2389)
KeyPress no longer repeats.

Co-authored-by: Mike Krueger <mkrueger@posteo.de>
2022-12-05 17:37:25 +01:00
Emil Ernerfeldt
3519358b7b Clippy fix 2022-12-05 13:41:25 +01:00
Emil Ernerfeldt
be6d23eed1 Replace Stroke::none() with Stroke::NONE 2022-12-05 12:59:02 +01:00
Emil Ernerfeldt
df01db2df1 Add show_separator_line to SidePanel and TopBottomPanel
So as not to force it onto all users since #2261
2022-12-05 12:58:26 +01:00
Emil Ernerfeldt
aa503008ae Update changelogs with recent additions 2022-12-05 12:51:00 +01:00
Red Artist
8eb687cf04
Glutin Upgrade (#2187)
* working. but x11 blurry

* fixed x11 blurry. was just accidentally using multisampling even when user didnt request it

* allow dbg macro temporarily

* add windows WGL fallback support when EGL fails

* fmt

* glutin features explicitly added

* extract glutin context creation into a fn

* fix warnings
2022-12-05 11:34:28 +01:00
Emil Ernerfeldt
3ba39c3022
Hide all Area:s and Window:s the first frame to hide first-frame-jitters (#2385) 2022-12-05 11:18:01 +01:00
Emil Ernerfeldt
0b2d56cff0
Grid: special-treat first frame to fix bug causing expanding grids (#2384) 2022-12-05 11:16:37 +01:00
Emil Ernerfeldt
4e59296cbb Minor code tweaks 2022-12-05 09:45:07 +01:00
Emil Ernerfeldt
5093b67e9b Enable and fix some more clippy lints 2022-12-05 09:29:59 +01:00
Matt Campbell
e1f348e4b2
Implement accessibility APIs via AccessKit (#2294)
* squash before rebase

* Update AccessKit, introducing support for editable spinners on Windows and an important fix for navigation order on macOS

* Restore support for increment and decrement actions in DragValue

* Avoid VoiceOver race condition bug

* fix clippy lint

* Tell AccessKit that the default action for a text edit (equivalent to a click) is to set the focus. This matters to some platform adapters.

* Refactor InputState functions for AccessKit actions

* Support the AccessKit SetValue for DragValue; this is the only way for a Windows AT to programmatically adjust the value

* Same for Slider

* Properly associate the slider label with both the slider and the drag value

* Lazily activate egui's AccessKit support

* fix clippy lint

* Update AccessKit

* More documentation, particularly around lazy activation

* Tweak one of the doc comments

* See if I can get AccessKit exempted from the 'missing backticks' lint

* Make PlatformOutput::accesskit_update an Option

* Refactor lazy activation

* Refactor node mutation (again)

* Eliminate the need for an explicit is_accesskit_active method, at least for now

* Fix doc comment

* More refactoring of tree construction; don't depend on Arc::get_mut

* Override a clippy lint; I seem to have no other choice

* Final planned refactor: a more flexible approach to hierarchy

* Last AccessKit update for this PR; includes an important macOS DPI fix

* Move and document the optional accesskit dependency

* Fix comment typo

Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>

* reformat

* More elegant code for conditionally creating a node

Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>

* Set step to 1.0 for all integer sliders

* Add doc example for Response::labelled_by

* Clarify a TODO comment I left for myself

Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>
2022-12-04 19:17:12 +01:00
Emil Ernerfeldt
48666e1d7a
Automatically generate screenshots for all examples (#2379) 2022-12-04 17:27:40 +01:00
Emil Ernerfeldt
ec0b2d8e9a Deprecate ui.centered
It didn't do what it advertised to do, and there is no simple way
of doing that right now.
2022-12-04 10:16:37 +01:00
Emil Ernerfeldt
c8771cd13e Add some minor improvements for debugging id clashes 2022-12-02 09:52:26 +01:00
Emil Ernerfeldt
7133818c59
Make sure scroll bars are always visible (#2371)
* Nicer debug rectangles

* Move scrollbars into the clip-rect so they are always visible

* Improve table demo

* Add options for controlling inner and outer margin of the scroll bars

* Add line to changelog

* Update egui_extras changelog with recent Table improvements

* Refactor Table:s scroll options

* Add Table::auto_size

* Rename it auto_shrink
2022-11-30 22:58:00 +01:00
JP
85f8eeb9d5
Fix key pressed event (#2334)
* Fix key press event

* Add example with key presses

* Changelog line for key_press fix

* PR review improvements

* Add PR link in changelog

Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>
2022-11-30 20:40:11 +01:00
Emil Ernerfeldt
2dc2a5540d
egui_extras::Table improvements (#2369)
* Use simple `ui.interact` for the resize line

* Introduce TableReizeState

* Simplify some code

* Add striped options to table demo

* Auto-size table columns by double-clicking the resize line

* Table: add option to auto-size the columns

* Table: don't let column width gets too small, unless clipping is on

* egui_extras: always use serde

Otherwise using `get_persisted` etc is impossible,
and working around that tedious.

* Avoid clipping last column in a resizable table

* Some better naming

* Table: Use new `Column` for setting column sizes and properties

Also make `clip` a per-column property

* All Table:s store state for auto-sizing purposes

* Customize each column wether or not it is resizable

* fix some auto-sizing bugs

* Fix shrinkage of adaptive column content

* Rename `scroll` to `vscroll` for clarity

* Add Table::scroll_to_row

* scroll_to_row takes alignment

* Fix bug in table sizing

* Strip: turn clipping OFF by default, because it is dangerous and sucks

* Add TableBody::mac_rect helper

* Table: add options to control the scroll area height.

* Docstring fixes

* Cleanup
2022-11-30 19:56:06 +01:00
Matt Campbell
0336816faf
Fix keyboard support in DragValue (#2342)
* Enable incrementing and decrementing `DragValue` with the keyboard

* As soon as a DragValue is focused, render it in edit mode

* Simpler, more reliable approach to managing the drag value's edit string

* Add changelog entry

* Update doc comment

Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>

* Add comment explaining why we don't listen for left/right arrow

Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>
2022-11-29 15:27:14 +01:00
Fotis Gimian
975cbac83a
Update the glow example to avoid a white flash when the app starts. (#2345) 2022-11-29 15:04:17 +01:00
Emil Ernerfeldt
a3f1e5961f Fix bug in keyboard shortcut formatting 2022-11-27 22:03:42 +01:00
Erlend Walstad
c5e6def65e
Only update pixels_per_point when it has changed (#2352) 2022-11-27 17:22:45 +01:00
Erlend Walstad
d2f70cdcd1
Make it easier to convert strings to Id (#2350) 2022-11-27 13:15:18 +01:00
Nagy Tibor
502e1aa229
Do not emit changed responses on unchanged values in selectable_value/radio_value (#2343) 2022-11-25 22:23:56 +01:00
Lukas Hermann
f9066ff285
[WGPU] Allow for depth buffer in web target (#2335)
* Add depth stencil initialization to `Painter`

* Move depth stencil initialization into `resize_and_generate_depth_texture_view`, and call it in `set_window` and `on_window_resized`

* Allow for depth texture in WASM builds

* change `map` to `if let` statement

* use reference for render state

* Clean up descriptors and move texture generation to on resize events

* remove unused field from WebOptions
2022-11-24 20:40:53 +01:00
Felix Zwettler
f3633534e7
add set_plot_bounds method, giving users the ability to set the plot bounds themselves. (#2320)
* add set_plot_bounds method

* call it from_min_max for consistency with Rect

Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>
2022-11-22 15:05:23 +01:00
Emil Ernerfeldt
bde47c9957
epaint: cover default fonts in the license field (#2327) 2022-11-22 13:44:01 +01:00
Emil Ernerfeldt
8602326af5 Plot: round hlines, vlines, and grid lines to pixels to avoid aliasing 2022-11-22 13:42:52 +01:00
Emil Ernerfeldt
8671aa26e1 Added support for thin space
https://en.wikipedia.org/wiki/Thin_space
2022-11-21 17:33:23 +01:00
Emil Ernerfeldt
1c8cf9e3d5
Move egui::util::History to emath::History (#2329)
* Move egui::util::History to emath::History

It is a nice thing to use outside of egui,
and it is more math-related than gui-related.

* Fix doctest
2022-11-21 14:14:33 +01:00
Lukas Hermann
f4d8ab9779
[wgpu] Add depth stencil initialization to Painter (#2316) 2022-11-21 10:08:24 +01:00
Clement Rey
dfc1f2c470
add plot_secondary_clicked to plot_ui (#2318) 2022-11-17 17:07:42 +01:00
Emil Ernerfeldt
eca5e6a4d2
Update to Rust 1.65 (#2314)
* Update to Rust 1.65

Because then you can use dynamic linking on Linux

* Fix a bunch of clippy lints

* Update changelogs

* More clippy fixes
2022-11-16 19:08:03 +01:00
Clement Rey
f7019926dc
wgpu backend: do not try to render zero-sized surfaces (#2313)
* wgpu backend: do not try to render zero-sized surfaces

* reverse if

Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>
2022-11-16 18:03:57 +01:00
Emil Ernerfeldt
9268f43896
eframe: make RequestRepaintEvent into an enum UserEvent (#2311)
Preparation for https://github.com/emilk/egui/pull/2294
to make that a smaller diff.
2022-11-16 12:17:41 +01:00
Robert Walter
0ff1ee3893
feat(combobox): implement text wrap for selected text (#2272)
* feat(combobox): implement text wrap for selected text

* chore(changelog): add line to changelog

* feat(combobox-text-wrap): make wrap boolean

- specifying a wrap width didn't really make sense so now it's boolean
- the selected text will now use the maximum available width while still
  respecting the spacing and icon coming after it

* feat(combobox-text-wrap): update changelog
2022-11-16 11:57:27 +01:00
Arshia Soleimani
0ba04184d5
Improve mouse selection accuracy (#2304)
* updated

* Update crates/egui/src/context.rs

Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>

Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>
2022-11-16 11:26:02 +01:00
Matt Fellenz
690dc2d2e8
Add 'none' alias to Sense::hover (#2306) 2022-11-14 11:44:46 +01:00
Emil Ernerfeldt
ef931c406c
Add Window::pivot and position combo boxes better (#2303)
* Paint ComboBox icon differently if opening upwards

* Add Area::pivot and Window::pivot

* Add Window::contrain

* ComboBox: pop up above if it doesn't fit below

* Add line to changelog
2022-11-13 22:17:33 +01:00
LoganDark
f0f41d60e1
eframe: Don't show window until after initialization (#2279)
* Don't show window until after initialization

Shortens #1802, but does not completely solve it

* format code

* Present first frame immediately before showing window

This resolves the white flash almost completely, but is a hack. Window
visibility should be derived from the AppOutput, and the first frame
should not be painted before the event loop has processed initial
events.

Working on a better implementation.

* Integrate window showing with AppOutput

This allows an app to keep the window hidden (never shown) by calling
Frame.set_visible(false) on the first update. This includes a slightly
less nasty hack than the last commit did.

Also fixes an accidental cross-contamination of pull requests.

* fmt

* add comments

* add comments

* add comments

* add comments

Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>
2022-11-13 20:30:52 +01:00
LoganDark
5bac853d9c
eframe: Repaint immediately on RepaintAsap, fixes #903 (#2280)
* eframe: Repaint immediately on RepaintAsap, fixes #903

This completely eliminates the white flickering seen on Windows when
rapidly resizing a window on the glow backend. The reason that happens
is because DWM only waits for the resize event to be delivered before
displaying the window at its new size. You must repaint synchronously
inside that iteration of the event loop or else you get flickering.

* Differentiate between RepaintAsap and RepaintNext

RepaintNext looks like it is indeed needed in at least one case instead
of RepaintAsap.

* Use RepaintNext in more situations

Starting to understand why this was the behavior. It looks like only a
few special cases should be given RepaintAsap, such as the window being
resized. All other cases should be RepaintNext, as it can wait.

Using RepaintAsap in all situations will cause things like lag when
changing a slider by keyboard with a high key repeat rate.

* Add explanatory comments

I am a total hypocrite for forgetting to add these.

* Rename RepaintAsap to RepaintNow

There is no notion of "possibility" here like there is when waiting for
RedrawEventsCleared. RepaintNow causes an immediate repaint no matter
what.

* Fix RepaintNow comment

"Delays" is ambiguous.
2022-11-13 20:30:39 +01:00
ItsEthra
f790e248e4
Fixed color edit popup going outside the screen (#2270)
* Fixed color edit popup going outside the screen

* Added option to constrain areas

* Constrain color picker area

* Constrain popups

* Updated changelog
2022-11-11 14:09:54 +01:00
Red Artist
8ff139687a
bump msrv 1.64 and tts + bindgen dep (#2274)
* bump msrv 1.64 and tts + bindgen dep

* Update crates/egui-winit/Cargo.toml

Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>

* Update crates/eframe/Cargo.toml

Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>

Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>
2022-11-11 10:27:25 +01:00
Emil Ernerfeldt
e225c6b8d0 Opt-in logging of egui-wgpu using puffin 2022-11-10 16:28:08 +01:00
WesleyCh3n
b2edbe617e
Fixed Plot Line::fill does not fill last segment correctly (#2275)
* Fix missing vertex to fill the triangle

Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>
2022-11-10 15:00:20 +01:00
Emil Ernerfeldt
b1e71d308f
Only show tooltips when mouse pointer is still (#2263)
* Only show tooltips when mouse pointer is still

Revert to the old behavior by setting
`style.interaction.show_tooltips_only_when_still = false`.

* Area: take `impl Into<Id>`

* refactor tooltips

* Fix was_tooltip_open_last_frame

* Bug fix

* Add some spacing between tooltips
2022-11-09 19:35:08 +01:00
Emil Ernerfeldt
51ff32797d
Give each tooltip area its own unique Id (#2264)
* Don't check for clicks on non-interactive areas

* Give each tooltip area its own unique Id
2022-11-08 11:04:54 +01:00