Commit Graph

345 Commits

Author SHA1 Message Date
Emil Ernerfeldt a9a6e0c2f2
Remove the need for setting `web_sys_unstable_apis` (#5000)
* No longer required since https://github.com/emilk/egui/pull/4980

And despite some outdated comments, wgpu/WebGPU doesn't need it either
2024-08-26 16:31:38 +02:00
VinTarZ 9f2f5f7292
Fix eframe centering on multiple monitor systems (#4919)
On multiple-monitor systems, eframe was incorrectly selecting first ones
dimensions for centering

Would also appretiate releasing 0.28.2 with fix included on crates.io
2024-08-26 15:36:30 +02:00
Emil Ernerfeldt 0513c05768
Fix CI (#5005) 2024-08-26 15:35:44 +02:00
Nicolas 560b2989a7
Update `web-sys` & `wasm-bindgen` (#4980)
This PR updates web-sys & wasm to the newest version.

(this was already part of the POC #4954 )

* Closes <https://github.com/emilk/egui/issues/4961>
* Closes <https://github.com/emilk/egui/issues/4958>
* [x] I have followed the instructions in the PR template
2024-08-26 11:38:30 +02:00
lucasmerlin c9e00e50ad
Fix iOS build, and add iOS step to CI (#4898)
<!--
Please read the "Making a PR" section of
[`CONTRIBUTING.md`](https://github.com/emilk/egui/blob/master/CONTRIBUTING.md)
before opening a Pull Request!

* Keep your PR:s small and focused.
* The PR title is what ends up in the changelog, so make it descriptive!
* If applicable, add a screenshot or gif.
* If it is a non-trivial addition, consider adding a demo for it to
`egui_demo_lib`, or a new example.
* Do NOT open PR:s from your `master` branch, as that makes it hard for
maintainers to test and add commits to your PR.
* Remember to run `cargo fmt` and `cargo clippy`.
* Open the PR as a draft until you have self-reviewed it and run
`./scripts/check.sh`.
* When you have addressed a PR comment, mark it as resolved.

Please be patient! I will review your PR, but my time is limited!
-->

This PR
- adds a pipeline to check the ios build
- removes the iOS WaitUntil workaround, which doesn't seem to be
necessary anymore after the winit update (and caused the build for iOS
to fail again because of a missing self
- ~removes a iOS workaround for window size which doesn't seem necessary
anymore~
Turns out it was still needed (but you need to actually restart the app
for the issue to show up, so I didn't catch it first)
- fixes some cargo check errors in run.rs

I've done all these changes in a single PR because otherwise the
pipeline doesn't run but I can also split them in separate PRs if that
makes it easier to review
2024-08-26 09:48:12 +02:00
pm100 0c528fb862
Fix crash when changing viewport settings (#4862)
* Fixes #3959

There are two bugs racing each other here, which is why it sometimes
crashes and sometimes the app just silently exists

Bug 1
When the window is recreated a Destroyed event arrives (due to the Drop
of the old window). The code that receives this event does not look to
see if its the main viewport or a secondary one and unconditionally
closes the app. The code path for other platforms is slightly different
and does check.

I have moved the code that handles the destroy to be in the same place
and have the same behavior as the other platforms.

Bug 2

At recreate time the window and winit entries of the viewport are set to
None (forcin g them to be recreated). But the surface is still bound to
the old window, this causes the next context switch to fail. So I simply
added a viewport.gl_surface = None too,


This is my first egui PR so I hope I have not broken anything. If
nothing else I understand a little better how egui works.
2024-08-26 08:55:34 +02:00
Arthur Brussee 1f6ae49a5f
Unpin & upgrade winit to 0.30.5 (#4939)
This updates winit to 0.30.5. 

https://github.com/emilk/egui/pull/4849 Had to pin the version to
0.30.2, as a Winit patch changed the behavior of selecting a theme.
Winit 0.30.5 reverts this, so we could stick with `window.theme()`, but
the newly added `ActiveEventLoop::system_theme` is more like what egui
wants anyway, as individual windows can have theme overrides.

Also bump `smithay-clipboard` to prevent some now duplicate
dependencies.
2024-08-09 09:15:14 +02:00
Tau Gärtli 2dac4a4fc6
Follow the System Theme in egui (#4860)
* Some initial progress towards #4490

This PR just moves `Theme` and the "follow system theme" settings to
egui and adds `RawInput.system_theme`.
A follow-up PR can then introduce the two separate `dark_mode_style` and
`light_mode_style` fields on `Options`.


<!--
Please read the "Making a PR" section of
[`CONTRIBUTING.md`](https://github.com/emilk/egui/blob/master/CONTRIBUTING.md)
before opening a Pull Request!

* If applicable, add a screenshot or gif.
* If it is a non-trivial addition, consider adding a demo for it to
`egui_demo_lib`, or a new example.
* Do NOT open PR:s from your `master` branch, as that makes it hard for
maintainers to test and add commits to your PR.
* Remember to run `cargo fmt` and `cargo clippy`.
* Open the PR as a draft until you have self-reviewed it and run
`./scripts/check.sh`.
* When you have addressed a PR comment, mark it as resolved.

Please be patient! I will review your PR, but my time is limited!
-->


* [x] I have followed the instructions in the PR template


### Breaking changes

The options `follow_system_theme` and `default_theme` has been moved
from `eframe` into `egui::Options`, settable with `ctx.options_mut`

---------

Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>
2024-08-06 20:17:51 +02:00
Ardocrat dfbc7f0d19
Fix iOS compilation of eframe (#4851)
Fixed changed the name of function `WinitApp::get_window_winit_id` to
`WinitApp::window_id_from_viewport_id` and missed `egui::ViewportId`
import.
2024-07-31 10:18:18 +02:00
Arthur Brussee 6f2f006885
Upgrade winit to 0.30.2 (#4849)
* Closes https://github.com/emilk/egui/issues/1918
* Closes https://github.com/emilk/egui/issues/4437
* Closes https://github.com/emilk/egui/issues/4709
* [x] I have followed the instructions in the PR template

Hiya,

I need new winit for a specific fix for a android_native_actvity. There
are already two PRs, but both don't seem to have a lot of movement, or
are entirely complete:

https://github.com/emilk/egui/pull/4466
Seems to have gone stale & is missing some bits.

https://github.com/emilk/egui/pull/4702
Also seems stale (if less so), and is missing a refactor to
run_on_demand. I also *think* the accesskit integration has a mistake
and can't be enabled. I've marked them as a co-author on this as I
started from this branch. (I think! Haven't done that on git before...).

Sorry for the wall of text but just dumping some details / thoughts
here:

- There's an issue with creating child windows in winit 0.30.1 and up on
macOS. The multiple_viewports, "create immediate viewport" example
crashes on anything later 0.30.1, with a stack overflow in unsafe code.
I've create [a winit
issue](https://github.com/rust-windowing/winit/issues/3800), it *might*
already be fixed in 0.31.0 but I can't test as 0.31 will likely require
another refactoring. For now I have just pinned things to 0.30.0 exatly.

- Winit has deprecated run_on_demand, instead requiring the
ApplicationHandler interface. In 0.31.0 run_on_demand is removed. I've
refactored both the integration and the WinitApp trait to follow this
pattern. I've left user_events a bit more opaque, as it seems 0.31.0 is
doing a rework of UserEvents too.

- I've used the new lazy init approach for access kit from this branch
https://github.com/mwcampbell/egui/tree/accesskit-new-lazy-init and
marked Matt as co-author, thanks Matt!

- There was very similair but not quite the same code for run_and_return
and run_and_exit. I've merged them, but looking at the github issues
graveyard it seems vey finnicky. I *hope* this is more robust than
before but it's a bit scary.

- when receiving new_events this also used to check the redraw timing
dictionary. That doesn't seem necesarry so left this out, but that is a
slight behaviour change?

- I have reeneabled serial_windows on macOS. I wondered whether it was
fixed after this PR and does seem to be! However, even before this PR it
seems to work, so maybe winit has sorted things out before that...
Windows also works fine now without the extra hack.

- I've done a very basic test of AccessKit on Windows and screen reader
seems ok but I'm really not knowleadgable enough to say whether it's all
good or not.

- I've tested cargo tests & all examples on Windows & macOS, and ran a
basic Android app. Still, testing native platforms is wel... hard so if
anyone can test linux / iOs / older mac versions / windows 10 would
probably be a good idea!

- For consistencys sake I've made all event like functions in WinitApp
return a `Result<EventResult>`. There's quite a bit of Ok-wrapping now,
maybe too annoying? Not sure.

Thank you for having a look!

# Tested on
* [x] macOS
* [x] Windows
* [x] Wayland (thanks [SiebenCorgie](https://github.com/SiebenCorgie))
* [x] X11 (thanks
[crumblingstatue](https://github.com/crumblingstatue)!,
[SiebenCorgie](https://github.com/SiebenCorgie))


# TODO
* [x] Fix "follow system theme" not working on initial startup (winit
issue, pinning to 0.30.2 for now).
* [x] Fix `request_repaint_after`

---------

Co-authored-by: mwcampbell <mattcampbell@pobox.com>
Co-authored-by: j-axa <josef.axa@gmail.com>
Co-authored-by: DataTriny <datatriny@gmail.com>
Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>
2024-07-31 09:43:16 +02:00
Tyler Stevens 7736192722
Clarified `eframe::run_simple_native()` persistence (#4846)
* [x] I have followed the instructions in the PR template

Clarified that `eframe::run_simple_native()` does in fact save some
state (if persistence is enabled) but does not allow user to save state.
2024-07-30 21:01:10 +02:00
Salman Abuhaimed 34db001db1
Force canvas/text input focus on touch for iOS web browsers (#4848) 2024-07-23 18:16:51 +02:00
Jan Procházka 0d89e31e3e
Use canvas directly (#4780) 2024-07-15 18:59:15 +02:00
rustbasic 20359a870f
eframe: Improve `glow` context switching (#4814)
Improved `change_gl_context()`

**Before:** 
Create a new `not_current_glcontext`. 

**After:**
If `not_current_glcontext` exists, apply it. Otherwise, create it. 

This will make the program smoother when dragging, etc.
2024-07-11 11:43:21 +02:00
Jonas Wagner b283b8a560
Introduce dithering to reduce banding (#4497)
This PR introduces dithering in the egui_glow and egui_wgpu backends to
reduce banding artifacts.

It's based on the approach mentioned in #4493 with the small difference
that the amount of noise is scaled down slightly to avoid dithering
colors that can be represented exactly. This keeps flat surfaces clean.

Exaggerated dithering to show what is happening:
![Screenshot from 2024-05-14
19-09-48](https://github.com/emilk/egui/assets/293536/75782b83-9023-4cb2-99f7-a24e15fdefcc)

Subtle dithering as commited.
![Screenshot from 2024-05-14
19-13-40](https://github.com/emilk/egui/assets/293536/eb904698-a6ec-494a-952b-447e9a49bfda)

Closes #4493
2024-07-08 09:57:11 +02:00
rustbasic cd1e4c573a
Remove dead code (`EpiIntegration::frame_start`) (#4790)
`frame_start` appears to be deprecated now.
( Am I wrong? )

It would be a good idea to add `#[allow(dead_code)]` or remove
`frame_start`.
2024-07-07 08:52:14 +02:00
Emil Ernerfeldt abab06867c Release 0.28.1 - Tooltip tweaks 2024-07-05 12:09:21 +02:00
lucasmerlin 9a4c46289e
Check if the mouse / touch event is above the canvas via element_from_point (#4775)
* Closes #4752 

To test, start the web demo and follow the repro steps from #4752
2024-07-05 08:18:53 +02:00
Emil Ernerfeldt 234274d46f Release 0.28.0 - Sizing pass, and better eframe web 2024-07-03 14:54:08 +02:00
Emil Ernerfeldt af404fec63
Persist `Area` positions again (#4749)
* Reverts https://github.com/emilk/egui/pull/4577

We again persist area positions, but not sizes.
2024-07-01 17:33:03 +02:00
Emil Ernerfeldt 7b61e426d7 eframe web: map `log::debug` to `console.debug`; not `console.trace` 2024-07-01 16:25:48 +02:00
Emil Ernerfeldt f3a0ac1d1b eframe web fix: `save()` on "blur" event 2024-07-01 16:16:56 +02:00
Emil Ernerfeldt 051b90bfc7 eframe web: Position the IME input position in the middle of the cursor 2024-07-01 16:08:20 +02:00
Emil Ernerfeldt d271718065
Fix focus problems on web (#4745)
* Closes https://github.com/emilk/egui/issues/4743
* Related to https://github.com/emilk/egui/issues/4569
2024-07-01 10:38:54 +02:00
Emil Ernerfeldt d10b3c1f4e
eframe web: Fix stuck keys after pressing ctrl+C, cmd+A, etc (#4731)
* Closes https://github.com/emilk/egui/issues/4724
2024-06-28 18:12:50 +02:00
Emil Ernerfeldt 2180f16cba
eframe web: Fix drag-and-drop file preview/hover (#4732)
* Closes https://github.com/emilk/egui/issues/4726
2024-06-28 18:07:53 +02:00
Emil Ernerfeldt 0c059ac113
Only repaint on cursor movements of area, or if dragging outside (#4730)
* Closes https://github.com/emilk/egui/issues/4723

Also fix some small bugs in the touch input on web
2024-06-28 17:40:48 +02:00
Emil Ernerfeldt 3b9f964aed
eframe web: ignore keyboard events unless canvas has focus (#4718)
* Fixes https://github.com/rerun-io/rerun/issues/6638
* Related? https://github.com/emilk/egui/issues/4563

This improves how an eframe canvas works inside of a larger web page,
and how it works when there are multiple eframe apps in the same page.

`eframe` will set `tabindex="0"` on the canvas automatically, making it
focusable.
It will also set `outline: none` on the CSS, so the focused canvas won't
have an ugly outline.


## Breaking changes
You may wanna add this to your `index.html` to give the canvas focus on
startup:
```js
document.getElementById("the_canvas_id").focus();
```

## Test setup
```sh
./scripts/build_demo_web.sh
./scripts/start_server.sh
open http://localhost:8888/multiple_apps.html
```
Then open the "Input Event History" and "Text Edit" windows

## Tested
* Chromium
	* [x] drag-and-drop of files
	* Test both when a `TextEdit` is focused and when it is not:
	  * [x] `Event::Key`
	  * [x] `Event::Text`
	  * [x] copy-cut-paste
	  * [x] Wheel scroll
	* [x] `Event::PointerGone`
	* [x] Mouse drag
	* [x] Mouse click
	* [x] Mouse right-click
	* [x] Defocus all eframe canvas, and then start typing text
* [x] Firefox (all of the above)
* [x] Desktop Safari (all of the above)
* [x] Mobile Safari


## Future work (pre-existing issues)
* https://github.com/emilk/egui/issues/4723
* https://github.com/emilk/egui/issues/4724
* https://github.com/emilk/egui/issues/4725
* https://github.com/emilk/egui/issues/4726
2024-06-28 15:01:06 +02:00
Emil Ernerfeldt 254dfc1ebc
Fix broken mouse coordinates when there's padding on the canvas element (#4729)
* Closes https://github.com/emilk/egui/issues/4725

Also fixes touch input being wrong if the web page is scrolled.
2024-06-28 13:02:36 +02:00
Emil Ernerfeldt e62bd7037a Improve warning when failing to copy on web 2024-06-28 08:40:58 +02:00
Emil Ernerfeldt 814eddd094 Add warning if `window.navigator.clipboard` is null 2024-06-28 08:39:49 +02:00
Emil Ernerfeldt a0f4fafb88
Refactor web event handling: break up into smaller functions (#4717)
No change in functionality, just making the code easier to read and
change.

* Part of fixing https://github.com/rerun-io/rerun/issues/6638
2024-06-27 15:26:52 +02:00
Emil Ernerfeldt 10571e9da5
`eframe::Result` is now short for `eframe::Result<()>` (#4706) 2024-06-25 13:31:42 +02:00
rustbasic d9c5fb04ae
Fix dragging of `custom_window_frame` example on Windows (#4656)
* Related #4592 
* Closes #4647 

Fix dragging of custom_window_frame on Windows (re-edited)
2024-06-19 16:19:41 +02:00
Owen Diehl 413843dd7c
Make sure to call `raw_input_hook` on web (#4646)
## What's new
* Extends @varphone's excellent `raw_input_hook` idea from
https://github.com/emilk/egui/pull/4008 to `web/app_runner`.

## Details
Debugging this locally after my app's `raw_input_hook` wasn't being
called, I realized it's not in the code path of eframe's web runner,
only the native integration. Below is a toy example running on the web.


https://github.com/emilk/egui/assets/8173478/d470b7e6-d393-4ead-9745-3aafc72ae6bc
2024-06-18 22:37:04 +02:00
crumblingstatue 49cb62b1ba
Replace `directories-next` dependency with `directories` (#4661)
`directories-next` was created because `directories` was not maintained
at the time. However, `directories` has gotten active maintainership
since, and it has received more updates than `directories-next`.

`directories` also has more recent downloads than its `next`
counterpart, so it might make sense to switch to it, to avoid
unnecessary duplicate dependencies, where a project depends transitively
on both `directories` and `directories-next`.

The main question is whether we depend on any specific behavior from
`directories-next`.
2024-06-18 22:17:21 +02:00
Jan Procházka 3d632cd333
Move first `request_animation_frame` into resize observer (#4628)
This PR ensures the first animation frame happens _after_ the resize
observer has had a chance to do its job.

* Closes https://github.com/emilk/egui/issues/4622

The first commit contains some `log` calls to observe the changed
behavior:

Before:
```
[eframe::web::app_runner] eframe/src/web/app_runner.rs:191: LOGIC [300.0 150.0]
[eframe::web::events] eframe/src/web/events.rs:633: ResizeObserver canvas=[300.0 150.0] to=(1920, 993)
[eframe::web::app_runner] eframe/src/web/app_runner.rs:191: LOGIC [1920.0 993.0]
[eframe::web::app_runner] eframe/src/web/app_runner.rs:191: LOGIC [1920.0 993.0]
```

After:
```
[eframe::web::events] eframe/src/web/events.rs:633: ResizeObserver canvas=[300.0 150.0] to=(1920, 993)
[eframe::web::app_runner] eframe/src/web/app_runner.rs:191: LOGIC [1920.0 993.0]
[eframe::web::app_runner] eframe/src/web/app_runner.rs:191: LOGIC [1920.0 993.0]
```
2024-06-06 10:30:32 +02:00
Emil Ernerfeldt 321d2441c1
Make pinch-to-zoom more responsive on web (#4621)
It's 2x faster than before, more closely matching how pinch-to-zoom
feels natively on Mac
2024-06-05 18:32:04 +02:00
Emil Ernerfeldt 4837dc68b3
Fix pinch-to-zoom on web by using the "artificial" modifier keys (#4619)
* Introduced in https://github.com/emilk/egui/pull/4524
* Closes https://github.com/emilk/egui/issues/4615
2024-06-05 18:05:48 +02:00
Emil Ernerfeldt 913cef3361
Enforce eframe errors are `Send` and `Sync` (#4574)
* Follow-up to https://github.com/emilk/egui/pull/4565
2024-05-29 13:13:00 +02:00
Jan Procházka 514ee0c433
Improve web text agent (#4561)
- Closes https://github.com/emilk/egui/issues/4060 - no longer aligned
to top
- Closes https://github.com/emilk/egui/issues/4479 - `canvas.style` is
not set anywhere anymore
- Closes https://github.com/emilk/egui/issues/2231 - same as #4060
- Closes https://github.com/emilk/egui/issues/3618 - there is now one
`<input>` per `eframe` app, and it's removed transitively by
`WebRunner::destroy -> AppRunner::drop -> TextAgent::drop`

This PR improves the text agent to make fewer assumptions about how
`egui` is embedded into the page:
- Text agent no longer sets the canvas position
- There is now a text agent for each instance of `WebRunner`
- The input element is now moved to the correct position, so the OS can
display the IME window in the correct place. Before it would typically
be outside of the viewport

The best way to test this is to build & server the web demo locally:
```
scripts/build_demo_web.sh && scripts/start_server.sh
```

Then open the EasyMark editor, and try using IME to input some emojis:
http://localhost:8888/#EasyMarkEditor

To open the emoji keyboard use:
- <kbd>win + .</kbd> on Windows
- <kbd>ctrl + cmd + space</kbd> on Mac

Tested on:
- [x] Windows
- [x] Linux
- [x] MacOS
- [x] Android
- [x] iOS

## Migration guide

The canvas no longer controls its own size/position on the page. This
means that those properties can now be controlled entirely via HTML and
CSS, and multiple separate `eframe` apps can coexist better on a single
page.

To match the old behavior, set the `canvas` width and height to 100% of
the `body` element:

```html
<html>
  <body>
    <canvas></canvas>
  </body>
</html>
```

```css
/* remove default margins and use full viewport */
html, body {
  margin: 0;
  width: 100%;
  height: 100%;
}

canvas {
  /* match parent element size */
  width: 100%;
  height: 100%;
}
```

Note that there is no need to set `position: absolute`/`left: 50%;
transform: translateX(-50%)`/etc., and setting those properties may
poorly affect the sharpness of `egui`-rendered text.

Because `eframe` no longer updates the canvas style in any way, it also
means that on mobile, the canvas no longer collapses upwards to make
space for a mobile keyboard. This should be solved in other ways:
https://github.com/emilk/egui/issues/4572
2024-05-29 12:54:33 +02:00
Emil Ernerfeldt 942fe4ab31
Support returning errors when creating the app (#4565)
The closure passed to `eframe::run_native` now returns a `Result`,
allowing you to return an error during app creation, which will be
returned to the caller of `run_native`.

This means you need to wrap your `Box::new(MyApp::new(…))` in an
`Ok(…)`.

* Closes https://github.com/emilk/egui/issues/4474
2024-05-28 21:59:19 +02:00
Jan Procházka d131b2b580
Fix: Don't `.forget()` RAF closure (#4551)
The closure is now stored in `WebRunner` and dropped in the next
`request_animation_frame` instead of being "leaked" via `forget`

---------

Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>
2024-05-27 21:55:23 +02:00
Jan Procházka 759c8fd2c9
Use ResizeObserver instead of `resize` event (#4536)
Currently, if the size of the canvas element changes independently of
the size of the browser window (e.g. due to its parent element
shrinking), then no repaints are scheduled.

This PR replaces the `resize` event with a `ResizeObserver`, which
ensures that _any_ resize of the canvas element (including those caused
by browser window resizes) trigger a repaint. The repaint is done
synchronously as part of the resize event, to reduce any potential
flickering.

The result seems to pass the rendering tests on most platform+browser
combinations. We tested:
- Chrome, Firefox, Safari on macOS
- Chrome, Firefox on Linux (ubuntu and arch, both running wayland)
- Chrome, Firefox on Windows

Firefox still has some antialiasing issues on Linux platforms, but this
antialiasing also happens on `master`, so this PR is not a regression
there.

The code setting `canvas.style.width` and `canvas.style.height` at the
start of `AppRunner::logic` was also removed - the canvas _display_ size
is now fully controlled by CSS, e.g. by setting `canvas { width: 100%;
height: 100%; }`.

The approach used here is described in
https://webglfundamentals.org/webgl/lessons/webgl-resizing-the-canvas.html

Note: The only remaining place where egui updates the style of the
canvas it is rendering to is some of the IME/mobile input handling code.
Fixing that is out of scope for this PR, and will be done in a followup
PR.
2024-05-27 21:41:28 +02:00
lucasmerlin 8553e738e0
eframe: Add `NativeOptions::persistence_path` (#4423)
This allows customizing the persistence path in NativeOptions.
Previously, persistence wouldn't work with android because
directories-next doesn't support android so eframe would just fail to
find a place where it could store its config.

* Closes #4098 (android users can now specify a path that works with
android, by e.g. using app_dirs2, which supports android)
2024-05-27 18:57:39 +02:00
Oscar Gustafsson cd45d18615
Do no use the ahash reimport (#4504)
<!--
Please read the "Making a PR" section of
[`CONTRIBUTING.md`](https://github.com/emilk/egui/blob/master/CONTRIBUTING.md)
before opening a Pull Request!

* Keep your PR:s small and focused.
* The PR title is what ends up in the changelog, so make it descriptive!
* If applicable, add a screenshot or gif.
* If it is a non-trivial addition, consider adding a demo for it to
`egui_demo_lib`, or a new example.
* Do NOT open PR:s from your `master` branch, as that makes it hard for
maintainers to add commits to your PR.
* Remember to run `cargo fmt` and `cargo clippy`.
* Open the PR as a draft until you have self-reviewed it and run
`./scripts/check.sh`.
* When you have addressed a PR comment, mark it as resolved.

Please be patient! I will review your PR, but my time is limited!
-->

Related to #3482 

Not sure what the "best practice" is, to me it seems like one should
import from "the original location" if possible, but now it should at
least be possible to not re-export ahash without any breakage in the
egui code base (but possibly in projects using egui, so one should
probably deprecate it if one would like to go that path). It also seems
like epaint re-exports ahash.
2024-05-27 16:24:50 +02:00
Emil Ernerfeldt 48045e57da
Remove `Event::Scroll` and handle it in egui (#4524)
For integrations: just emit `egui::Event::MouseWheel` (like before).
egui will interpret that as zoom or pan.

On the way towards https://github.com/emilk/egui/issues/4401
2024-05-22 21:35:15 +02:00
Emil Ernerfeldt c8578c9a6b
Fix: still track mouse when dragging outside web canvas (#4522)
* Closes https://github.com/emilk/egui/issues/3157

If the mouse leaves the canvas when dragging a slider, the slider will
still move.

---

To support this, I had to revert https://github.com/emilk/egui/pull/4419
Despite that, I fail to reproduce the two issues it claimed to solve:

* https://github.com/emilk/egui/issues/4406 may have been solved in
another way by this PR
* https://github.com/emilk/egui/issues/4418 I cannot reproduce on Mac.
If it is still a problem, I think it should be solved by triggering a
`PointerEvent::Released` when focus is lost (i.e. on alt-tab), and not
on `PointerGone`
2024-05-22 11:48:34 +02:00
Oscar Gustafsson c1eb3f884d
Move dependencies to workspace (#4495)
<!--
Please read the "Making a PR" section of
[`CONTRIBUTING.md`](https://github.com/emilk/egui/blob/master/CONTRIBUTING.md)
before opening a Pull Request!

* Keep your PR:s small and focused.
* The PR title is what ends up in the changelog, so make it descriptive!
* If applicable, add a screenshot or gif.
* If it is a non-trivial addition, consider adding a demo for it to
`egui_demo_lib`, or a new example.
* Do NOT open PR:s from your `master` branch, as that makes it hard for
maintainers to add commits to your PR.
* Remember to run `cargo fmt` and `cargo clippy`.
* Open the PR as a draft until you have self-reviewed it and run
`./scripts/check.sh`.
* When you have addressed a PR comment, mark it as resolved.

Please be patient! I will review your PR, but my time is limited!
-->

Inspired by:

44d65f41ac/Cargo.toml (L65)

I took the liberty of removing that comment since I *think* that I got
all "relevant" ones (showing up more than once, sort of).
2024-05-14 11:02:49 +02:00
Emil Ernerfeldt 44d65f41ac
Update `image` crate to 0.25 (#4160)
To not produce duplicating deps in Rerun
(https://github.com/rerun-io/rerun/pull/5280) I suggest we wait with
merging this until these crates have updated to `image` 0.25:
* [x] [`arboard`](https://crates.io/crates/arboard)
* [x] [`gltf`](https://crates.io/crates/gltf)
2024-05-13 13:35:15 +02:00