Commit graph

90 commits

Author SHA1 Message Date
Emil Ernerfeldt
b1fd6a44e8
Switch to using glow as the default renderer both on native and the web (#1020)
* Switch to using glow as the default renderer both on native and the web
* Simplify code to find WebGL context for glow
* egui_web: make webgl an opt-in feature
* Stop using deprecated WEBGL_debug_renderer_info
2021-12-31 15:17:55 +01:00
Emil Ernerfeldt
d5efa4bbca 1.56 fix: missing_crate_level_docs -> rusdoc::missing_crate_level_docs 2021-12-26 09:56:14 +01:00
sumibi-yakitori
10c8ffa543
Fix to limit X position of text agent to client width (#870) 2021-11-06 10:33:43 +01:00
Emil Ernerfeldt
6d33beabb1 Replace scroll_delta and zoom_delta in RawInput with events
Part of https://github.com/emilk/egui/issues/843
2021-11-03 22:57:13 +01:00
triangle drawer
804722a1ba
Make egui_glow painter to work on web (#868)
Add WebGL1 and WebGL2 support to glow painter.
Add "glow" feature to egui_web to use the glow painter there.
Make winit an optional part of egui_glow
2021-11-03 19:17:07 +01:00
Emil Ernerfeldt
1dbe608e73
Refactor integrations (#871)
* Unify code in egui_glium and egui_glow into egui_winit::EpiIntegration
* Simplify `EguiGlium` interface
* Simplify `EguiGlow` interface
* egui_web refactor: merge `WebBackend` into `AppRunner`
2021-11-03 13:45:51 +01:00
sumibi-yakitori
b1716be745
egui_web: constrain the IME text agent to the canvas (#830)
limit the position of the text agent to the height of the client area
2021-11-02 19:46:42 +01:00
Emil Ernerfeldt
316202c33a egui_web: improve text input on mobile and for IME 2021-10-24 15:57:36 +02:00
sumibi-yakitori
19766bfe4c
Fix when a string containing CRLF is pasted from the clipboard (#826) 2021-10-20 22:26:26 +02:00
Emil Ernerfeldt
844dd9d7a4 Remove "seconds_since_midnight" from epi/eframe. Use chrono instead
chrono works both natively and on web.

Related: https://github.com/emilk/egui/issues/212
2021-10-19 15:37:20 +02:00
Emil Ernerfeldt
6f699b3391 Replace every ... with … like some sort of crazy person
Also fix some small typos

Closes https://github.com/emilk/egui/pull/736
2021-10-13 11:52:34 +02:00
Emil Ernerfeldt
c8bb4cf6e5 Fix multiline pasting in egui_web
Closes https://github.com/emilk/egui/issues/738
2021-09-28 20:47:02 +02:00
Emil Ernerfeldt
f37180f7dc
Bump MSRV (Minimum Supported Rust Version) to 1.54.0 (#703)
1.51.0 clippy has been giving me trouble (not reporting all problems),
and so I take the easy way out and just bump MSRV.

We will upgrade to 1.56.0 once it comes around anyway
to get access to that sweet disjoint capture in closures
(https://doc.rust-lang.org/nightly/edition-guide/rust-2021/disjoint-capture-in-closures.html)
2021-09-09 00:16:06 +02:00
Emil Ernerfeldt
6331bfed90 Revert change of scrollspeed in egui_web
https://github.com/emilk/egui/pull/702
2021-09-07 20:47:53 +02:00
Emil Ernerfeldt
cbafd10ee4 Clippy fix 2021-09-07 19:59:14 +02:00
Emil Ernerfeldt
249876523d Increase scroll-speed on glium from 8 to 50 points per scroll tick
Closes https://github.com/emilk/egui/issues/461
Closes https://github.com/emilk/egui/pull/702
2021-09-07 19:45:13 +02:00
Emil Ernerfeldt
9598596bdc
Replace all http code in epi/eframe/egui_glium/egui_web with ehttp (#697)
I've extracted all the http request code and turned it
into its own crate at <https://github.com/emilk/ehttp>.

There was never a reason for the HTTP request library to be part of
`eframe`. Much better to have it as its own crate!
2021-09-03 21:04:43 +02:00
Emil Ernerfeldt
9bc95289cc
egui_web: Fix use of egui on devices with both touch and mouse (#654) 2021-08-28 08:37:07 +02:00
Emil Ernerfeldt
a256ca115b
Drag and drop files into egui_glium and egui_web (#637)
* Implement file drag-and-drop for egui_glium

* Implement file drag-and-drop into egui_web

* Cleanup
2021-08-20 22:20:45 +02:00
mental
eefc56c213
fix and pin web-sys breakage in Navigator::clipboard (#608) 2021-08-15 16:55:33 +02:00
Emil Ernerfeldt
6e7e88ba80
Use old 1.51 toolchain instead of bleeding edge (#505)
* Use old 1.51 toolchain instead of bleeding edge

1.52 and 1.53 has problems with incremental compilation,
so some people chose to stay on 1.51 for now.

So let's make sure egui supports 1.51 for a while!

* Update to cint 0.2.2 to get rust 1.51.0 compatability
2021-06-23 09:16:39 +02:00
Emil Ernerfeldt
62f58a3b05 egui_web: default to light mode unless prefers-color-scheme: dark 2021-06-07 20:56:18 +02:00
Emil Ernerfeldt
ec6268e4ac egui_web: document how to fill the full width of the browser 2021-06-03 18:56:37 +02:00
Emil Ernerfeldt
6a576f4c34 Rename Output::text_cursor to text_cursor_pos 2021-05-20 21:58:44 +02:00
Ivo Vollrath
67c6002578
Fix mac scroll modifier (#402)
* fix modifier key for mouse wheel zoom

* update CHANGELOG

* fix zoom modifier for web backend

* improve instructions in plot demo window

* accept emilk's proposed change

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

* update UI instructions for Plot demo

* improve UI instructions for plot demo

Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>
2021-05-20 19:56:33 +02:00
Emil Ernerfeldt
934bb7f5e9 egui_web: fix double-paste bug 2021-05-11 19:25:31 +02:00
Emil Ernerfeldt
4022b84ae7 group rustdoc lints under rustdoc:: prefix 2021-05-09 14:01:57 +02:00
Emil Ernerfeldt
04d9ce227b Tidy up multitouch code: remove double spaces after full stop
Weirdest thing I've seen in my life.
2021-05-08 22:49:40 +02:00
Ivo Vollrath
03721dbfd8
Basic multi touch support (issue #279) (#306)
* translate touch events from glium to egui

Unfortunately, winit does not seem to create _Touch_ events for the touch pad
on my mac.  Only _TouchpadPressure_ events are sent.

Found some issues (like
[this](https://github.com/rust-windowing/winit/issues/54)), but I am not sure
what they exactly mean:  Sometimes, touch events are mixed with
touch-to-pointer translation in the discussions.

* translate touch events from web_sys to egui

The are a few open topics:
- egui_web currently translates touch events into pointer events.
  I guess this should change, such that egui itself performs this kind of
  conversion.
- `pub fn egui_web::pos_from_touch_event` is a public function, but I
  would like to change the return type to an `Option`.  Shouldn't this
  function be private, anyway?

* introduce `TouchState` and `Gesture`

InputState.touch was introduced with type `TouchState`, just as
InputState.pointer is of type `Pointer`.

The TouchState internally relies on a collection of `Gesture`s.  This commit
provides the first rudimentary implementation of a Gesture, but has no
functionality, yet.

* add method InputState::zoom()

So far, the method always returns `None`, but it should work as soon as the
`Zoom` gesture is implemented.

* manage one `TouchState` per individual device

Although quite unlikely, it is still possible to connect more than one touch
device. (I have three touch pads connected to my MacBook in total, but
unfortunately `winit` sends touch events for none of them.)

We do not want to mix-up the touches from different devices.

* implement control loop for gesture detection

The basic idea is that each gesture can focus on detection logic and does not
have to care (too much) about managing touch state in general.

* streamline `Gesture` trait, simplifying impl's

* implement first version of Zoom gesture

* fix failing doctest

a simple `TODO` should be enough

* get rid of `Gesture`s

* Provide a Zoom/Rotate window in the demo app

For now, it works for two fingers only.  The third finger interrupts the
gesture.

Bugs:
- Pinching in the demo window also moves the window -> Pointer events must be
  ignored when touch is active
- Pinching also works when doing it outside the demo window -> it would be nice
  to return the touch info in the `Response` of the painter allocation

* fix comments and non-idiomatic code

* update touch state *each frame*

* change egui_demo to use *relative* touch data

* support more than two fingers

This commit includes an improved Demo Window for egui_demo, and a complete
re-write of the gesture detection.  The PR should be ready for review, soon.

* cleanup code and comments for review

* minor code simplifications

* oops – forgot the changelog

* resolve comment fee8ed83db (r623226656)

* accept suggestion https://github.com/emilk/egui/pull/306#discussion_r623229228

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

* fix syntax error (dough!)

* remove `dbg!` (why didnt clippy see this?)

* apply suggested diffs from review

* fix conversion of physical location to Pos2

* remove redundanct type `TouchAverages`

* remove trailing space

* avoid initial translation jump in plot demo

* extend the demo so it shows off translation

Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>
2021-05-06 21:01:10 +02:00
Emil Ernerfeldt
c2744a1437
Implement trackpad pinch-to-zoom for plots in egui_web (#333)
This adds a new `zoom_delta` to input.
This is hooked up to ctrl-scroll on egui_web and egui_glium.

Browsers convert trackpad pinch gestures to ctrl-scroll,
so this means you can not pinch-to-zoom plots (on trackpad).

In the future we can support multitouch pinch-to-zoom via the same
`InputState::zoom_factor()` function
2021-04-25 17:04:34 +02:00
Emil Ernerfeldt
b69bc2c06a egui_web: Scroll faster when scrolling with mouse wheel
Closes https://github.com/emilk/egui/issues/159
2021-04-24 11:08:29 +02:00
Emil Ernerfeldt
76d5229821
CI: run cargo doc (#309)
* Deny doc errors

* Add intentional bad intradoc link to test CI

* Add cargo doc to CI

* Fix carg doc web (add wasm32 target)

* Fix intentionally broken doc-link
2021-04-15 10:35:15 +02:00
Lin Han
20bf09560e
IME: Handle composition events to show suggestion on web (#278)
* Handle composition message to show suggestion.

* CI check

* Apply suggestions from code review

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

* Some minor changes

Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>
2021-04-12 20:57:14 +02:00
Emil Ernerfeldt
aba2108159 Replace JSON with RON for persistence (epi/eframe/glium/web) 2021-04-05 14:23:42 +02:00
Lin Han
22cd1a8e10
Move IME candidate window following text cursor (#258)
* egui_web: enable IME support on web.

* Move candidate window following text cursor.

* Preclude too frequent agent movement.

* IME candidate window move on native app.
2021-03-30 08:48:55 +02:00
Lin Han
795282edc0
egui_web: enable IME support on web. (#253) 2021-03-26 13:56:26 +01:00
Emil Ernerfeldt
958aea922f Add a lot more CursorIcon's 2021-03-13 12:38:03 +01:00
Emil Ernerfeldt
44cd304cdf Add experimental screen_reader feature
Part of https://github.com/emilk/egui/issues/167
2021-03-08 20:58:01 +01:00
Emil Ernerfeldt
1c06622dbc Hold down a modifier key when clicking a link to open it in a new tab 2021-03-08 17:48:23 +01:00
Emil Ernerfeldt
cd4c07e09a Output events when widgets gain keyboard focus
Part of https://github.com/emilk/egui/issues/167
2021-03-07 19:45:20 +01:00
Ridan Vandenbergh
4df8418e41
fix: Modern browsers encode Space as ' ' (#208) 2021-03-07 10:20:11 +01:00
Emil Ernerfeldt
dbc6a620cd Control the maximum egui web canvas size with App::max_size_points 2021-02-12 17:58:02 +01:00
Emil Ernerfeldt
0f33bc7c34
Fix web blur (#151)
* [egui_web] Always use an even canvas size

Fixes https://github.com/emilk/egui/issues/103

* [egui_web] Position canvas at top of screen

This avoids jumpyness when resizing,
caused by rounding height to an even number
2021-02-01 20:44:39 +01:00
Emil Ernerfeldt
b493bc6efc Wrap tesselated output in struct ClippedMesh(Rect, Mesh) 2021-01-25 21:43:17 +01:00
Emil Ernerfeldt
247026149c
Multiple mouse button support (#135)
Add support for primary, secondary and middle mouse buttons. Also improve ability to click things in low FPS situations.

This introduces a lot of breaking changes:

    Backends/integrations now pass mouse events via the even stream.
    Response has an interface of mostly methods instead of public members.
    input.mouse is now input.pointer and has new interface.


* Rename 'mouse' to 'pointer' everywhere (pointer = mouse or touch)

* Make Response::clicked and Response::double_clicked into methods

* Remove Response::active and add dragged() and interact_pointer_pos()

* Support multiple mouse buttons

* Make PointerState interface all methods

* Make most members of Response private
2021-01-25 18:50:19 +01:00
Emil Ernerfeldt
31b7eda51e Rename Egui to egui
Also update iamges in README.md
2021-01-17 14:48:59 +01:00
Emil Ernerfeldt
b869db728b [egui_web] Call prevent_default for arrow keys when entering text
Closes https://github.com/emilk/egui/issues/58
2021-01-17 12:24:17 +01:00
Emil Ernerfeldt
ef595153c9 [egui_web] Improve alpha blending + add WebGL2 painter 2021-01-16 20:48:00 +01:00
Emil Ernerfeldt
69d31a5e47 [eframe] Make persistence, http and time optional features
Saves on compile times.
2021-01-04 10:25:13 +01:00
Emil Ernerfeldt
c6a5af19e6 Add all alpha-numeric keys to egui::Key
Closes https://github.com/emilk/egui/issues/91
2021-01-03 11:25:13 +01:00