Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

eframe web: don't repaint on mousemove and mouseup unless mouse is over canvas #4723

Closed
emilk opened this issue Jun 28, 2024 · 0 comments · Fixed by #4730
Closed

eframe web: don't repaint on mousemove and mouseup unless mouse is over canvas #4723

emilk opened this issue Jun 28, 2024 · 0 comments · Fixed by #4730
Assignees
Labels
eframe Relates to epi and eframe web Related to running Egui on the web

Comments

@emilk
Copy link
Owner

emilk commented Jun 28, 2024

If the eframe canvas is small, then this is important.

We should only repaint on mousemove and mouseup if the mouse is over canvas, or dragging something inside of canvas.

The same goes for touch events.

@emilk emilk added web Related to running Egui on the web eframe Relates to epi and eframe labels Jun 28, 2024
@emilk emilk added this to the Next Major Release milestone Jun 28, 2024
@emilk emilk self-assigned this Jun 28, 2024
emilk added a commit that referenced this issue Jun 28, 2024
* Fixes rerun-io/rerun#6638
* Related? #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)
* #4723
* #4724
* #4725
* #4726
emilk added a commit that referenced this issue Jun 28, 2024
* Closes #4723

Also fix some small bugs in the touch input on web
hacknus pushed a commit to hacknus/egui that referenced this issue Oct 30, 2024
* Fixes rerun-io/rerun#6638
* Related? emilk#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)
* emilk#4723
* emilk#4724
* emilk#4725
* emilk#4726
hacknus pushed a commit to hacknus/egui that referenced this issue Oct 30, 2024
…lk#4730)

* Closes emilk#4723

Also fix some small bugs in the touch input on web
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
eframe Relates to epi and eframe web Related to running Egui on the web
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant