1
0
mirror of https://github.com/emilk/egui.git synced 2026-06-27 15:13:12 -04:00
Commit Graph

2581 Commits

Author SHA1 Message Date
Emil Ernerfeldt
a4dc86d77e Store rects separatedly 2023-04-25 12:39:18 +02:00
Emil Ernerfeldt
1d0509de23 Smooth preview 2023-04-25 12:25:17 +02:00
Emil Ernerfeldt
e5d0cf68d6 Store state 2023-04-25 11:04:58 +02:00
Emil Ernerfeldt
32be36416c You can mandate that all leaves have tabs 2023-04-24 22:37:04 +02:00
Emil Ernerfeldt
0617b7d26d Drag to re-arrange horizontal layout 2023-04-24 21:41:19 +02:00
Emil Ernerfeldt
240989df8b Drag to re-arrange tabs 2023-04-24 20:46:21 +02:00
Emil Ernerfeldt
13ec65cf08 Fix drag-drop and simplification code 2023-04-24 17:04:10 +02:00
Emil Ernerfeldt
ce7ed11542 bug fixes 2023-04-24 15:44:27 +02:00
Emil Ernerfeldt
b5eddc5d5c Buggy drop-detection 2023-04-24 15:44:27 +02:00
Emil Ernerfeldt
9b154c6d1d Preview drag destinations 2023-04-24 15:44:27 +02:00
Emil Ernerfeldt
92d93cb24a Drag tab names 2023-04-24 15:44:27 +02:00
Emil Ernerfeldt
52657301c9 dock wip 2023-04-24 15:44:27 +02:00
Emil Ernerfeldt
8fcbbb542f Silence unrelated clippy warning 2023-04-24 15:44:27 +02:00
MAlba124
92c7053a14 Rename examples/user_attention/README.mg to ... (#2948)
Rename `examples/user_attention/README.mg` to `examples/user_attention/README.md`.
2023-04-24 14:28:13 +02:00
Andreas Reich
0e6d69d4c4 Make egui work on WebGPU out of the box. (#2945)
* Make wgpu webgl/gles opt-in (but still work out of the box via feature flag), workaround canvas creation issue

* missing allow unsafe code annotations

* add breaking change not to eframe release notes

* Add --webgpu flag to build_demo_web.sh

* Improve CHANGELOG docs

* Clean up, and prepare for having to wasm:s

* put canvas without workaround under `if false`

* fix spelling

---------

Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>
2023-04-24 11:26:45 +02:00
Jinlei Li
09e1569bf3 Enable egui-winit to support wasm target (#2949) 2023-04-24 09:16:50 +02:00
Emil Ernerfeldt
c82604fe51 Update and fix web demo 2023-04-24 09:15:06 +02:00
Niklas Korz
f962378243 wgpu 0.16 (#2884)
* Adapt to latest wgpu changes

* Point to latest wgpu commit

* Fix egui-wgpu winit

* wgpu 0.16

* Fix web compilation issue

* Add libloading to deny.toml skip

* lock fix after merge, sort deny skip list

---------

Co-authored-by: Andreas Reich <r_andreas2@web.de>
2023-04-21 11:40:25 +02:00
Emil Ernerfeldt
4d357b0f02 clippy fixes from 1.69.0 2023-04-21 11:33:18 +02:00
Emil Ernerfeldt
4d360f67a4 eframe web: rememeber to unsubscribe from events on destroy 2023-04-21 09:22:34 +02:00
Emil Ernerfeldt
ac50fa0d94 eframe web: Better panic handling (#2942)
* Refactor: remove extra store of events

* Remove unnecessary extra function

* Refactor: simplify event registering

* Store panic summary

* egui_demo_app: move web-part to own module

* index.html: await

* Properly unsubscribe from events on panic

* Better error handling

* Demo app html: hide the wasm canvas and show an error message on panic

* egui_demo_app: add panic button to test panic response on web

* fix typo

* Use a constructor to create WebHandle

* Refactor: less use of locks in the interfaces

* More consistent naming
2023-04-21 08:33:01 +02:00
Emil Ernerfeldt
7f2de426d2 eframe: Set app icon on Mac and Windows (#2940)
* eframe: Set app icon on Mac and Windows

Also: correctly set window title on Mac when launching from
another process, e.g. python.

Co-authored-by: Wumpf <andreas@rerun.io>

* lint fixes

* Fix web build

* fix typo

* Try fix windows build

---------

Co-authored-by: Wumpf <andreas@rerun.io>
2023-04-20 15:47:04 +02:00
Emil Ernerfeldt
834e2e9f50 Fix: request_repaint_after works even when called from background thread (#2939)
* Refactor repaint logic

* request_repaint_after also fires the request_repaint callback

* Bug fixes

* Add test to egui_demo_app

* build_demo_web: build debug unless --release is specified

* Fix the web backend too

* Run special clippy for wasm, forbidding some types/methods

* Remove wasm_bindgen_check.sh

* Fix typos

* Revert "Remove wasm_bindgen_check.sh"

This reverts commit 92dde25344.

* Only run cranky/clippy once
2023-04-20 10:56:52 +02:00
Emil Ernerfeldt
d46cf067ea Return plot transforms (#2935)
* Expose the plot transform to users

* Rename plot::ScreenTransform to PlotTransform

* Plot: return a PlotResponse with a transform member
2023-04-19 17:01:16 +02:00
Emil Ernerfeldt
ce761e548f use env_logger in all examples (#2934) 2023-04-19 16:35:38 +02:00
TicClick
e3a021eea6 Allow for requesting the user's attention to the window (#2905)
* add method for requesting attention to the main window

* use another enum member for user attention type instead of nested `Option`s

(also, document the enum members now that they don't mirror `winit`)

* update the docstring

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

* add an example app for testing window attention requests

* Apply suggestions from code review

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

* remove `chrono` dependency and improve the attention example's readability

---------

Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>
2023-04-19 15:29:17 +02:00
Emil Ernerfeldt
d1af798a9b Clear all keys and modifies on focus change (#2933)
It is very easy for keys to become stuck when we alt-tab,
or a save-dialog opens by Ctrl+S, etc.
Therefore we new clear all the modifiers and down keys to avoid that.
2023-04-19 15:27:51 +02:00
Ryan Hileman
ede3ded977 egui-winit: Use RawDisplayHandle for smithay clipboard init (#2914) 2023-04-19 09:14:23 +02:00
Emil Ernerfeldt
b8e798777d Only show id clash warnings in debug builds by default (#2930)
Change with `egui_ctx.options_mut(|opt| opt.warn_on_id_clash = true);`
2023-04-19 08:53:37 +02:00
Emil Ernerfeldt
d486c76a9f Remove dark-light dependency (#2929)
* Remove dark-light dependency

Since https://github.com/emilk/egui/pull/2750 we now get what we need
straight from `winit`.

* fix warning

* Docstring formatting

* fix typo in check.sh
2023-04-18 21:52:48 +02:00
Emil Ernerfeldt
9c9a54ce36 Replace tracing with log (#2928)
* Replace tracing crate with log

It's just so much simpler to use

* Add `bacon wasm` job

* eframe: add a WebLogger for piping log events to the web console
2023-04-18 21:11:26 +02:00
Emil Ernerfeldt
0f9e1a3526 eframe web: Store app state to local storage when leaving site (#2927) 2023-04-18 20:26:02 +02:00
Jackson Kruger
438f6eafc8 Plot widget - allow disabling zoom and drag for x and y separately (#2901)
* Set whether zooming allowed for x and y separately

* Set whether dragging allowed for x and y separately

* Add disclaimers about interaction with data_aspect

* Show zoom & drag behavior in plot demo/charts instead of context menu demo

* Code review suggestions - use AxisBools::any()

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

* Simplify allow_drag and allow_zoom APIs to take in Into<AxisBools>

* Remove unnecessary using...

* Remove unrelated change

---------

Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>
2023-04-18 19:58:19 +02:00
Emil Ernerfeldt
902bcfe6aa Add script to generate changelogs (#2920)
* Add script to generate changelogs from PR labels

* Improve PR template

* Better categorization
2023-04-18 18:58:12 +02:00
Emil Ernerfeldt
03c1a05e49 Rename sh/ folder to scripts/ 2023-04-18 17:10:52 +02:00
Sven Niederberger
69b568aeb4 Improved plot groups and bounds handling (#2410)
* improve plot groups and bounds handling

* changelog entry

* fix potential deadlock

* fix two more potential deadlocks

* syntax fix

* move changelog entry

* move category

* Update crates/egui/src/widgets/plot/mod.rs

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

* Update crates/egui_demo_lib/src/demo/plot_demo.rs

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

* clean up suggestions

* address comments

* use the new methods

* fix locked bounds

* Sync bounds_modified along with the bounds themselves

* move changelog entry

* Remove set_bounds_auto - not necessary any more

* add a comment about bounds modifications

---------

Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>
Co-authored-by: Jackson Kruger <jackson@farprobe.com>
2023-04-18 16:27:00 +02:00
Dixeran
8a2cfbd131 Apply 'with_active' option to winit (#2813)
* feat: apply 'with_active' option to winit

* fix: remove platform specification

- winit accept this option for all platforms

* build fix

---------

Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>
2023-04-18 16:13:25 +02:00
Emil Ernerfeldt
af4d737c92 Fix typo. Closes https://github.com/emilk/egui/pull/2876 2023-04-18 16:11:53 +02:00
xacer
4267fc079b bug: hide triple_clicked in documentation (#2867)
If `Response.clicked` and `Response.double_clicked` are hidden in the documentation, why isn't `Response.triple_clicked`
2023-04-18 16:11:05 +02:00
Emil Ernerfeldt
93ee554af5 Check more target triples with cargo deny (#2919) 2023-04-18 16:10:53 +02:00
Emil Ernerfeldt
4809747952 Check for typos on CI (#2918)
* Check for typos on CI

* Fix all typos
2023-04-18 16:10:20 +02:00
hats-np
77df9cb982 Menu State rect now uses menu frame rect instead of contents rect, as their position goes out of bounds. (#2886) 2023-04-18 16:07:24 +02:00
Jozef Číž
33aa4d698f Fix typos (#2866)
* Fix typos in comments

* Fix typos in demo texts

* Fix typos in code names

* Fix typos in cargos

* Fix typos in changelogs
2023-04-18 15:52:45 +02:00
YgorSouza
8326fffdb0 Add raw mouse wheel event (#2782)
* Add raw mouse wheel event

The event is sent as it comes from the backend, so it will follow
different conventions depending on the target, and it is up to the user
code to deal with that. The goal is to allow advanced users to implement
alternative UI controls, e.g., using Ctrl to scroll the plot
horizontally instead of zooming, or use Shift to scroll faster instead
of changing direction.

* Change Pixel to Point for consistency

Apply suggestions from code review by emilk

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

* Inline mouse wheel raw event closure

It was meant only to be able to use the same variable names without
shadowing the rest of the code, but a simple block accomplishes the same
thing.

* Use wildcard on wheel event match

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

* Flip mouse wheel delta sign on web to match native

* Use wheel event data to generate scroll event

To avoid doing the same match and sign conversion twice.

---------

Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>
2023-04-18 15:44:26 +02:00
Robert Bragg
89e42884fc Remove android-activity dependency + add activity features (#2863)
Instead of depending on android-activity directly, this exposes the
android-native-activity and android-game-activity features from Winit.

This ensures that applications can choose what android-backend they use
while also relying on Winit to decide what version of android-activity to
use - without increasing the risk of a version conflict by having a direct
dependency.

_(NB: Egui doesn't currently use the android-activity API itself)_

Since android-activity provides the `android_main()` entry point for
Android applications it's not possible to link in multiple version of
the android-activity crate and so it's particularly important to
avoid unnecessary direct dependencies that could cause a version
conflict in the future.

To help avoid the need for applications to directly depend on
android-activity the Winit crate re-exports the android-activity API
and exposes features to configure the backend so that application crates
can instead rely on Winit to pull in a compatible version of
android-activity. (This way version bumps for android-activity only
need to be synchronized with the Winit crate).

CI now enables the `android-native-activity` feature for testing.

Fixes: #2829
Fixes: #2720
Closes: #2834
2023-04-18 15:40:30 +02:00
Emil Ernerfeldt
b604b6200c Update yanked deps (#2917)
* Update crossbeam-channel 0.56 to 0.58

* Update enumflags2

* CI: cargo check epaint --no-default-features
2023-04-18 15:27:31 +02:00
Luke Jones
7c12bb692b eframe: add call to save_and_destroy in Exit event of run_return (#2895)
`EventResult::Exit` is hit before `Event::LoopDestroyed` is, and due to
possibly some order of operations or drops the window is never destroyed
on Linux. Adding a call to `winit_app.save_and_destroy();` where
`EventResult::Exit` is checked solves this.

Closes #2892

Signed-off-by: Luke D. Jones <luke@ljones.dev>
2023-04-18 15:08:17 +02:00
TicClick
6f1e66731e eframe: read the state of native window's input focus and request it (#2900)
* Add ability to read the native window's focus state

* Add `eframe::Frame::focus()` for requesting the native window's focus

* rename the output field `active` → `focused` for consistency
2023-04-18 15:03:06 +02:00
Barugon
b80c0e6ff6 Add option to show icon (#2910) 2023-04-18 14:55:09 +02:00
Ryan Hileman
116d1547be fix epaint bytemuck dependency (#2913) 2023-04-18 14:51:38 +02:00