Commit graph

277 commits

Author SHA1 Message Date
Emil Ernerfeldt
7c67066190 demo: add expandable top panel to panels-in-window demo 2021-08-27 20:08:01 +02:00
Emil Ernerfeldt
52193c2273 demo: demonstrate how to prevent auto-shrinking windows 2021-08-27 19:59:31 +02:00
Emil Ernerfeldt
7e9c3291bd Tiny demo tweaks 2021-08-26 18:54:38 +02:00
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
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
a6799b1278 Minor demo improvements 2021-08-24 16:38:03 +02:00
Emil Ernerfeldt
246b1e084b Improve panel demo 2021-08-23 22:28:42 +02:00
Emil Ernerfeldt
5d0e348777 Clean up demo slightly 2021-08-23 21:28:06 +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
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
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
Emil Ernerfeldt
62808b2bb9 Silence warning 2021-08-18 22:51:16 +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
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
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
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
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
4f6dac27e6 Clippy fix 2021-06-24 20:13:34 +02:00
Emil Ernerfeldt
1363ac4a24 demo: in font book, ask font what characters are supported
This replaces manual lists with a call to ab_glypgh::Font::codepoint_ids
plus names from the unicode_names2 crate.
2021-06-24 17:35:56 +02:00
Emil Ernerfeldt
182eb32b95 Tidy up plot demo 2021-06-24 15:20:31 +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
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
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
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
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
6468b2b84e
Implement efficent scrolling of large content (#457) 2021-06-03 18:48:45 +02:00
Emil Ernerfeldt
4d56d0328b demo: Move egui settings/inspection windows to backend panel 2021-05-28 00:40:36 +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
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
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
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
1423bac3aa Smooth fading of plot grid and tick labels 2021-05-10 18:13:22 +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
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
0b52813f62 Sort demo windows (multi-touch demo was out of order) 2021-05-09 10:09:05 +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
Emil Ernerfeldt
268ddca161 demo_app: Remove screen_reader from default features
closes https://github.com/emilk/egui/issues/338
2021-05-08 16:27:41 +02:00
Emil Ernerfeldt
7374ed9d00 epi/eframe: move options out of trait App into new NativeOptions 2021-05-08 10:14:56 +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
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
1394205f52 Document and demonstrate how to expand a TextEdit to fill a Ui 2021-05-02 21:57:51 +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
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
6b24dbc997 Move easy_mark from egui deo egui_demo_lib 2021-04-24 01:18:08 +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
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
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
daf2e13238 demo: Use new id_data to store the show/hide password toggle 2021-04-12 22:37:39 +02:00
Emil Ernerfeldt
3803d0f3d1 Minor cleanup of the demo code 2021-04-05 14:23:42 +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
f6770f0183 Various spelling fixes, docs improvements and code cleanup 2021-03-31 23:12:42 +02:00
Emil Ernerfeldt
3450168e94 egui_glium: add support for transparent windows
Also support non-decorated windows (without border)
2021-03-31 20:53:13 +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
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
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
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
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
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
Tomáš Vojtášek
f07f9bf5bd
Typo previus -> previous (#214) 2021-03-09 18:57:45 +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
Emil Ernerfeldt
c212d4512e Clarify behavior of window resizing
closes https://github.com/emilk/egui/issues/206
2021-03-07 20:15:42 +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
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
9c8439d053 Add some helper functions to Response 2021-03-06 10:48:39 +01:00
Emil Ernerfeldt
f793ac7f3e [demo] Remove dead code 2021-02-28 20:11:37 +01:00
Emil Ernerfeldt
1fb3b43dfc [demo] Improve painting demo slightly 2021-02-28 19:50:47 +01:00
Emil Ernerfeldt
84cc227f11 eframe: always provide a texture allocator 2021-02-28 19:09:48 +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
5f6a468812 Add Context::set_pixels_per_point to control the scale of the UI 2021-02-21 11:23:33 +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
6fe70e685b Simplify and unify colors of selectable widgets 2021-02-20 11:28:00 +01:00
Emil Ernerfeldt
21c99e1130 Add Ui::hyperlink_to 2021-02-20 09:26:58 +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
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
c376d0bb7e [emath] RectTransform: transforms Pos2 from one Rect to another
Very useful for transforming coordinate systems, e.g. for painting
2021-02-14 10:33:44 +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
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
xue-blood
ce14fa860b
Speed up fractal_clock painting (#152)
clip unwatchable line before drawing
2021-02-06 16:59:46 +01:00
Emil Ernerfeldt
26f966563a Add Grid::max_col_width 2021-02-06 16:54:38 +01:00
Emil Ernerfeldt
2d9d06dbff [emath] Use const values for Vec2::ZERO, Rect::EVERYTHING etc 2021-02-05 10:11:39 +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
Lucas Walter
4e7e128b2b
Spelling ui_resouce -> ui_resource (#156) 2021-02-03 20:04:57 +01:00
Emil Ernerfeldt
af3195f086 Add ctx.set_visuals() 2021-02-03 19:38:50 +01:00
Emil Ernerfeldt
a19fd7b780 Add light mode 2021-02-03 19:30:58 +01:00
Emil Ernerfeldt
829455b347 Add ui.group(|ui| { … }) to visually group some widgets within a frame 2021-02-03 00:25:07 +01:00
Emil Ernerfeldt
ca886ea998 Add ui.visuals() as short for ui.style().visuals 2021-02-03 00:20:39 +01:00
Emil Ernerfeldt
01fca2f31c Add Ui::spacing() and Ui::spacing_mut() as shortcuts 2021-02-01 16:56:29 +01:00
Emil Ernerfeldt
e529bd3ea4 [demo] Make syntect an optional dependency
Adds a whopping 1.4 MB to the WASM
2021-01-31 16:52:26 +01:00
Emil Ernerfeldt
16d66bd22d Replace markdown editor with new 'EasyMark' markup language 2021-01-31 16:42:32 +01:00
Emil Ernerfeldt
6029a438a2 Add a VERY experimental markdown viewer 2021-01-27 20:14:53 +01:00
Emil Ernerfeldt
b493bc6efc Wrap tesselated output in struct ClippedMesh(Rect, Mesh) 2021-01-25 21:43:17 +01:00
Emil Ernerfeldt
75fa77e040 Rename Triangles to Mesh 2021-01-25 21:23:24 +01:00
Emil Ernerfeldt
63e4ff4382 [demo] Move layout demo to own window 2021-01-25 20:52:47 +01:00
Emil Ernerfeldt
749419c9fd [demo] Improve scroll demo and move to own window 2021-01-25 20:52:31 +01:00
Emil Ernerfeldt
5e3a89bf00 [demo] Move slider demo to own window 2021-01-25 20:14:39 +01:00
Emil Ernerfeldt
6d57a24f35 Add Slider::clamp_to_range(bool) 2021-01-25 19:55:08 +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
9f4c31c0e0 Add Frame::group for putting a frame around some widgets
Closes https://github.com/emilk/egui/issues/125
2021-01-20 23:26:46 +01:00
Emil Ernerfeldt
e2217ff63a [style] Fade out windows on close 2021-01-20 00:31:43 +01:00
Emil Ernerfeldt
29bb7c9f9d egui_demo_lib 0.8.1: export ColorTest 2021-01-19 17:13:29 +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
620e43d483 New sleeker visual style
Remove a lot of borders, remove transparency, simplify and unify.
2021-01-15 22:23:08 +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
6d8a766614 [style] Slightly expand buttons when hovering and interacting 2021-01-13 22:08:35 +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