mirror of
https://github.com/emilk/egui.git
synced 2026-08-31 22:00:03 -04:00
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
This commit is contained in:
@@ -113,8 +113,8 @@ fn ui_url(ui: &mut egui::Ui, frame: &mut epi::Frame<'_>, url: &mut String) -> Op
|
||||
|
||||
ui.horizontal(|ui| {
|
||||
ui.label("URL:");
|
||||
trigger_fetch |= ui.text_edit_singleline(url).lost_kb_focus;
|
||||
trigger_fetch |= ui.button("GET").clicked;
|
||||
trigger_fetch |= ui.text_edit_singleline(url).lost_kb_focus();
|
||||
trigger_fetch |= ui.button("GET").clicked();
|
||||
});
|
||||
|
||||
if frame.is_web() {
|
||||
@@ -122,14 +122,14 @@ fn ui_url(ui: &mut egui::Ui, frame: &mut epi::Frame<'_>, url: &mut String) -> Op
|
||||
}
|
||||
|
||||
ui.horizontal(|ui| {
|
||||
if ui.button("Source code for this example").clicked {
|
||||
if ui.button("Source code for this example").clicked() {
|
||||
*url = format!(
|
||||
"https://raw.githubusercontent.com/emilk/egui/master/{}",
|
||||
file!()
|
||||
);
|
||||
trigger_fetch = true;
|
||||
}
|
||||
if ui.button("Random image").clicked {
|
||||
if ui.button("Random image").clicked() {
|
||||
let seed = ui.input().time;
|
||||
let width = 640;
|
||||
let height = 480;
|
||||
@@ -170,7 +170,7 @@ fn ui_resouce(
|
||||
|
||||
if let Some(text) = &response.text {
|
||||
let tooltip = "Click to copy the response body";
|
||||
if ui.button("📋").on_hover_text(tooltip).clicked {
|
||||
if ui.button("📋").on_hover_text(tooltip).clicked() {
|
||||
ui.output().copied_text = text.clone();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user