mirror of
https://github.com/obsqrbtz/egui_knob.git
synced 2026-04-08 20:19:17 +03:00
Merge pull request #10 from elwerene/update_egui
update egui and fix clippy warnings
This commit is contained in:
722
Cargo.lock
generated
722
Cargo.lock
generated
File diff suppressed because it is too large
Load Diff
@@ -21,7 +21,7 @@ name = "example_knob"
|
||||
path = "examples/example_knob.rs"
|
||||
|
||||
[dependencies]
|
||||
egui = "0.33"
|
||||
egui = "0.34"
|
||||
|
||||
[dev-dependencies]
|
||||
eframe = { version = "0.33", features = ["default_fonts"] }
|
||||
eframe = { version = "0.34", features = ["default_fonts"] }
|
||||
|
||||
@@ -43,8 +43,7 @@ impl Default for KnobDemo {
|
||||
}
|
||||
|
||||
impl eframe::App for KnobDemo {
|
||||
fn update(&mut self, ctx: &egui::Context, _frame: &mut eframe::Frame) {
|
||||
egui::CentralPanel::default().show(ctx, |ui| {
|
||||
fn ui(&mut self, ui: &mut egui::Ui, _frame: &mut eframe::Frame) {
|
||||
ui.heading("Knob demo");
|
||||
ui.separator();
|
||||
|
||||
@@ -54,7 +53,6 @@ impl eframe::App for KnobDemo {
|
||||
ui.checkbox(&mut self.show_filled, "Filled segment");
|
||||
ui.checkbox(&mut self.use_step, "Step (0.02)");
|
||||
ui.checkbox(&mut self.logarithmic_scaling, "Logarithmic");
|
||||
|
||||
});
|
||||
|
||||
ui.horizontal(|ui| {
|
||||
@@ -126,6 +124,5 @@ impl eframe::App for KnobDemo {
|
||||
|
||||
ui.add_space(10.0);
|
||||
ui.separator();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -209,8 +209,7 @@ impl Widget for Knob<'_> {
|
||||
}
|
||||
|
||||
response.mark_changed();
|
||||
} else if response.hovered() & self.config.allow_scroll {
|
||||
if let Some(scoll) = ui.input(|input| {
|
||||
} else if response.hovered() & self.config.allow_scroll && let Some(scoll) = ui.input(|input| {
|
||||
input.events.iter().find_map(|e| match e {
|
||||
egui::Event::MouseWheel { delta, .. } => Some(*delta),
|
||||
_ => None,
|
||||
@@ -220,7 +219,6 @@ impl Widget for Knob<'_> {
|
||||
+ scoll.y * self.config.step.unwrap_or(self.config.drag_sensitivity))
|
||||
.clamp(0.0, 1.0);
|
||||
}
|
||||
}
|
||||
|
||||
*self.value = if self.config.logarithmic_scaling {
|
||||
remap(10f32.powf(raw), 1.0..=10.0, self.min..=self.max)
|
||||
@@ -228,11 +226,10 @@ impl Widget for Knob<'_> {
|
||||
remap(raw, 0.0..=1.0, self.min..=self.max)
|
||||
};
|
||||
|
||||
if response.double_clicked() {
|
||||
if let Some(reset_value) = self.config.reset_value {
|
||||
if response.double_clicked()
|
||||
&& let Some(reset_value) = self.config.reset_value {
|
||||
*self.value = reset_value
|
||||
}
|
||||
}
|
||||
|
||||
let knob_rect = renderer.calculate_knob_rect(rect);
|
||||
let center = knob_rect.center();
|
||||
|
||||
Reference in New Issue
Block a user