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:
@@ -57,7 +57,7 @@ impl DemoWindow {
|
||||
ui.columns(self.num_columns, |cols| {
|
||||
for (i, col) in cols.iter_mut().enumerate() {
|
||||
col.label(format!("Column {} out of {}", i + 1, self.num_columns));
|
||||
if i + 1 == self.num_columns && col.button("Delete this").clicked {
|
||||
if i + 1 == self.num_columns && col.button("Delete this").clicked() {
|
||||
self.num_columns -= 1;
|
||||
}
|
||||
}
|
||||
@@ -287,15 +287,15 @@ impl LayoutDemo {
|
||||
|
||||
pub fn content_ui(&mut self, ui: &mut Ui) {
|
||||
ui.horizontal(|ui| {
|
||||
if ui.button("Top-down").clicked {
|
||||
if ui.button("Top-down").clicked() {
|
||||
*self = Default::default();
|
||||
}
|
||||
if ui.button("Top-down, centered and justified").clicked {
|
||||
if ui.button("Top-down, centered and justified").clicked() {
|
||||
*self = Default::default();
|
||||
self.cross_align = Align::Center;
|
||||
self.cross_justify = true;
|
||||
}
|
||||
if ui.button("Horizontal wrapped").clicked {
|
||||
if ui.button("Horizontal wrapped").clicked() {
|
||||
*self = Default::default();
|
||||
self.main_dir = Direction::LeftToRight;
|
||||
self.cross_align = Align::Center;
|
||||
@@ -391,7 +391,7 @@ impl Tree {
|
||||
if depth > 0
|
||||
&& ui
|
||||
.add(Button::new("delete").text_color(Color32::RED))
|
||||
.clicked
|
||||
.clicked()
|
||||
{
|
||||
return Action::Delete;
|
||||
}
|
||||
@@ -409,7 +409,7 @@ impl Tree {
|
||||
})
|
||||
.collect();
|
||||
|
||||
if ui.button("+").clicked {
|
||||
if ui.button("+").clicked() {
|
||||
self.0.push(Tree::default());
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user