Commit graph

1631 commits

Author SHA1 Message Date
follower
60fd70921d
Typo fixes: "an"->"and" & "tex" -> "text" (#432) 2021-06-12 22:17:57 +02:00
Emil Ernerfeldt
ef36cac422 Improve misc docs 2021-06-12 22:12:45 +02:00
Zenithsiz
7f1123a54c
Expanded TextBuffer interface to allow borrowed values. (#444)
* Expanded `TextBuffer` interface to allow borrowed values.

* Removed superfluous `PartialEq` requirement on `TextBuffer`.

* Removed `std::fmt::Display` requirement for `TextBuffer`.
Now uses the `AsRef<str>` impl to format it where applicable.

Co-authored-by: Filipe Rodrigues <filipejacintorodrigues1@gmail.com>
2021-06-12 22:12:32 +02:00
Jay Oster
00575e158f
Fix an issue where losing focus could prevent the event loop from receiving events for releasing modifier keys (#479)
- This issue was made apparent on macOS since 67c6002578
- Repro:
  1. Cmd+Tab away from the window (this will keep the Cmd modifier state `true` until it is pressed again)
  2. Cmd+Tab back to the window
  3. Try to scroll with the trackpad or mouse wheel ... it won't work until you press and release the Cmd key!
  4. Also the plot widget will be stuck in "zoom mode" while the Cmd modifier state is true.
- I was not able to reproduce the issue with `egui_web`
2021-06-12 15:55:08 +02:00
Emil Ernerfeldt
778bcc1ef7
Style tweaks (#450)
* Tweak style

More compact, less round, less noisy

* Button text is now same size as body text
* The rounder corners are now less rounded
* Collapsing headers no longer have a frame around them
* Combo-boxes looks better when opened
* Slightly more muted colors
* Remove extra line spacing after `\n` (i.e. between paragraphs)

* Thinner scrollbars

* Tweak light mode

* Tweak shadows

* Fix broken doc link

* Add style tweak to CHANGELOG
2021-06-12 15:53:56 +02:00
Emil Ernerfeldt
a50ddc2703 TextEdit: Clean up password masking
Follow-up to https://github.com/emilk/egui/pull/412
2021-06-12 15:18:14 +02:00
Emil Ernerfeldt
f4a95b1e5f TextEdit: don't set response.changed() when cursor changes 2021-06-12 15:02:33 +02:00
Nolan Darilek
508f6d9bf5
Additional accessibility support (#412)
* Expose getter for currently focused widget.

* Remove a level of indirection, exposing the widget event on the top level.

* Align widget descriptions more closely with common screen reader conventions.

Note that this work isn't complete--I'll correct more cases as I add more widgets and become familiar with their structures.

* Add support for click and double-click events.

* Add `ValueChanged` events, with initial support for text.

* Add support for reporting cursor selection changes.

* Track enabled/disabled status.

* Move `prev_text` off of the widget struct.

* Get rid of `has_widget_info` and push events directly where it makes sense.

* Fix typo.

* s/text_value/current_text_value/

* Use a `RangeInclusive` for text selection.

* Invert parameters.

* Various fixes.

* Only dispatch `SelectionChanged` if the selection actually changes.
* Fix missing focus events.

* If values for `current_text` and `prev_text` are unchanged, filter out the previous value.

* No need to pass in `&mut prev_text` everywhere

* Appease Clippy.

* Mask password fields in generated events.

Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>
2021-06-12 14:54:01 +02:00
Sven Niederberger
2b4d3fa5b1
apply suggested fix (#481) 2021-06-12 14:36:39 +02:00
Emil Ernerfeldt
998e07d865
Make sure the scroll bar is never outside the screen rectangle (#475)
* Make sure the scroll bar is never outside the screen rectangle

This is an alternative attempt to fix the bug mentioned in
https://github.com/emilk/egui/pull/392

egui expects that the container can always be made wider,
which is true for all egui Ui:s, but not true for the outer
frame/chrome that egui ultimately needs to sit within.

* Clamp scroll to screen rect rather than available rect

* Fix scrollbar spacing when shrinking too small

* Update changelog
2021-06-12 14:30:42 +02:00
edko99
e007afc3c3
Freeze scroll area (#472)
* added ScrollArea::enable_scrolling

* also freeze dragging and scroll-bar

* fixed styling of inactive scrollbar

* fixed docs (backtick-quoted TextEdit)

Co-authored-by: edko99 <edko@jouzz.com>
2021-06-12 14:30:14 +02:00
Sven Niederberger
02db9ee583
Plot: Legend improvements (#410)
* initial work on markers

* clippy fix

* simplify marker

* use option for color

* prepare for more demo plots

* more improvements for markers

* some small adjustments

* better highlighting

* don't draw transparent lines

* use transparent color instead of option

* don't brighten curves when highlighting

* Initial changes to lengend:
* Font options
* Position options
* Internal cleanup

* draw legend on top of curves

* update changelog

* fix legend checkboxes

* simplify legend

* remove unnecessary derives

* remove config from legend entries

* avoid allocations and use line_segment

* compare against transparent color

* create new Points primitive

* fix doctest

* some cleanup and fix hover

* common interface for lines and points

* clippy fixes

* reduce visibilities

* update legend

* clippy fix

* change instances of "curve" to "item"

* change visibility

* Update egui/src/widgets/plot/mod.rs

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

* Update egui/src/widgets/plot/mod.rs

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

* Update egui_demo_lib/src/apps/demo/plot_demo.rs

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

* Update egui_demo_lib/src/apps/demo/plot_demo.rs

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

* changes based on review

* add legend to demo

* fix test

* move highlighted items to front

* dynamic plot size

* add legend again

* remove height

* clippy fix

* update changelog

* minor changes

* Update egui/src/widgets/plot/legend.rs

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

* Update egui/src/widgets/plot/legend.rs

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

* Update egui/src/widgets/plot/legend.rs

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

* changes based on review

* add functions to mutate legend config

* use horizontal_align

Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>
2021-06-07 22:36:13 +02:00
Emil Ernerfeldt
ece25ee7f3 Add Ui::set_visible as a way to hide widgets
Closes https://github.com/emilk/egui/issues/460
2021-06-07 22:12:49 +02:00
Emil Ernerfeldt
3c603c55b8 Make Layouts:: horizontal/vertial align/justify pub 2021-06-07 21:06:29 +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
Kayo Phoenix
31769d400f
Fixed GLSL ES 1.0 version string (#470) 2021-06-07 20:18:42 +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
2af86cd2c7
Revert "Fix scroll bar position (#392)" (#458)
This reverts commit 2932ff0e53.
2021-06-04 00:11:35 +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
Jay Oster
2932ff0e53
Fix scroll bar position (#392)
* Fix scroll bar position

* Always position scroll bar on the right side of the ScrollArea inner rect

* Fix the clipping rect
2021-06-03 18:54:34 +02:00
Emil Ernerfeldt
6468b2b84e
Implement efficent scrolling of large content (#457) 2021-06-03 18:48:45 +02:00
Tiago Ferreira
2cdd90b111
Allow alternate shortcuts on Windows (#456) 2021-06-03 17:39:55 +02:00
Emil Ernerfeldt
4964d762a7 Move WidgetType from output.rs to lib.rs 2021-05-30 22:53:10 +02:00
Emil Ernerfeldt
e6fe6a6f6a Fix occasional jittery vertical positioning of glyphs 2021-05-28 19:51:10 +02:00
Emil Ernerfeldt
4d56d0328b demo: Move egui settings/inspection windows to backend panel 2021-05-28 00:40:36 +02:00
Violeta Hernández
66095b69a7
Disable default features of ord-float (#440)
* Might fix #439

* `cargo update`

If the page builds, then this did fix it.
2021-05-27 20:25:30 +02:00
Emil Ernerfeldt
3b807e1ad6 Add Context::set_debug_on_hover and egui::trace!(ui) 2021-05-27 19:30:08 +02:00
Sven Niederberger
8623909d82
Plotting: Add line markers (#363)
* initial work on markers

* clippy fix

* simplify marker

* use option for color

* prepare for more demo plots

* more improvements for markers

* some small adjustments

* better highlighting

* don't draw transparent lines

* use transparent color instead of option

* don't brighten curves when highlighting

* update changelog

* avoid allocations and use line_segment

* compare against transparent color

* create new Points primitive

* fix doctest

* some cleanup and fix hover

* common interface for lines and points

* clippy fixes

* reduce visibilities

* Update egui/src/widgets/plot/mod.rs

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

* Update egui/src/widgets/plot/mod.rs

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

* Update egui_demo_lib/src/apps/demo/plot_demo.rs

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

* Update egui_demo_lib/src/apps/demo/plot_demo.rs

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

* changes based on review

* fix test

* dynamic plot size

* remove height

Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>
2021-05-27 18:40:20 +02:00
St John Giddy
e320ef6c64
Detect single-threaded mutex reentry in debug mode (#433)
* fix(plot): expose VLine and HLine

* feat(mutex): detect mutex lock reetry

* chore(mutex): fix lints in tests
2021-05-26 22:13:24 +02:00
Emil Ernerfeldt
c9766f8a7b
Resizable panels + right and bottom panels (#438)
* Side panel resizing and add right panels

* Add resizable top/bottom panels

* Deprecate TopPanel

* Final tweaks and update CHANGELOG.md
2021-05-26 22:06:10 +02:00
Emil Ernerfeldt
196ddff499 Rename Shape::polygon to Shape::convex_polygon
epaint only supports filling convex polygons (for now)
2021-05-20 22:14:08 +02:00
Emil Ernerfeldt
085233f907 Improve various documentation 2021-05-20 22:12:17 +02:00
Emil Ernerfeldt
5b462197fa Improve instructions in PR template 2021-05-20 22:07:02 +02:00
Emil Ernerfeldt
2dea4d8db2 Color picker: fix rare infinite loop in very weird situtations 2021-05-20 22:05:44 +02:00
Emil Ernerfeldt
f4ddc21740 Simplify IME cursor pos handling in TextEdit 2021-05-20 22:01:59 +02:00
Emil Ernerfeldt
6a576f4c34 Rename Output::text_cursor to text_cursor_pos 2021-05-20 21:58:44 +02:00
Emil Ernerfeldt
8cce09687f Expose text layout functions in Painter 2021-05-20 21:53:39 +02:00
Emil Ernerfeldt
53d5d32a80 GitHub issue templates: add reminder to check for duplicates 2021-05-20 21:47:17 +02:00
Emil Ernerfeldt
94479317b3 Add #[must_use] to container types: remind to call show() 2021-05-20 21:45:00 +02:00
Emil Ernerfeldt
a892519297 Add Style::override_text_style
Add Style::override_text_style to easily change the text style
of everything in a `Ui` (or globally).

You can now change `TextStyle` on checkboxes,
radio buttons and `SelectableLabel`.

Closes https://github.com/emilk/egui/issues/406
Closes https://github.com/emilk/egui/pull/407
2021-05-20 21:31:34 +02:00
Zenithsiz
57981d49ee
Add support for buffers other than a String in TextEdit (#399)
* Initial design for `TextBuffer` trait, to allow `TextEdit` to edit types other than `String`.

* Moved `insert_text` implementation into `TextBuffer`.
This allows the user to implement text inserting depedent on their type instead of using a `String` and converting back to `S`, which may be a lossless convertion.

* Moved part of `delete_selected_ccursor_range` implementation into `TextBuffer::delete_range`.

* `TextBuffer::insert_text` not returns how many characters were inserted into the buffer.
This allows implementations to "saturate" the buffer, only allowing for a limited length of characters to be inserted.

* Now using `byte_index_from_char_index` instead of custom implementation.

* `decrease_identation` impl now modified the string in-place.
Removed `From<String>` bound for `TextBuffer`.

* Added changes to changelog.

* Moved updated changelog to .

* Updated documentation on `TextBuffer`.

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

* Renamed `TextBuffer::delete_text_range` to `delete_char_range`.

Co-authored-by: Filipe Rodrigues <filipejacintorodrigues1@gmail.com>
Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>
2021-05-20 21:00:50 +02:00
Wojciech Kępka
d292b831a1
Add an option to overwrite frame of SidePanel and TopPanel (#418)
* Add an option to overwrite frame of SidePanel and TopPanel

* Update CHANGELOG
2021-05-20 20:10:30 +02:00
Gray Olson
c0929014bf
Add support for cint (conversions to and from color types) (#393)
* implement cint for color types under feature flag

* upgrade to cint 0.2, remove from default features

* upgrade to cint 0.2.1, add a couple more from/into implementations

* changelog entry

* fix typo in changelog

* sort dependency

* fmt
2021-05-20 20:09:52 +02:00
St John Giddy
ac82cc7be3
fix(plot): expose VLine and HLine (#422) 2021-05-20 19:56:45 +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
5bc53ce069 Improve panel docs
Related to https://github.com/emilk/egui/issues/421
2021-05-20 19:48:34 +02:00
Violeta Hernández
de02f7d042
Value of DragValue correctly clamped (#405)
* Update drag_value.rs

* `value` → `old_value`
2021-05-18 20:03:04 +02:00
Emil Ernerfeldt
dd4ac43b13 Make sure egui can handle zero-sized screen rect
This would previously hit a debug assert

Fixes https://github.com/emilk/egui/issues/395
2021-05-17 22:53:52 +02:00
Emil Ernerfeldt
6e5b52e3bc Add features extra_asserts and extra_debug_asserts for more asserts
This replaces all debug_asserts with these opt-in asserts

Related: https://github.com/emilk/egui/issues/395
2021-05-17 22:38:39 +02:00