Commit graph

256 commits

Author SHA1 Message Date
triangle drawer
008a971e73
Fix wrong gamma in WebkitGTK (#888)
Closes https://github.com/emilk/egui/issues/794

Also refactor and improve VAO support detection

Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>
2021-11-13 12:32:01 +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
Emil Ernerfeldt
49e43885ff
Replace Context::begin_frame/end_frame with fn run taking a closure (#872)
* Replace Context begin_frame/end_frame with `fn run` taking a closure
* Create `egui::__run_test_ui` to replace `Ui::__test`
* Add helper `egui::__run_test_ctx` for doctests
2021-11-03 20:11:25 +01:00
Emil Ernerfeldt
c71090473b glow-vs-web cleanup following https://github.com/emilk/egui/pull/868 2021-11-03 19:35:20 +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
78dfde40b2 Remove deprecated functions 2021-10-30 09:46:06 +02:00
Emil Ernerfeldt
08cc07bb2d Release 0.15.0 - Syntax highlighting, hscroll, egui-winit and egui_glow 2021-10-24 16:15:07 +02:00
Emil Ernerfeldt
316202c33a egui_web: improve text input on mobile and for IME 2021-10-24 15:57:36 +02:00
Emil Ernerfeldt
a3ba85dbb3 Improve docs 2021-10-23 06:03:45 +02:00
Emil Ernerfeldt
4194a83a5e Update ron 0.6 -> 0.7 2021-10-23 05:53:58 +02:00
Caleb Smith
79d1ede496
Add Frame::set_window_title() (#828)
* Add `Frame::set_window_title()`

* Changelog and fmt for `Frame::set_window_title()`

Co-authored-by: Caleb Smith <caleb@myrvmail.com>
2021-10-23 00:03:17 +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
8178d23d19
Deduplicate code found in both egui_glium and egui_glow (#819)
* Move window building to egui-winit

* Move icon loading to egui-winit

* `use glow::HasContext;` -> `use glow::HasContext as _;`

* Move FileStorage into epi behind a feature flag

* De-duplicate screen_size_in_pixels and native_pixels_per_point

* Move creation of FileStorage to epi

* Handle epi app output (window size changes etc) in egui-winit

* Move app and memory persistence and autosave logic to egui-winit

* fix check.sh

* Make the epi backend opt-in for egui_glium and egui_glow

* Fix persistence

* Add integration name to epi::IntegrationInfo and the demo

* Clean up Cargo.toml files and fix making egui_glium optional

* fix typo

* Make egui_glium compile without the `epi` feature
2021-10-19 21:40:55 +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
df3aeab434 Update egui_glium and egui_web changelogs 2021-10-18 23:13:13 +02:00
Connor Fitzgerald
74494cd713
Add clear to webgl1 and webgl2 backends (#816)
Signed-off-by: Connor Fitzgerald <connorwadefitzgerald@gmail.com>
2021-10-18 23:10:30 +02:00
Emil Ernerfeldt
96be848e42 rename egui_template to eframe_template 2021-10-18 20:19:43 +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
5539dbe620
Add separate serialize feature and better persitence control (#753)
* Rename epaint feature "persistence" to "serialize"

* Add separate "serialize" feature to egui

* egui_demo_lib: separate serialize and persistence features

* Add App::persist_native_window and App::persist_egui_memory

Controls what gets persisted
2021-09-29 08:45:13 +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
zu1k
f6fb4d942a
epi: drag native window (#728)
* feat: drag window

* Update epi/src/lib.rs

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

* Update egui_demo_lib/src/backend_panel.rs

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

* cargo fmt

Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>
2021-09-28 17:34:58 +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
zu1k
19eed94499
feat: Set whether to show decorations (#672)
Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>
2021-09-07 21:42:14 +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
2382425198 Revert "Silence nightly clippy"
This reverts commit acf9d0114d.
2021-09-05 11:00:56 +02:00
triangle drawer
203d571c8b
Add api for accessing backend texture via epi (#695)
* Define NativeTexture trait for offscreen rendering
add demo for NativeTexture trait

* write changelog

* add comment for native texture example

* formatting

* add license of Rust logo

* NativeTexture trait method rename
remove duplicate function with native texture
remove rust logo

* deprecated notice for register_glium_texture,register_webgl_texture

* collect deprecated notice
2021-09-05 11:00:45 +02:00
Emil Ernerfeldt
acf9d0114d Silence nightly clippy 2021-09-05 10:19:28 +02:00
Emil Ernerfeldt
3b75a84d3b Point crate repository & homepage urls to their subfolders 2021-09-03 21:12:44 +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
e98ae2ea7a
Revert "feat: Set whether to show decorations (#660)" (#671)
This reverts commit 0db74f3000.
2021-08-28 12:29:19 +02:00
zu1k
0db74f3000
feat: Set whether to show decorations (#660)
* feat: Set whether to show decorations

* cargo fmt

* Update comment and changelog
2021-08-28 11:18:36 +02:00
Emil Ernerfeldt
2ce99f3a12 Release 0.14.1 - Bug fixes and better web blending 2021-08-28 11:04:39 +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
AsmPrgmC3
3a634ff46e
Reintroduce color fixes to WebGL1 backend, but only if sRGB textures are supported (#652)
Also removed the 300es shaders, as they'd be identical to the 100es ones.
2021-08-26 18:40:35 +02:00
AsmPrgmC3
31a1882997
Fix alpha blending in WebGL2 backend (#650)
Add a render-to-texture step with an sRGBA8 texture
2021-08-25 21:28:42 +02:00
Emil Ernerfeldt
cb566fc295 Release 0.14.0 - Ui panels and bug fixes 2021-08-24 16:47:10 +02:00
Emil Ernerfeldt
91bdf9ba6e
egui_web: make text thicker and less pixelated (#640)
Closes https://github.com/emilk/egui/issues/516
2021-08-21 21:18:00 +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
Emil Ernerfeldt
d6299bcd91 Expand egui_web/README.md with list of shortcomings 2021-08-16 21:17:15 +02:00
skuzins
6a8a93e120
Generalize http fetch (#488)
* Generalize http fetch

- allow bytes as request body
- expose request and response headers in API
- update http example to show response headers and allow POST requests

* clippy fixes

* add missing comment, pub

* doc comment fix

* fix: missing argument when feature syntect not enabled

* formatting fixes

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

* remove commented out code

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

* formatting fixes

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

* cargo fmt

Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>
2021-08-15 16:56:46 +02:00
mental
eefc56c213
fix and pin web-sys breakage in Navigator::clipboard (#608) 2021-08-15 16:55:33 +02:00
Emil Ernerfeldt
784bac53f1 Improve error message on bad texture allocation
Fixes https://github.com/emilk/egui/issues/592
2021-07-29 22:20:22 +02:00
Emil Ernerfeldt
4feee59f84 Improve README files for all crates 2021-07-29 22:04:20 +02:00
Emil Ernerfeldt
d807451348 Release 0.13.0 - Better panels, plots and new visual style 2021-06-24 20:00:06 +02:00
Emil Ernerfeldt
eb6c293774 Update crates glium, tts, and run cargo update 2021-06-24 17:51:39 +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
269a4538d9 clippy fixes for rust 1.53 2021-06-22 23:38:34 +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
44b573f6a6 epi: merge App::load into App::setup, and provide Frame argument
This gives users more control over the order of load/setup.

It also allows users to load textures in setup.
2021-06-07 20:53:33 +02:00
Emil Ernerfeldt
effd3c7440 egui_web: Vastly improve WebGL alpha blending
This finally fixes the rough edges on text, especially in light mode
2021-06-04 23:03:48 +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
442b953964 Tell docs.rs to use the --all-features flag when generating docs
Closes https://github.com/emilk/egui/issues/381
2021-05-12 20:02:25 +02:00
Emil Ernerfeldt
934bb7f5e9 egui_web: fix double-paste bug 2021-05-11 19:25:31 +02:00
Emil Ernerfeldt
8f8ba16696 Release 0.12.0 - Multitouch, user memory, window pivots, and improved plots 2021-05-10 18:27:39 +02:00
Emil Ernerfeldt
7747a1f171 Update tts 0.15 -> 0.16 2021-05-09 14:42:14 +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
0d71017ad4 clippy fixes for rust 1.52 2021-05-06 20:49:22 +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
b30cb3313a
Try to allow turning off default_fonts for all libs (#266) 2021-04-07 20:14:44 +02:00
Emil Ernerfeldt
d544c3dd8b Release 0.11.0 - Optimization, screen reader & new layout logic 2021-04-05 14:49:06 +02:00
Emil Ernerfeldt
7792ee0422 Update tts from 0.14 -> 0.15 (screen reader feature) 2021-04-05 14:23:42 +02:00
Emil Ernerfeldt
aba2108159 Replace JSON with RON for persistence (epi/eframe/glium/web) 2021-04-05 14:23:42 +02:00
Emil Ernerfeldt
1068750bbc Clean up egui_web code a bit 2021-04-01 23:07:15 +02:00
Emil Ernerfeldt
1f965d16a2 Try the new cargo dependency resolver added in rust 1.51 2021-03-31 23:07:37 +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
Emil Ernerfeldt
1bb100d766 Updated changelogs 2021-03-27 10:37:31 +01:00
Lin Han
795282edc0
egui_web: enable IME support on web. (#253) 2021-03-26 13:56:26 +01:00
Emil Ernerfeldt
70c6f4596a Add checkbox in demo app to turn screen reader on/off 2021-03-24 21:35:29 +01:00
Emil Ernerfeldt
f5c372910c Replace emath::clamp with f32::clamp (new in rustc 1.50) 2021-03-21 17:47:03 +01:00
triangle drawer
b1883d5d48
Add functions to register textures in egui_web and egui_glium (#226)
* add texture registering function

* fmt

* Revert "add texture registering function"

This reverts commit f9b4db12

* make get_texture public to get render target owned by Painter .

* revert egui_web painter.rs change
2021-03-13 12:41:51 +01:00
Emil Ernerfeldt
958aea922f Add a lot more CursorIcon's 2021-03-13 12:38:03 +01:00
Emil Ernerfeldt
4c45ca113e Make sure to include license files in the next release 2021-03-09 18:35:13 +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
fb2db4940e Release 0.10.0 - Plot and polish 2021-02-28 20:11:37 +01:00
Emil Ernerfeldt
8fb1472560 Add glsl files to egui_web and egui_glium includes 2021-02-28 20:11:37 +01:00
Emil Ernerfeldt
e417fac52e Fix web shaders
Got broken in https://github.com/emilk/egui/pull/187
2021-02-28 19:47:01 +01:00
Emil Ernerfeldt
84cc227f11 eframe: always provide a texture allocator 2021-02-28 19:09:48 +01:00
Emil Ernerfeldt
5f6a468812 Add Context::set_pixels_per_point to control the scale of the UI 2021-02-21 11:23:33 +01:00
Kayo Phoenix
c9919daa11
Added shaders on GLSL 1.2 (#187)
* Added shaders on GLSL 1.2

- Used `glium::program` to create shaders
- Moved shaders code to its own sources and include it as str
- Added shaders implementation on GLSL which allows run egui on old hardware
  (Raspberry Pi 1/zero in game again)

* Moved webgl shaders code to sources in `shader` subdir

* Added GLSL ES shaders to glium backend to support OpenGL ES

* Described changes related to GLSL versions support
2021-02-20 19:48:02 +01:00
Emil Ernerfeldt
7dad76b913 Use explicit epaint over paint alias (re-export)
egui reexports the `epaint` crate both under its original name
and under the alias `paint` (for historical reasons)
2021-02-14 10:53:39 +01:00
Emil Ernerfeldt
6d255cd179 Use explicit emath to math alias
egui exports `emath` under its original name AND under the alias `math`
(for historical reasons).
2021-02-14 10:44:46 +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
5906bf7a87 Fix clippy 1.50 lints 2021-02-12 17:40:53 +01:00
Emil Ernerfeldt
b61db038f2 Release 0.9.0 - light mode, right clicks and more 2021-02-07 17:06:51 +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