Commit graph

1683 commits

Author SHA1 Message Date
Emil Ernerfeldt
64b0478993 Fix the issue templates 2021-09-28 20:29:11 +02:00
Emil Ernerfeldt
d9db768180 Optimize tessellator: pass options by reference 2021-09-28 18:00:01 +02:00
Emil Ernerfeldt
2e83e36146 Use ahash for Id and other things that need hashing 2021-09-28 17:56:24 +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
1b36863248
Split out new crate egui-winit from egui_glium (#735) 2021-09-28 17:33:28 +02:00
Emil Ernerfeldt
ba0e3780a1 Add epaint::util::hash function for hashing a value 2021-09-26 03:16:12 +02:00
Emil Ernerfeldt
976260c2bd Better error if neither single_threaded or multi_threaded features is on 2021-09-25 05:26:45 +02:00
Emil Ernerfeldt
52e49bd4ae README: Point to better example in the "how to render 3D" FAQ section 2021-09-20 22:58:26 +02:00
Emil Ernerfeldt
cf17cb2065 egui_glium: allow sharing a native glium texture using Rc 2021-09-20 22:52:29 +02:00
Emil Ernerfeldt
cfb6b31914 Improve native_texture.rs demo 2021-09-20 22:39:44 +02:00
Emil Ernerfeldt
a5a5d6176d Improve the frame around ImageButton
Helps https://github.com/emilk/egui/issues/721
2021-09-20 22:37:21 +02:00
Emil Ernerfeldt
e7cfda4941
Shape refactor (#705)
* More introspection stats about vertices/indices etc

* more serde derive

* #[inline] to Shape constructors

* Introduce RectShape

* Introduce CircleShape

* Introduce PathShape

* More serde derive

* impl Copy for RectShape and CircleShape

* Simplify some code

* More serde derive

* Add helpers for appending more input or output

* Serde derives for RawInput

* Rename Fonts::from_definitions to Fonts::new

* Add Output::take

* refactor EguiGlium slightly

* Derive PartialEq for RawInput

* Improve egui::util::History interface

* tweaks

* Improve History filter: add minimum length

* Calculate galley bounding rect

* tessellator: cull line segments and paths

* tessellator: cull meshes

* Fix bug in History bandwidth estimator
2021-09-20 21:36:56 +02:00
Emil Ernerfeldt
93c2fde1fc Extend section about rendering 3D inside of egui 2021-09-19 20:16:50 +02:00
Emil Ernerfeldt
67bf716b0e
Hide DragValue tooltips unless user set Style::explanation_tooltips (#708)
* Hide DragValue tooltips unless user set Style::explanation_tooltips

Closes https://github.com/emilk/egui/issues/548
Closes https://github.com/emilk/egui/pull/704

* Silence drag_angle_tau tooltip too
2021-09-12 23:05:23 +02:00
Emil Ernerfeldt
f2b6edd6db Replace egui_winit_ash_vk_mem with egui-winit-ash-integration in README.md
Closes https://github.com/emilk/egui/issues/707
2021-09-11 09:34:00 +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
ae6418edf3 clippy fix 2021-09-08 23:40:44 +02:00
Emil Ernerfeldt
a76b81647c Hide tooltips while dragging a widget
Also: don't register as click if the
pointer has been pressed for too long.
2021-09-08 23:26:21 +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
241667b078 Reduce monomorphization, reducing wasm size by around 3% 2021-09-07 21:33:10 +02:00
Emil Ernerfeldt
bb034e2e6c Improve documentation of different ui layout functions 2021-09-07 20:48:30 +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
acb5501fe4 Add justified and/or center- and right-aligned text
Label text will now be centered, right-aligned and/or
justified based on the layout.

Galleys are no longer always pivoted in the left top corner,
so now have a Rect rather than just a size.
2021-09-07 20:37:50 +02:00
Emil Ernerfeldt
cbafd10ee4 Clippy fix 2021-09-07 19:59:14 +02:00
Emil Ernerfeldt
d23982d83e Window bounds fix: handle infinite drag_bounds 2021-09-07 19:55:37 +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
aef23753ca Fix clip rectangle of windows that don't fit the central area. 2021-09-07 19:34:34 +02:00
Emil Ernerfeldt
5e3c522b6c clippy fixes 2021-09-06 21:23:57 +02:00
Emil Ernerfeldt
7a9805dfb3 demo: highlight easymark editor field with different fonts and colors 2021-09-06 08:14:47 +02:00
Emil Ernerfeldt
5592124ad5 TextEdit: paint cursor on top of text
This is so that we see the cursor even when the text galley has
background colors, like `code` section in easymark do.
2021-09-05 18:59:35 +02:00
Emil Ernerfeldt
f9afdfa143 TextEdit: left/right arrows move cursor to start/end of selection
Closes https://github.com/emilk/egui/issues/611
2021-09-05 11:11:31 +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
391bec1170 FAQ: add "How do I render 3D stuff in an egui area?" 2021-09-05 10:18:49 +02:00
Emil Ernerfeldt
92503ea9e1 clippy fix 2021-09-05 10:11:52 +02:00
Emil Ernerfeldt
d9f3596475 docs: explain auto-shrinking panels/windows and how to work around it
related to https://github.com/emilk/egui/issues/696
2021-09-05 09:40:25 +02:00
Emil Ernerfeldt
14c989fdfa Implement rotating text
Closes https://github.com/emilk/egui/issues/428
2021-09-05 09:06:53 +02:00
Emil Ernerfeldt
6902151a96 Add example of loading and showing an image with eframe/egui
Closes https://github.com/emilk/egui/pull/700
2021-09-04 17:44:01 +02:00
Emil Ernerfeldt
5f88d89f74
Faster galley cache (#699)
* Speed up galley cache by only using the hash as key

This hashes the job but doesn't compare them with Eq,
which speeds up demo_with_tessellate__realistic by 5-6%,
winning back all the performance lost in
https://github.com/emilk/egui/pull/682

* Remove custom Eq/PartialEq code for LayoutJob and friends

* Silence clippy

* Unrelated clippy fixes
2021-09-04 10:19:58 +02:00
Emil Ernerfeldt
3b75a84d3b Point crate repository & homepage urls to their subfolders 2021-09-03 21:12:44 +02:00
Emil Ernerfeldt
71d18ba3e7 Spelling: tesselate -> tessellate 2021-09-03 21:07:25 +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
de1a1ba9b2
New text layout (#682)
This PR introduces a completely rewritten text layout engine which is simpler and more powerful. It allows mixing different text styles (heading, body, etc) and formats (color, underlining, strikethrough, …) in the same layout pass, and baked into the same `Galley`.

This opens up the door to having a syntax-highlighed code editor, or a WYSIWYG markdown editor.

One major change is the color is now baked in at layout time. However, many widgets changes text color on hovered. But we need to do the text layout before we know if it is hovered. Therefor the painter has an option to override the text color of a galley.


## Performance
Text layout alone is about 20% slower, but a lot of that is because more tessellation is done upfront. Text tessellation is now a lot faster, but text layout + tessellation still lands at a net loss of 5-10% in performance. There are however a few tricks to speed it up (like using `smallvec`) which I am saving for later. Text layout is also cached, meaning that in most cases (when all text isn't changing each frame) text tessellation is actually more important (and that's more than 2x faster!).

Sadly, the actual text cache lookup is significantly slower (300ns -> 600ns). That's because the `TextLayoutJob` is a lot bigger (it has more options, like underlining, fonts etc), so it is slower to hash and compare. I have an idea how to speed this up, but I need to do some other work before I can implement that.

All in all, the performance impact on `demo_with_tesselate__realistic` is about 5-6% in the red. Not great; not terrible. The benefits are worth it, but I also think with some work I can get that down significantly, hopefully down to the old levels.
2021-09-03 18:18:00 +02:00
Emil Ernerfeldt
36cffd7b84 Fix wrongly sized multiline TextEdit in justified layouts 2021-09-03 17:49:23 +02:00
Mohammed Alyousef
d9fd806e94
add fltk-egui as a 3rd party backend crate (#694) 2021-09-03 15:20:34 +02:00
Emil Ernerfeldt
4f8dcf9a27 Augment list of fedora dependencies
Taken from https://github.com/emilk/egui_template/pull/24
2021-09-02 21:25:38 +02:00
Bradley Smith
931c3a9b6a
TextEdit option cursor_at_end to control initial position of cursor at beginning or end. (#687) 2021-09-02 19:37:55 +02:00
JerzySpendel
56502fbb3c
Make paint function accept anything implementing Surface trait (#681)
* Make paint function accept anything implementing Surface trait

* Remove unused imports
2021-09-02 14:44:50 +02:00
Emil Ernerfeldt
9def6ef6df All Ui:s must now have a finite max_rect
Deprecated `max_rect_finite`, `available_size_before_wrap_finite`
and `available_rect_before_wrap_finite`.
2021-08-28 16:02:16 +02:00