Commit graph

32 commits

Author SHA1 Message Date
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
9dc092b778 Clean up demos 2021-05-09 13:07:56 +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
ilya sheprut
c69ecfe421
Memory usage example in the widget gallery (#307)
* init example

* add comments

* fix grammar in comments

* fix CI

* change example from view_edit to password

* rename file

* fix CI
2021-04-18 10:13:08 +02:00
Emil Ernerfeldt
1c955e56fe Some code cleanup 2021-04-01 23:07:58 +02: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
41c9de2734 Add new ComboBox builder to replace the combo_box_with_label function 2021-03-27 10:35:40 +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
d6233de9dc Small improvements to the demo (add source code links etc) 2021-03-07 19:51:07 +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
4e041185f1 Add module special_emojis with apple, linux, windows & github logos 2021-02-20 16:09:00 +01:00
Emil Ernerfeldt
6354709fe1 [demo] Link to the egui docs from the widget gallery 2021-02-20 12:07:15 +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
9e38674d13 [demo] Alwyas start with widget gallery 2021-02-20 09:19:40 +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
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
0f37b009d6 Add TextEdit::hint_text for showing a weak hint text when empty 2021-02-03 21:06:50 +01:00
Emil Ernerfeldt
247026149c
Multiple mouse button support (#135)
Add support for primary, secondary and middle mouse buttons. Also improve ability to click things in low FPS situations.

This introduces a lot of breaking changes:

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


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

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

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

* Support multiple mouse buttons

* Make PointerState interface all methods

* Make most members of Response private
2021-01-25 18:50:19 +01:00
Emil Ernerfeldt
e2217ff63a [style] Fade out windows on close 2021-01-20 00:31:43 +01:00
Emil Ernerfeldt
31b7eda51e Rename Egui to egui
Also update iamges in README.md
2021-01-17 14:48:59 +01:00
Emil Ernerfeldt
07f1b074ca [grid] Allow putting a separator in a grid 2021-01-16 11:48:30 +01:00
Emil Ernerfeldt
b1157ee642 [grid] Option to set spacing 2021-01-15 21:17:56 +01:00
Emil Ernerfeldt
480c6db37f [grid] Set default row height to interact_size.y
It is what we use for horizontal layouts, and makes sense.
2021-01-15 21:17:56 +01:00
Emil Ernerfeldt
03c9cda89b [grid] Ensure the contents of each grid cell is aligned left+center 2021-01-15 21:17:56 +01:00
Emil Ernerfeldt
641a302e0a [grid] Add optional minimal row height 2021-01-15 18:30:09 +01:00
Emil Ernerfeldt
6f814b9516 [demo] Add collapsing header to widget gallery 2021-01-15 18:30:09 +01:00
Emil Ernerfeldt
73d16eb771 Use Grid to add labels to the color picker sliders
Also improve the color preview in the color picker
2021-01-13 23:09:23 +01:00
Emil Ernerfeldt
5e7ad40c8d [demo] Center the "(source code)" hyperlinks 2021-01-11 23:50:50 +01:00
Emil Ernerfeldt
1c5cdd8575 [demo] Add separator, hyperlink and SelectableLabel to widget gallery 2021-01-11 21:07:17 +01:00
Emil Ernerfeldt
0b10fa5c29
Grid layout and widget gallery (#106)
* Wrap Layout and Region into a new struct Placer

* [egui] Add a simple grid layout

* Refactor CollapsingHeader code (simplify header painting)

* Fix: allow putting a CollapsingHeader inside of a grid layout

* [demo] Add a widget gallery

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

* Add optional striped grid background
2021-01-11 20:58:36 +01:00