Add mouse scroll for iced example
This commit is contained in:
parent
2f6a9d33d1
commit
38a4f7a09a
1 changed files with 11 additions and 0 deletions
|
|
@ -7,6 +7,7 @@ use cosmic::iced_native::{
|
||||||
},
|
},
|
||||||
keyboard::{Event as KeyEvent, KeyCode},
|
keyboard::{Event as KeyEvent, KeyCode},
|
||||||
layout::{self, Layout},
|
layout::{self, Layout},
|
||||||
|
mouse::{Event as MouseEvent, ScrollDelta},
|
||||||
renderer,
|
renderer,
|
||||||
widget::{self, Widget},
|
widget::{self, Widget},
|
||||||
};
|
};
|
||||||
|
|
@ -258,6 +259,16 @@ where
|
||||||
},
|
},
|
||||||
_ => Status::Ignored,
|
_ => Status::Ignored,
|
||||||
},
|
},
|
||||||
|
Event::Mouse(mouse_event) => match mouse_event {
|
||||||
|
MouseEvent::WheelScrolled { delta } => match delta {
|
||||||
|
ScrollDelta::Lines { x, y } => {
|
||||||
|
buffer.action(TextAction::Scroll(-y as i32 * 6));
|
||||||
|
Status::Captured
|
||||||
|
},
|
||||||
|
_ => Status::Ignored,
|
||||||
|
}
|
||||||
|
_ => Status::Ignored,
|
||||||
|
},
|
||||||
_ => Status::Ignored,
|
_ => Status::Ignored,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue