Commit Graph

981 Commits

Author SHA1 Message Date
Emil Ernerfeldt 693426d9c6
Layout fixes (#651)
* Fix incorrect max_width/height of panels

* Fix set_width/set_min_width/set_height/set_min_height

Closes https://github.com/emilk/egui/issues/647

Broke in https://github.com/emilk/egui/pull/629

* Fix expand_to_include_x/expand_to_include_y

* Make minimum grid column width propagate properly

* Expand cursor when max_rect expands

* Add ui.expand_to_include_y

* Only expand cursor in advance

* demo: clean up font_book code

* Fix: Make sure `TextEdit` contents expand to fill width if applicable

* ProgressBar: minimum width and fix for having it in an infinite layout

* clippy fix
2021-08-26 18:50:30 +02:00
Emil Ernerfeldt c510899019 Revert "Fix set_width/set_min_width/set_height/set_min_height"
This reverts commit 01d3f53113.
2021-08-25 22:02:54 +02:00
Emil Ernerfeldt c2d1034af3 Make Options::tessellation_options public
Closes https://github.com/emilk/egui/issues/644
2021-08-25 21:39:00 +02:00
Emil Ernerfeldt 01d3f53113 Fix set_width/set_min_width/set_height/set_min_height
Closes https://github.com/emilk/egui/issues/647

Broke in https://github.com/emilk/egui/pull/629
2021-08-25 17:28:22 +02:00
Emil Ernerfeldt cb566fc295 Release 0.14.0 - Ui panels and bug fixes 2021-08-24 16:47:10 +02:00
Emil Ernerfeldt a2082f226f Change an assert into an egui_assert 2021-08-24 16:00:55 +02:00
Emil Ernerfeldt f11f9bd1fd Bug fix: fix horizontal layouts inside infinitely wide Ui:s. 2021-08-24 16:00:39 +02:00
Emil Ernerfeldt d865852d24 Add a minimum width to TextEdit to prevent them from being tiny 2021-08-24 15:59:31 +02:00
Emil Ernerfeldt ffbd094f53 Improve docs 2021-08-23 21:47:00 +02:00
Emil Ernerfeldt f8a3042258 Fix for dragging widgets with non-primary mouse button
Broken in e31312cf7a
2021-08-22 21:16:54 +02:00
Emil Ernerfeldt 5a63419aa3 Bug fix: clicking the edge of a menu button would flicker the menu
There was a very annoying bug where clicking the edge of a menu button
would open the menu and immediately close it.
2021-08-21 21:59:25 +02:00
sigaloid 12fd4906de
Update dependencies and pass all clippy's (#636)
* Cargo update

https://pastebin.com/raw/KWNuJD9u

* Cargo clippy +nightly

* Remove deprecated clippy

* Fix unbalanced backtick (now passes cargo {+nightly,} clippy)
2021-08-20 22:31:20 +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
mitchmindtree 488b1f2462
Add methods for optionally displaying the background/axes of a `Plot` (#562)
* Add methods for optionally displaying the background/axes of a `Plot`

These are particularly useful when using the `Plot` widget as an overlay
over an existing grid or some other content.

* Allow for showing each axis of a `Plot` individually
2021-08-20 19:04:44 +02:00
gents83 68ed22ab6f
Add option to select collapsing headers (#623)
* Add collapsing header select as selectable label

* Modified Tree demo adding selectable example

* Update egui/src/containers/collapsing_header.rs

Selected is not linked to selectable

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

* Update egui/src/containers/collapsing_header.rs

Description example

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

* Changing example without name clashing

* Fixing merge issue (ah I miss P4 sometimes)

* Fixing doctest example

* Add possibility to show background to a single one

* Fixing clippy test

Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>
2021-08-20 19:04:13 +02:00
Emil Ernerfeldt 3e2746a288
Make it easy to panels inside of Ui:s (#629)
* Allow using the layout cursor to restrict available area

* Avoid id clashes when putting panels inside a Ui

* Panels: Propagate height/width range to inner Ui

* Allow easy placement of panels inside of Ui:s

* demo: simplify Windows with Panels demo
2021-08-20 00:10:06 +02:00
gents83 ff8c4c0d38
Add possibility of panels inside UI (i.e. windows) (#624)
* Adding possibility to have panels inside UI

* Adding window with panels demo
2021-08-16 21:32:44 +02:00
Emil Ernerfeldt 2f46b0eb06 Fix lost_focus for TextEdit widgets
Closes https://github.com/emilk/egui/issues/565
2021-08-15 17:52:53 +02:00
Emil Ernerfeldt e31312cf7a Only move/resize windows with primary mouse button
Closes #578
Closes #579
2021-08-15 17:26:48 +02:00
Emil Ernerfeldt 22a13c75bb Add Ui::available_height
Closes #553
2021-08-15 17:04:24 +02:00
Emil Ernerfeldt a48c69d809 Improve UI docs, pointing to Ui::available_size
Closes #541
2021-08-15 17:03:24 +02:00
Linus Behrbohm 34a11fefd2
Only add resize radius for interactable areas (#577)
Fixes #576
2021-08-15 16:48:15 +02:00
Linus Behrbohm 6c18332424
Add helpers <pointerbutton>_down() in PointerState (#583) 2021-08-15 16:41:33 +02:00
Norbert Pozar 934dc42e58
Fix tooltips overlapping widgets (#566) (#568)
Tooltips are now shown above the widget if they do not fit under it.
2021-08-15 16:34:43 +02:00
mitchmindtree 7c1c775020
Fix case where `Plot`'s `min_auto_bounds` can be ignored after first instantiation (#563)
* Fix case where `Plot`'s `min_auto_bounds` can be ignored after first

I ran into an issue using `Plot` within my timeline widget where if I
zoom in and out of the timeline (not the plot), the `Plot` instances
would ignore the necessary changes to the `include_x` calls and in turn
would become skewed and misaligned with the timeline below.

This changes the `Plot` to check whether or not `min_auto_bounds` have
changed and, if so, reset the memory and recalculate the bounds.

See #562 for an image of my current use case.

* Carry hidden_items when updating plot for changed bounds
2021-08-15 16:34:12 +02:00
Ezra Barrow 224af23fd1
Pass more inner return values (#557)
* add Window.show_with_return

* Fixed all missed opportunities to pass an inner return value
2021-07-21 11:43:02 +02:00
Emil Ernerfeldt 06fc9afb1d Add Frame setters for rounding, margin and shadow 2021-07-20 14:33:36 +02:00
Jay Oster a9c004d16b
Fix custom font definitions getting replaced when `pixels_per_point` is changed (#564)
- This bug is most noticable when default fonts are disabled.
2021-07-20 14:06:27 +02:00
Sven Niederberger 7c5a2d60c5
Plot: Line styles (#482)
* added new line styles

* update changelog

* fix #524

Add missing functions to `HLine` and `VLine`

* add functions for creating points and dashes from a line

* apply suggestions

* clippy fix

* address comments
2021-07-06 20:15:04 +02:00
lucaspoffo a6c3daff6f
TextEdit: Add visual clipping for singleline inputs when text is large. (#531)
* TextEdit: Add visual clipping for singleline inputs when text is large.

* TextEdit: Add reviewer suggestions.
2021-07-06 18:59:52 +02:00
Emil Ernerfeldt faf104220b Grid::num_columns: allow the last column to take up the rest of the space
This allows for resizaeable grids, where the last column will be given the remainder of the width.
To demonstrate, the widget gallery window is now resizeable.
2021-07-02 09:55:57 +02:00
Simon Persson 9603bb4f85
Grid fixes (#473)
* Fix margin for grid layout nested inside grid

* Minor fix for grid layout

At time of end_row, current state is finished updating row_height.
Might as well use that instead of previous state.

* Fix horizontal advancing for nested layouts in grid

* Add back horizontal layout

* Add test for nested layouts in grids

* make test table striped

* Improve table test case with slider for dynamic text
2021-07-02 09:25:53 +02:00
Sven Niederberger 89cea7aca7
Progress bar (#519)
* add progress bar

* update changelog

* apply suggestions

* disable animation by default and tweak colors

* allow toggling the animation by clicking

* Update egui/src/widgets/progress_bar.rs

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

* Update egui/src/widgets/progress_bar.rs

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

* Update egui/src/widgets/progress_bar.rs

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

* address review comments

Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>
2021-07-01 22:50:41 +02:00
Emil Ernerfeldt 52e3663958 Release egui 0.13.1: Plot fixes 2021-06-28 11:05:27 +02:00
Emil Ernerfeldt cba840ec49
Small plot-relates fixes (#526)
* plot: take any id source as argument instead of ToString

* plot: allow user to set stroke on HLine/VLine

* Update changelog
2021-06-28 10:51:06 +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 8abd232854 Bug fix: accidentally resizing an area through a window 2021-06-24 17:52:15 +02:00
Emil Ernerfeldt 6e3604ee4b Bug fix: ui.scope(…) is now equivalent to ui.allocate_space(…) WRT IDs
Before a disabled and enabled button would leave the parent ui
in different states, which lead to a bug where a slider drag could be
aborted if it caused a button before it to switch between enabled
and disabled.

Repro: dragging slider in "Manual Layout Test"
2021-06-24 15:08:16 +02:00
Sven Niederberger 147e7a47aa
More plot items (#471)
* Added plot items:

* Arrows, also called "Quiver plots" in matplotlib etc.
* Convex polygons
* Text
* Images

Other changes:

* Make HLine/VLine into PlotItems as well.
* Add a "fill" property to Line so that we can fill/shade the area between a line and a horizontal reference line.
* Add stems to Points, which are lines between the points and a horizontal reference line.
* Allow using .. when specifying ranges for values generated by explicit callback functions, as an alias for f64::NEG_INFINITY..f64::INFINITY
* Allow using ranges with exclusive end bounds for values generated by parametric callback functions to generate values where the first and last value are not the same.

* update changelog

* add legend background
2021-06-24 12:29:51 +02:00
Emil Ernerfeldt 63bddb67f8 CollapsingHeader: only fill full width if it has a frame 2021-06-24 12:12:20 +02:00
Emil Ernerfeldt c03caa663b Fix bug where clicking a TextEdit frame would not give it focus
Closes https://github.com/emilk/egui/issues/506
2021-06-23 16:49:07 +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 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
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 2af86cd2c7
Revert "Fix scroll bar position (#392)" (#458)
This reverts commit 2932ff0e53.
2021-06-04 00:11:35 +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 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
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 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 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
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
Sven Niederberger bfabb70cba
Fix BottomUp layout (#386) 2021-05-15 09:37:33 +02:00
Emil Ernerfeldt 2f46c975a5 Fix wrong vertical align in default layout
Only seen when having unusually high buttons
2021-05-13 23:15:44 +02:00
Emil Ernerfeldt 7b0f991b20 Improve docs concerning custom fonts, themes and accessibility
Closes https://github.com/emilk/egui/pull/370
Closes https://github.com/emilk/egui/issues/372
2021-05-11 14:56:27 +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 1423bac3aa Smooth fading of plot grid and tick labels 2021-05-10 18:13:22 +02:00
Emil Ernerfeldt cf3d12669c Fix misc typos
Closes https://github.com/emilk/egui/pull/366
Closes https://github.com/emilk/egui/pull/365
2021-05-10 10:52:49 +02:00
Emil Ernerfeldt b1559963bf Enable a bunch more clippy lints 2021-05-09 14:13:09 +02:00
Emil Ernerfeldt 4022b84ae7 group rustdoc lints under rustdoc:: prefix 2021-05-09 14:01:57 +02:00
Emil Ernerfeldt fb5176c133 #![allow(clippy::float_cmp)] everywhere
it has always been an annoyance, never a help
2021-05-09 14:00:53 +02:00
Emil Ernerfeldt 38186fe23e Add a TODO 2021-05-09 13:20:27 +02:00
Emil Ernerfeldt 5a21bc78a6 minor code simplification 2021-05-09 13:19:09 +02:00
Emil Ernerfeldt a8c3deaf08 Rename `ui.wrap` to `ui.scope` 2021-05-09 13:17:32 +02:00
Emil Ernerfeldt 9dc092b778 Clean up demos 2021-05-09 13:07:56 +02:00
Emil Ernerfeldt aa3c40c49f bug fix: don't lock focus by default 2021-05-09 11:17:32 +02:00
Emil Ernerfeldt 4bb79a7047 Move normalize_angle to emath 2021-05-08 23:42:17 +02:00
Emil Ernerfeldt dd6980bacb Implement non-proportional multitouch pinch zooming 2021-05-08 23:31:31 +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
follower a5e41f275c
Typo: `CollpasingHeaders` -> `CollapsingHeaders` (#359) 2021-05-08 16:24:22 +02:00
Emil Ernerfeldt 5e46bd404c Some documentation improvements 2021-05-08 09:25:52 +02:00
Luis Wirth 87bc26fb5a
implement mint conversions (#352)
* Implement mint conversions

Implement conversions for [mint](https://docs.rs/mint) (math interoperability standard types).

- `impl {From, Into}<mint::Point2> for Pos2`
- `impl {From, Into}<mint::Vector2> for Vec2`

* Forward `mint` feature: egui -> epaint -> emath
2021-05-08 08:17:01 +02:00
Sven Niederberger 838f3e4ff2
Add plot legends (#349)
* add plot legends

* don't show crosshairs when hovering over legend

* add a toggle for the legend

* changes based on review

* improve legend behavior when curves share names
2021-05-07 10:32:17 +02:00
Emil Ernerfeldt d862ff66ac Add Image::sense to let an image respond to clicks and drags 2021-05-06 22:10:05 +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 29668b5128 Minor documentation improvements 2021-05-02 22:02:26 +02:00
Emil Ernerfeldt 1394205f52 Document and demonstrate how to expand a TextEdit to fill a Ui 2021-05-02 21:57:51 +02:00
Emil Ernerfeldt 66122e4c9a Decrease indentation with shift-tab 2021-05-02 20:09:11 +02:00
Emil Ernerfeldt 7da9928548 Clean up new code editor code 2021-05-02 19:28:02 +02:00
Cristian Dinu 35c7b09285
Tab identation for multiline text edit (#246)
Lock focus on multiline text edit, and insert tabs on tab char

Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>
2021-05-02 18:56:28 +02:00
ilya sheprut 101eed0d67
memory: add `Send + Sync` reqirement, fix #337 (#341)
* memory: add `Send + Sync` reqirement, fix #337

* Update egui/src/memory.rs

Co-authored-by: Lucien Greathouse <me@lpghatguy.com>

Co-authored-by: Lucien Greathouse <me@lpghatguy.com>
2021-04-30 10:03:45 +02:00
David Pedersen 02a62d1986
Replace `impl Into<String>` with `impl ToString` (#302)
* Replace `impl Into<String>` with `impl ToString`

This is something I ran into today. Types that implement
`std::fmt::Display` cannot be passed to functions that take `impl
Into<String>`. You have to call `display_thing.to_string()`. Its a small
thing but would be fixed by instead taking `impl ToString`.

Afaik `impl ToString` is a superset of `impl Into<String>`, unless users
manually implement `Into<String> for T` (or `From<T> for String`) for
their own types. However I think its more common to implement `Display`
as that works with `println` and friends. The main difference is that
`Display::fmt` can return errors but thats also quite rare in my
experience.

I did some testing in a [playground] and seems to work.

[playground]: https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=1111e071f6ae416ae2688d58d2e9b575

* Silence warnings
2021-04-29 19:49:49 +02:00
Emil Ernerfeldt 6f01577d5f Tab only selects labels if the `screen_reader` option is turned on. 2021-04-25 18:20: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
Sven Niederberger a505d01090
Plot refactor (#331)
* drag and zoom support for plots

* update doctest

* use impl ToString

* revert back to Into<String> until #302 is solved

* Apply suggestions from code review

Co-authored-by: ilya sheprut <optitel223@gmail.com>

* use persistence feature for PlotMemory

* * split plot into multiple files
* add curve from function
* move more functionality into ScreenTransform struct

* changes from code review in base branch

* let user specify a range for generated functions

* rename file

* minor changes

* improve generator functionality

* improve callback and add parametric callback

* minor changes

* add documentation

* fix merge issues

* changes based on review

* rename folder

* make plot.rs the mod.rs file

* remove mod.rs

* rename file

* namespace changes

* fix doctest

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

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

Co-authored-by: ilya sheprut <optitel223@gmail.com>
Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>
2021-04-24 14:26:54 +02:00
Emil Ernerfeldt 0f112db550 Reduce binary size with more inlining and less monomorphization
5%=150kB savings on egui_demo_app wasm
2021-04-24 09:54:11 +02:00
Emil Ernerfeldt 6b24dbc997 Move easy_mark from egui deo egui_demo_lib 2021-04-24 01:18:08 +02:00
Emil Ernerfeldt fb6f49024f Add Response::on_disabled_hover_text to show tooltip for disabled widgets
Closes https://github.com/emilk/egui/issues/323
2021-04-22 19:48:05 +02:00
Emil Ernerfeldt 07da54ad08 Refactor Ui::next_auto_id_source 2021-04-21 22:19:51 +02:00
Emil Ernerfeldt a59c8ac2c3 DragValue: only show extra decimal with shift down if currently dragged 2021-04-21 22:14:30 +02:00
Sven Niederberger 012542d066
Drag and zoom support for plots (#317)
* drag and zoom support for plots

* update doctest

* use impl ToString

* revert back to Into<String> until #302 is solved

* Apply suggestions from code review

Co-authored-by: ilya sheprut <optitel223@gmail.com>

* use persistence feature for PlotMemory

* rename shift -> translate

* remove automatic bounds

* removed unused methods

* Into<String> -> ToString

* Apply suggestions from code review

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

* avoid potential invalid bounds bug

* use new is_valid method

* improve auto bounds behavior as suggested

* use NOTHING to initialize min_auto_bounds

Co-authored-by: ilya sheprut <optitel223@gmail.com>
Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>
2021-04-21 21:50:27 +02:00
Emil Ernerfeldt 58ebb217dc Tesselator: ignore zero-sized clip rects
Improves https://github.com/emilk/egui/issues/328
2021-04-20 10:05:47 +02:00
Emil Ernerfeldt 1681769329 Add #[inline(always)] here and there 2021-04-19 23:11:42 +02:00
Emil Ernerfeldt 0351662763 Fix bug with the layout of wide `DragValue`:s 2021-04-18 23:10:12 +02:00
Emil Ernerfeldt 580d27e0d3
Add anchors to windows and areas (#310)
This is so that you can put a window in e.g. the top right corner
or the center of the screen.
2021-04-18 10:01:41 +02:00
Emil Ernerfeldt 5667e7eb51 Add docstring to ui.with_layout 2021-04-15 22:23:15 +02:00
Emil Ernerfeldt 231c075867 Add #[inline(always)] to a few things 2021-04-15 10:37:31 +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
Emil Ernerfeldt b187d1c576 Make Memory::has_focus public (again) 2021-04-15 10:31:24 +02:00
Emil Ernerfeldt 96a2732735 Add Response::request_focus and surrender_focus 2021-04-15 09:45:12 +02:00
ilya sheprut 186362a4b8
Arbitrary data in `Memory` using `Any`, fix #255 (#257)
* init work

* implement deferred deserialization

* many improvements
* rename `DataElement` -> `AnyMapElement`
* make `data` in `Memory` as public field of type with public interface
* make interface more rich
* transform most unwraps to proper error handling
* make `AnyMap` store by `TypeId`, so now individual type can be counted and reset

* improve storing TypeId between different rust versions

* rewrite system widgets to use AnyMap

* refactor everything
* replace `serde_json` -> `ron`
* move `any_map` to module
* separate `AnyMap` into `AnyMapId` and `serializable::AnyMapId` in order to not require `serde` traits in methods
* add `AnyMap` and `serializable::AnyMap` that stores elements just by type, without `Id`
* write documentation
* change tooltips and color picker to use `Memory::data_temp`

* fix bugs and docs

* Apply suggestions from code review

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

* rename `AnyMap` → `TypeMap`

* rename `AnyMapId` → `AnyMap`, add generic <Key> to it

* rename files `id_map` → `any_map`

* move out usages from `serializable` mod

* rename `ToDeserialize` → `Serialized`

* fix bug with counting

* add tests, and...
* rename `reset` → `remove`
* add function `remove_by_type`
* format code

* improve code
* make identical interface for serialized and simple maps
* make serialized maps serialized fully, without features by moving this into `Memory` struct with `#[cfg(feature = "persistence")]` under fields
* move `serialized::TypeId` into `AnyMapElement` struct

* fix pipeline and add one more test

* update docs

Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>
2021-04-12 21:53:32 +02:00
Emil Ernerfeldt 4ecf304335 Fix touch screen defocus bug
Fixes https://github.com/emilk/egui/issues/288
2021-04-12 21:41:07 +02:00
Emil Ernerfeldt 5d50fa1350 Add Label::sense so you can make clickable labels
relates to https://github.com/emilk/egui/issues/292
2021-04-12 21:26:13 +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
Cristian Dinu 50a56d41ee
DragValue improvements (#274)
* Display ResizeHorizontal cursor on hover

* Adapt the URL open command to the platform

With this new version we use $OSTYPE bash env var to query what OS
are we running on.

- On Linux, ex: Fedora, we use `xdg-open`
- On Windows, ex: msys, we use `start`
- For other other variants we try to use `open`

We should update this script when we notice that `open` is not
available on a particular platform.

(cherry picked from commit b3aa4982f683d961c21fd18e9ffc1fdf5fba0783)

* Add slow speed mode for `DragValue`

The slow speed mode is disabled by default. It can be activated
or deactivated using `DragValue::slow_speed()`.

When active the `Shift` key can be used to have a better control
over the value, `DragValue::speed` / 10.0 increments.

* Display `ResizeHorizontal` cursor while dragging too

* Apply review suggestion

Shorter and in line with the rest of the code base

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

* Add `Modifiers::shift_only` for better code clarity

* Make slow speed always enabled

Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>
2021-04-08 22:20:52 +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 ebb08f87f1 Fix: custom Ui:s now allocate minimal space in parent ui.
This makes nested horizontal/vertical layouts work better
2021-04-02 22:39:08 +02:00
Emil Ernerfeldt 4ac5b37702 Turn off text wrapping for DragValue:s 2021-04-02 13:42:46 +02:00
Emil Ernerfeldt 4b9db0cc55 Rename ui.advance_cursor to ui.add_space 2021-04-02 10:13:06 +02:00
Emil Ernerfeldt d848b2a664 Add TextEdit::password to hide input characters 2021-04-02 09:58:55 +02:00
Emil Ernerfeldt 1c955e56fe Some code cleanup 2021-04-01 23:07:58 +02:00
Emil Ernerfeldt d702e3078a Reduce amount of data being cloned in begin_frame 2021-04-01 22:09:58 +02:00
Emil Ernerfeldt f6770f0183 Various spelling fixes, docs improvements and code cleanup 2021-03-31 23:12:42 +02:00
Emil Ernerfeldt f79f24c83e Clean up dependencies and features flags 2021-03-31 22:53:54 +02:00
Emil Ernerfeldt 0d7c84c327 Make each DragValue at least the size of interact_size 2021-03-31 22:18:45 +02:00
Emil Ernerfeldt b8a0f5be15 Improve Ui::add_sized (simplify and fix bugs) 2021-03-31 22:18:08 +02:00
Emil Ernerfeldt 1090de67fd Refactor: move debug options out of Visuals 2021-03-31 22:00:04 +02:00
Emil Ernerfeldt b393bdcb74 Improve documentation of `ui.add_sized` 2021-03-31 21:49:24 +02:00
Emil Ernerfeldt 0a21b01c31 Fix nightly build: remove deprecated missing_crate_level_docs lint
Closes https://github.com/emilk/egui/issues/250 and
https://github.com/emilk/egui/pull/251
2021-03-31 20:00:22 +02:00
Thorbjørn Lindeijer f563ff77c3
Fixed some spelling in documentation (#262) 2021-03-31 19:52:23 +02:00
Emil Ernerfeldt 4808da44a2 Optimize: more inlining and more use of AHashMap
No real gains, but it didn't hurt either
2021-03-31 17:06:12 +02:00
Emil Ernerfeldt 4984d51f99 Optimize: store a reference to the target PaintList in Painter
Saves us a hash lookup for each paint call, giving us 5% perf gain
2021-03-31 17:03:20 +02:00
Emil Ernerfeldt 8c4bb0d1d9 refactor: no need to pass Fonts structure to tessellator
This makes the tesselator take only data as argument,
which is a lot nicer.
2021-03-30 21:41:39 +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 1c60dc8d66 Pass around Arc<Galley> to avoid copying a lot of data 2021-03-29 22:49:54 +02:00
Emil Ernerfeldt 94baf98eab Add a galley cache to Fonts to avoid doing the same layout each frame 2021-03-29 22:49:48 +02:00
Emil Ernerfeldt d4e5133da2 refactor fonts: put TextStyle in Galley instead of in Shape::Text 2021-03-29 21:24:09 +02:00
Emil Ernerfeldt ade41403b5 refactor fonts: do all text layout via the Fonts struct 2021-03-29 21:12:11 +02:00
Emil Ernerfeldt 46425f1e38 Optimize: add #[inline(always)] to various low-level things
saves up to 20% (text tesselation), and at least 5% overall
2021-03-28 23:16:19 +02:00
Emil Ernerfeldt aeaa54aab1 optimization: don't compare font data each frame 2021-03-28 22:13:41 +02:00
Emil Ernerfeldt def09c2455 Don't close colopicker and other popups when clicking inside of them 2021-03-27 16:50:35 +01:00
Emil Ernerfeldt 5011623744 Deprecate old DragValue constructors in favor of DragValue::new 2021-03-27 16:09:09 +01:00
Emil Ernerfeldt de439b6e21 Deprecate old Slider constructors in favor of Slider::new 2021-03-27 16:07:18 +01:00
Emil Ernerfeldt 5481aa8d98 Add DragValue::new and Slider::new 2021-03-27 16:03:11 +01:00
Emil Ernerfeldt fd80a64cdb DragValue: Lower default speed for integers
to make it easier to hit the values
2021-03-27 15:47:53 +01:00
Emil Ernerfeldt 246ab55a7f Fix: integer DragValue could sometimes not reach all values
Fixes https://github.com/emilk/egui/issues/256
2021-03-27 15:41:44 +01:00
Emil Ernerfeldt 41c9de2734 Add new ComboBox builder to replace the combo_box_with_label function 2021-03-27 10:35:40 +01:00
Emil Ernerfeldt fe92a9826b
ci: install libspeechd-dev and fix new clippy lints (#252)
* ci: install libspeechd-dev

* Fix new clippy lints for rust 1.51.0
2021-03-25 22:18:03 +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 fd3444473f Add some clippy lints 2021-03-23 19:53:31 +01:00
Emil Ernerfeldt 25c5e9d94e Return InnerResponse from Frame, Grid and ui.group() 2021-03-21 22:04:41 +01:00
Emil Ernerfeldt 05308e8d37 layout: don't return negative availability rectangles 2021-03-21 19:57:38 +01:00
Emil Ernerfeldt f5c372910c Replace emath::clamp with f32::clamp (new in rustc 1.50) 2021-03-21 17:47:03 +01:00
Emil Ernerfeldt ed0d406698 Improve misc documentation
Closes https://github.com/emilk/egui/issues/229
2021-03-21 17:13:58 +01:00
Emil Ernerfeldt c1d5bda143 ColorPicker: always show hue slider at full saturation and lightness
Closes https://github.com/emilk/egui/issues/230
2021-03-21 16:15:13 +01:00
Emil Ernerfeldt 7e302ad905 Document the need for latest rustc
Closes https://github.com/emilk/egui/issues/240
2021-03-21 16:00:24 +01:00
Emil Ernerfeldt 65a86b2d15 Middle-click links to open in new tab
Closes https://github.com/emilk/egui/issues/231
2021-03-21 15:20:53 +01:00
Emil Ernerfeldt f77ab26828 [EasyMark] Add support for small and raised text 2021-03-21 15:11:12 +01:00
Emil Ernerfeldt eaa1ed96ee Depcrecate ui.horizontal_for_text and ui.horizontal_wrapped_for_text
They just add unnecessary complexity at this point
2021-03-21 14:48:16 +01:00
Emil Ernerfeldt 953d2bb39b Add ui.set_row_height 2021-03-21 14:48:16 +01:00
Emil Ernerfeldt e20e3baa98 Bug-fixes related to recent layout rewrite 2021-03-21 14:48:12 +01:00
Emil Ernerfeldt e232264b53 Add Visuals::debug_widgets to debug layouting by hovering widgets 2021-03-21 10:33:10 +01:00
Emil Ernerfeldt ec9f374d8c Fix: centered horizontal layouts should never overflow upwards 2021-03-21 10:31:18 +01:00
Emil Ernerfeldt cc5ad1505c Fix bug that would allocate the full width of non-centered layouts 2021-03-20 22:21:14 +01:00
Emil Ernerfeldt 589bae1211
Refactor layout (#241)
* Fix https://github.com/emilk/egui/issues/222

* Rewrite layout logic

Cursor is now a Rect.

Closes https://github.com/emilk/egui/issues/179
2021-03-20 21:47:19 +01:00
Emil Ernerfeldt 0c9b4858f0 refactor: simplify CollapsingHeader enable/disable code 2021-03-20 15:40:40 +01:00
Emil Ernerfeldt 7ac91970bd bug fix: false id clash error for wrapping text 2021-03-20 09:29:36 +01:00
Emil Ernerfeldt 6442d254a6 Fix hover-to-zoom of font texture in demo
Closes https://github.com/emilk/egui/issues/220
2021-03-13 12:55:29 +01:00
Emil Ernerfeldt 958aea922f Add a lot more CursorIcon's 2021-03-13 12:38:03 +01:00
Emil Ernerfeldt 017d602fe5 Rename "kb_focus" to just "focus" everywhere 2021-03-09 20:55:24 +01:00
Emil Ernerfeldt 3fbc07659c Labels can now be focused so they can be read by screen-reader 2021-03-09 19:58:41 +01:00
Emil Ernerfeldt 33d2f16041 Bug fix: you can now use text edits again 2021-03-09 19:51:23 +01:00
Bradley Smith bd34cfd43e
Configurable label text style for CollapsingHeader (#200)
CollapsingHeader: change label text style & enable options
2021-03-09 19:13:21 +01:00
Norbert Nemec 6fb4e19e9e
DragValue: fix crash for speed==0.0 (#216) 2021-03-09 19:06:04 +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 2428763756 Fix bug in Response::clicked_elsewhere
Fixes https://github.com/emilk/egui/issues/205
2021-03-08 22:22:44 +01:00
Emil Ernerfeldt 8f3a25d749 clippy fix 2021-03-08 22:16:35 +01:00
Ridan Vandenbergh f1c6d2b59c
feat: Derive (de)serialize for Key (#213) 2021-03-08 22:09:30 +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 cb7ef6faeb bug fix: open links in same tab by default 2021-03-08 20:25:43 +01:00
Emil Ernerfeldt ea248d66b5 Improve widget info output for potential screen readers
Part of https://github.com/emilk/egui/issues/167
2021-03-08 18:36:32 +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
aakamenov c1ef81628b
Add optional drag bounds to Area and Window
Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>
2021-03-07 20:42:16 +01:00
Emil Ernerfeldt 25d4a7e11e Fix gained kb focus event on shift-tab 2021-03-07 19:45:28 +01:00
Emil Ernerfeldt eba4d3d7b1 refactor: move kb-focus logic to own struct 2021-03-07 19:45:28 +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
Emil Ernerfeldt a370339db7 Give focus to any clickable widget with tab/shift-tab
Use space or enter to click the selected widget.
Use arrow keys to adjust sliders and `DragValue`s.

Closes https://github.com/emilk/egui/issues/31
2021-03-07 18:15:57 +01:00
Emil Ernerfeldt 6fd7c422ab Refactor: remove has_kb_focus/lost_kb_focus bools from Reponse
Just forward the queries to Memory
2021-03-07 13:06:57 +01:00
Emil Ernerfeldt b72184dc7e clippy fix 2021-03-06 11:19:32 +01:00
Emil Ernerfeldt 5d0c71350d Add `fn Memory::gained_kb_focus() -> bool` query 2021-03-06 11:17:24 +01:00
Emil Ernerfeldt 007f9f3cb9 Fix secondary-click to open a menu
Fixes https://github.com/emilk/egui/issues/198
2021-03-06 11:11:07 +01:00
Emil Ernerfeldt 9c8439d053 Add some helper functions to Response 2021-03-06 10:48:39 +01:00
Emil Ernerfeldt fb2db4940e Release 0.10.0 - Plot and polish 2021-02-28 20:11:37 +01:00
Emil Ernerfeldt fdb1aa6bec improve documentation 2021-02-28 18:59:46 +01:00
Emil Ernerfeldt 8be37b3d6c Add Response::has_kb_focus()
Closes https://github.com/emilk/egui/issues/196
2021-02-28 18:19:33 +01:00
Emil Ernerfeldt 834078a476 Turn off the cursor preview when hovering a TextEdit 2021-02-28 17:27:39 +01:00
Emil Ernerfeldt d3fd51d6a4 Add Response::changed(): see if e.g. text was entered or slider dragged 2021-02-28 17:24:07 +01:00
Emil Ernerfeldt bdbc59455c Improve documentation for the most common widgets 2021-02-23 22:18:13 +01:00
Emil Ernerfeldt 814f8c0dd8 Add support for all integers in DragValue and Slider (except 128-bit) 2021-02-23 20:40:14 +01:00
Emil Ernerfeldt 049a7b0382 Make DragValue::from_get_set public
Closes https://github.com/emilk/egui/issues/188
2021-02-23 20:16:43 +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
Emil Ernerfeldt c601db5956 refactor: move tooltip state handling out of memory 2021-02-21 10:31:28 +01:00
Emil Ernerfeldt 67623919d7 refactor: move DragValue state 2021-02-21 10:30:31 +01:00
Emil Ernerfeldt 82350a2f1e Improve documentation 2021-02-21 10:12:08 +01:00
Emil Ernerfeldt ebc2486d22 Slider: use a DragValue for the value, and implement suffix/prefix 2021-02-20 18:29:09 +01:00
Emil Ernerfeldt 32f35c6251 Implement "Smart Aim" for DragValue 2021-02-20 17:43:35 +01:00
Emil Ernerfeldt 7ac26b84b1 DragValue: handle slowly dragging a value with limited precision 2021-02-20 17:27:55 +01:00
Emil Ernerfeldt 9a546ff97a SlidSlider will now show the value display by default.
Turn off with slider.show_value(false)

Closes https://github.com/emilk/egui/issues/183
2021-02-20 16:28:39 +01:00
Emil Ernerfeldt 4e041185f1 Add module special_emojis with apple, linux, windows & github logos 2021-02-20 16:09:00 +01:00
Emil Ernerfeldt 9b58d5d4d9 color picker: just copy the r,g,b,a values without a "rgba(…)" wrapper 2021-02-20 15:49:09 +01:00
Emil Ernerfeldt ac356e2bd8 Add a link from the crate-level docs to the online egui web demo 2021-02-20 12:43:53 +01:00
Emil Ernerfeldt 040553da78 impl<F> Widget for F where F: FnOnce(&mut Ui) -> Response
This enables functions that return `impl Widget`, so that you can
create a widget by just returning a lambda from a function.

For instance: `ui.add(toggle(bool))` (instead of `toggle(ui, bool)`)
2021-02-20 12:02:38 +01:00
Emil Ernerfeldt 6fe70e685b Simplify and unify colors of selectable widgets 2021-02-20 11:28:00 +01:00
Emil Ernerfeldt 741f0bfe8a Only show tooltips if mouse is still. 2021-02-20 10:45:19 +01:00
Emil Ernerfeldt 4354f7582f Improve the positioning of tooltips 2021-02-20 10:33:33 +01:00
Emil Ernerfeldt d5bb85b245 Add InputState::is_still to compliment InputState::is_moving 2021-02-20 09:26:58 +01:00
Emil Ernerfeldt 9c3b7d719b Bug fix: child painters now inherit color tint (e.g. grayed out) 2021-02-20 09:26:58 +01:00
Emil Ernerfeldt 21c99e1130 Add Ui::hyperlink_to 2021-02-20 09:26:58 +01:00
Emil Ernerfeldt 0f13fff24b Assign default colors to plot lines if not explicitly set 2021-02-18 18:59:59 +01:00
Emil Ernerfeldt a19140ec67 A simple 2D plot library 2021-02-17 22:54:10 +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 be8d7b4eef Slider: add largest_finite for log-sliders that include infinity 2021-02-12 17:45:27 +01:00
Emil Ernerfeldt 156d68d266 Refactor: move FrameState to own file 2021-02-08 23:03:41 +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 5ce681ef16 Improve documentation 2021-02-07 17:04:03 +01:00
Emil Ernerfeldt a382fad1d0 Fix minor click detection bug 2021-02-07 17:04:03 +01:00
Emil Ernerfeldt 6377a4231f [demo] Refactor and minor cleanup 2021-02-07 17:04:03 +01:00
Emil Ernerfeldt e82fb81f07 Replace (ret, response) tuples with new struct InnerResponse 2021-02-07 14:09:44 +01:00
Emil Ernerfeldt df4c0257c0 Add Ui functions for doing manual layout ("put this widget here") 2021-02-07 13:48:55 +01:00
Emil Ernerfeldt bca722ddf8 Add ui.set_enabled(false) to disable all widgets in a Ui
Closes https://github.com/emilk/egui/issues/50
2021-02-07 10:55:45 +01:00
Emil Ernerfeldt d07a17ac6a Expose more color-related functions and types 2021-02-07 10:36:51 +01:00