Skip to content

Commit

Permalink
Update to [email protected] (#71)
Browse files Browse the repository at this point in the history
* Update to [email protected]

* Update `mouse_wheel_event()`

As per emilk/egui#4524.

Tested locally in `v0x0g/rayna`

* run `cargo fmt`

* Update version to indicate changes
  • Loading branch information
v0x0g authored Jul 8, 2024
1 parent 5df5723 commit bbb0709
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 10 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Unreleased

# 0.14.1 - 2024-07-07
* Update `egui` to `0.28.0`
* Update `miniquad` to `0.4.0`

# 0.14.0 - 2023-02-08
* Update egui to `0.21.0`.
* Fix scroll speed (it was way too fast).
Expand Down
6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "egui-miniquad"
version = "0.14.0"
version = "0.14.1"
authors = [
"Logachev Fedor <[email protected]>",
"Emil Ernerfeldt <[email protected]>",
Expand All @@ -18,7 +18,7 @@ include = ["../LICENSE-APACHE", "../LICENSE-MIT", "**/*.rs", "Cargo.toml"]

[dependencies]
bytemuck = "1.9"
egui = { version = "0.27", features = ["bytemuck"] }
egui = { version = "0.28", features = ["bytemuck"] }
miniquad = { version = "=0.4.0" }
quad-url = "0.1"

Expand All @@ -31,7 +31,7 @@ quad-rand = "0.2.1"
copypasta = "0.8.1"

[dev-dependencies]
egui_demo_lib = { version = "0.27", default-features = false }
egui_demo_lib = { version = "0.28", default-features = false }
glam = "0.22.0"

[profile.release]
Expand Down
13 changes: 6 additions & 7 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -259,14 +259,13 @@ impl EguiMq {
/// Call from your [`miniquad::EventHandler`].
pub fn mouse_wheel_event(&mut self, dx: f32, dy: f32) {
let delta = egui::vec2(dx, dy);
let modifiers = self.egui_input.modifiers;

let event = if self.egui_input.modifiers.ctrl {
// Treat as zoom instead:
egui::Event::Zoom((delta.y / 200.0).exp())
} else {
egui::Event::Scroll(delta)
};
self.egui_input.events.push(event);
self.egui_input.events.push(egui::Event::MouseWheel {
modifiers,
unit: egui::MouseWheelUnit::Line,
delta,
});
}

/// Call from your [`miniquad::EventHandler`].
Expand Down

0 comments on commit bbb0709

Please sign in to comment.