mirror of
https://github.com/emilk/egui.git
synced 2026-08-30 05:10:03 -04:00
Replace scroll_delta and zoom_delta in RawInput with events
Part of https://github.com/emilk/egui/issues/843
This commit is contained in:
@@ -1029,9 +1029,14 @@ fn install_canvas_events(runner_ref: &AppRunnerRef) -> Result<(), JsValue> {
|
||||
// This if-statement is equivalent to how `Modifiers.command` is determined in
|
||||
// `modifiers_from_event()`, but we cannot directly use that fn for a `WheelEvent`.
|
||||
if event.ctrl_key() || event.meta_key() {
|
||||
runner_lock.input.raw.zoom_delta *= (delta.y / 200.0).exp();
|
||||
let factor = (delta.y / 200.0).exp();
|
||||
runner_lock.input.raw.events.push(egui::Event::Zoom(factor));
|
||||
} else {
|
||||
runner_lock.input.raw.scroll_delta += delta;
|
||||
runner_lock
|
||||
.input
|
||||
.raw
|
||||
.events
|
||||
.push(egui::Event::Scroll(delta));
|
||||
}
|
||||
|
||||
runner_lock.needs_repaint.set_true();
|
||||
|
||||
Reference in New Issue
Block a user