* 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>
* 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>
* 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>
* 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
* 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>
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