Commit graph

2482 commits

Author SHA1 Message Date
ItsEthra
f71cbc2475
Fixed menu popups going outside of the screen (#2191)
* Fixed menu popups going outside of the screen

* Made menu appear above above the button instead
2022-10-31 17:57:15 +01:00
Emil Ernerfeldt
02b9d2d082
Keyboard shortcut helpers (#2202)
* eframe web: Add WebInfo::user_agent

* Deprecate `Modifier::ALT_SHIFT`

* Add code for formatting Modifiers and Key

* Add type KeyboardShortcut

* Code cleanup

* Add Context::os/set_os to query/set what OS egui believes it is on

* Add Fonts::has_glyph(s)

* Add helper function for formatting keyboard shortcuts

* Faster code

* Add way to set a shortcut text on menu buttons

* Cleanup

* format_keyboard_shortcut -> format_shortcut

* Add TODO about supporting more keyboard sumbols

* Modifiers::plus

* Use the new keyboard shortcuts in emark editor demo

* Explain why ALT+SHIFT is a bad modifier combo

* Fix doctest
2022-10-31 12:58:26 +01:00
Mason Feurer
d97282cd92
Interact with non-Rect shapes (#2199)
* added Ui::interact_with_hovered

* fixed typo
2022-10-30 20:59:19 +01:00
Emil Ernerfeldt
2b1341095d
CI: Run cargo clippy for wasm32-unknown-unknown (#2200)
* CI: Run cargo clippy for wasm32-unknown-unknown

* wasm32 clippy fixes

* Document when AppRunner::new can fail
2022-10-30 20:55:07 +01:00
Andreas Reich
53b800502a
wgpu renderer no longer creates a sampler with every texture (#2198) 2022-10-30 15:14:45 +01:00
Emil Ernerfeldt
f7a15a34f9
Panel collapse/expansion animation (#2190)
* Add API for querying the size of a panel

* demo app: animate backend panel collapse

* Add helper function for animating panels

* More animation functions

* Add line to changelog
2022-10-28 11:51:56 +02:00
Emil Ernerfeldt
da96fcacd3 Improve panel sizing API 2022-10-28 10:16:02 +02:00
Lily M. Lyons
1fadc7396a
Add CollapsingHeader::show_unindented (#2154) 2022-10-24 17:10:13 +02:00
Emil Ernerfeldt
aebec6329a Use ⚠ instead of ‼ in "Debug build" warning
The latter is not supported by the default fonts
2022-10-24 15:00:50 +02:00
Emil Ernerfeldt
7b8c17042c eframe: Make fullsize_content mac-only 2022-10-21 08:55:56 +02:00
Paul Hazen
5e44c13b48
Allows creating a ColorImage struct without an alpha channel (#2167)
* Added functionality to image.rs that allows for creating an image from rgb instead of just rgba

* remove "unmultiplied"

* remove "unmultiplied"

* rgba -> rgb

Co-authored-by: Mingun <Alexander_Sergey@mail.ru>

Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>
Co-authored-by: Mingun <Alexander_Sergey@mail.ru>
2022-10-19 15:01:53 +02:00
Clement Rey
3d36a20376
table: fix deadlocks caused by lock fairness (#2156) 2022-10-16 20:10:48 +02:00
Andreas Reich
944159d514
using a shared vertex & index buffer in wgpu renderer (#2148)
* using a shared vertex & index buffer in wgpu renderer
capacity each doubles when exceeded.
This change means a lot less allocation during egui's lifetime.

* changelog update

* minor code cleanup and changelog fix

* fix linter issue
2022-10-14 10:53:19 +02:00
Parth
02d1e7492a
fix typo in text_layout_types (#2150) 2022-10-14 08:03:47 +02:00
Andrew Langmeier
a1f6f68213
Allow for changing of plot bounds from PlotUI (#2145) 2022-10-13 08:00:11 +02:00
Nicolas Musset
ae5294e63c
Use WidgetText for the slider's text (#2143) 2022-10-12 17:20:32 +02:00
Andreas Reich
c414af7aa2
wgpu renderer now always requires a RenderPass being passed in, pass command encoder to prepare callback (#2136)
* wgpu renderer now always requires a RenderPass being passed in
This also implies that it no longer owns the depth buffer! (why would it anyways!)

* wgpu-renderer now passes a command encoder to prepare

* add changelog entries

* fixup changelogs, fix variable name
2022-10-12 14:27:24 +02:00
Emil Ernerfeldt
7803285221 Remove Debug trait constraint on Id sources 2022-10-10 22:34:08 +02:00
Clement Rey
367378d75d
Fix false positives wrt RwLock deadlock detection (#2121)
* add a test suite demonstrating the issue

* fix false positives in RwLock, thus passing the new test suite

* friendler output

* augmented test suite with RWlock specifics (failing as expected!)

* full support for RWLocks

* implement support for guard remappings

* Add some newlines

* join `use` statements

* pass cranky

* addressing PR comments

Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>
2022-10-10 12:07:44 +02:00
Emil Ernerfeldt
f4d2aa5b4a
Only call the request_repaint_callback at most once per frame (#2126)
egui-winit adds new repaint events to the event loop on each call, and on some platforms this becomes very expensive.
2022-10-10 10:47:20 +02:00
Andrew Langmeier
0fe0c8115c
Add ability to control double click reset in plot widget (#2115)
* Add ability to control double click reset in plot widget

* improve docstring

* small optimization

Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>
2022-10-10 09:57:25 +02:00
Parth
510aa1710e
fix typo in architecture.md (#2123) 2022-10-10 09:42:50 +02:00
Emil Ernerfeldt
eba3927ace
Remove .with_srgb(false) when constructing window (#2110) 2022-10-08 11:43:48 +02:00
Emil Ernerfeldt
f61044cef7
Fix copy-paste on Windows (#2120)
Closes https://github.com/emilk/egui/issues/2109

Since arboard 3.0 you must absolutely not hold onto `arboard::Clipbaord`
longer than you are using it.

See https://github.com/1Password/arboard/issues/84
2022-10-07 14:46:42 +02:00
Andreas Reich
cd74c74f6f
Update to wgpu 0.14 (#2114) 2022-10-06 15:50:46 +02:00
Emil Ernerfeldt
3ec170cc1e Tweak warning color in bright mode 2022-10-06 11:49:12 +02:00
Emil Ernerfeldt
4dd5ffa254 Fix: make ScrollAreaOutput public 2022-10-06 09:03:18 +02:00
Andreas Reich
c2a37f4bd8
eframe support for wgpu on the web (#2107)
* basic working wgpu @ webgl on websys

* fix glow compile error

* introduced WebPainter trait, provide wgpu renderstate

* WebPainterWgpu destroy implemented

* make custom3d demo work on wgpu backend

* changelog entry for wgpu support eframe wasm

* remove temporary logging hack

* stop using pollster for web
we're actually not allowed to block - this only worked because wgpu on webgl doesn't actually cause anything blocking. However, when trying webgpu this became an issue

* revert cargo update

* compile error if neither glow nor wgpu features are enabled

* code cleanup

* Error handling

* Update changelog with link

* Make sure --all-features work

* Select best framebuffer format from the available ones

* update to wasm-bindgen 0.2.83

* Fix typo

* Clean up Cargo.toml

* Log about using the wgpu painter

* fixup wgpu labels

* fix custom3d_wgpu_shader ub padding

* remove duplicated uniforms struct in wgsl shader for custom3d

* Update docs: add async/await to the web 'start' function

Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>
2022-10-05 20:14:18 +02:00
Emil Ernerfeldt
c441f33ecf Cargo deny: also check wasm32-unknown-unknown 2022-10-03 10:37:50 +02:00
Emil Ernerfeldt
dd67f3631f Add Painter::image convenience function 2022-10-03 10:26:19 +02:00
Emil Ernerfeldt
77df8ca0b0
Update some crates (#2100)
* Update crate webbrowser 0.7 -> 0.8

* Update criterion 0.3 -> 0.4

* Update tts 0.20 -> 0.24

* revert tts update
2022-10-02 20:33:45 +02:00
Tobias Schmitz
981fdb3932
fix: default to changing y axis when changing data aspect (#2087) 2022-10-02 14:32:37 +02:00
Paul Rouget
aa1536f1a7
Make Layout properties public (#2096) 2022-10-02 08:51:29 +02:00
Michael Galos
9901ad4bb0
eframe: Mouse passthrough option (#2080) 2022-10-02 08:45:37 +02:00
Zoxc
53ff83737b
Plot: Add auto_bounds_x, auto_bounds_y and reset (#2029)
* Make double click reset to the initial view

* Allow forcing auto bounds

* Allow plots to be reset

* Rename `modified` to `bounds_modified`
2022-10-02 08:44:59 +02:00
Caleb Leinz (he/him)
5e91a3033d
Added ability to set color of spinner (#2088) 2022-10-01 15:18:44 +02:00
Paul Rouget
2dca01ecd5
Bug Fix: Allocate Frame outer margins (#2089) 2022-10-01 14:18:15 +02:00
Emil Ernerfeldt
2ee9ab3151 Added link to egui-glutin-gl 2022-09-27 23:08:43 +02:00
Emil Ernerfeldt
91b2d5da6f Fix typo in wgpu warning message 2022-09-25 16:46:40 +02:00
Emil Ernerfeldt
4ac1e28eae
Improve text redering and do all color operation in gamma space (#2071) 2022-09-24 17:53:11 +02:00
Emil Ernerfeldt
29fa63317e
Fix text sizes being too small (#2069)
Closes https://github.com/emilk/egui/issues/2068

Before this PR, the default font, Ubuntu-Light, was ~11% smaller
than it should have been, and the default monospace font, Hack,
was ~14% smaller. This means that setting the font size `12` in egui
would yield smaller text than using that font size in any other app.
Ooops!

The change is that this PR now takes into account the ttf properties
`units_per_em` and `height_unscaled`.

If your egui application has specified you own font sizes or text styles
you will see the text in your application grow
larger, unless you go in and compensate by dividing all font sizes by
~1.21 for Ubuntu-Light/Proportional and ~1.16 for Hack/Monospace,
and with something else if you are using a custom font!
This effects any use of `FontId`, `RichText::size`, etc.

This PR changes the default `Style::text_styles` to compensate,
so the default egui style should look the same before and after this PR.
2022-09-21 21:31:08 +02:00
Emil Ernerfeldt
990a8c8b44
Fix sRGB blending and cleanup the relevant code (#2070)
* Fix sRGBA blending on Mac

* Clean up handling of sRGB support

* Assume sRGB support if any extension has sRGB in it

* improve logging very slightly
2022-09-21 21:30:02 +02:00
setzer22
4aae638e15
Change several methods from pub(crate) to pub (#2051)
* Change several methods from pub(crate) to pub

* document next_auto_id

Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>
2022-09-21 20:08:26 +02:00
Emil Ernerfeldt
12dc61ed0f
update arboard to 3.0 (#2067) 2022-09-21 09:14:55 +02:00
Emil Ernerfeldt
2b0bf82b51
Make eframe::App::as_any_mut optional to implement (#2061) 2022-09-20 13:58:55 +02:00
Chris Hamons
311eb66cae
Add spacing.menu_margin for customizing menu spacing (#2036)
- Fixes https://github.com/emilk/egui/discussions/287
2022-09-17 11:29:19 +02:00
Adia Robbie
bc6a823103
eframe: Add center to NativeOptions and monitor_size to WindowInfo (#2035)
Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>
2022-09-17 11:20:40 +02:00
Paul Rouget
c4117066cf
MacOS: Support fullsize content (no titlebar, but window controls) (#2049)
Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>
2022-09-16 14:31:21 +02:00
Sheldon Nico
0605bcfca7
Add IME support for native (#2046) 2022-09-15 17:21:43 +02:00
Emil Ernerfeldt
c5495d69fb
egui-wgpu: Fix crash on zero-sized scissor rects (#2039) 2022-09-13 09:32:05 +02:00