diff --git a/egui/src/containers/window.rs b/egui/src/containers/window.rs index c8bfc7f2..dcf3d97c 100644 --- a/egui/src/containers/window.rs +++ b/egui/src/containers/window.rs @@ -171,16 +171,24 @@ impl<'open> Window<'open> { let title_bar_height = title_label.font_height(ctx.fonts()) + 1.0 * ctx.style().item_spacing.y; // this could be better let margins = 2.0 * frame.margin + vec2(0.0, title_bar_height); - interact( + + window_interaction( ctx, - margins, possible, area_layer, - area.state_mut(), - window_id, - resize_id, + window_id.with("frame_resize"), last_frame_outer_rect, ) + .and_then(|window_interaction| { + interact( + window_interaction, + ctx, + margins, + area_layer, + area.state_mut(), + resize_id, + ) + }) } else { None }; @@ -301,22 +309,13 @@ impl WindowInteraction { } fn interact( + window_interaction: WindowInteraction, ctx: &Context, margins: Vec2, - possible: PossibleInteractions, area_layer: Layer, area_state: &mut area::State, - window_id: Id, resize_id: Id, - rect: Rect, ) -> Option { - let window_interaction = window_interaction( - ctx, - possible, - area_layer, - window_id.with("frame_resize"), - rect, - )?; let new_rect = resize_window(ctx, &window_interaction)?; let new_rect = ctx.round_rect_to_pixels(new_rect); diff --git a/egui/src/demos/app.rs b/egui/src/demos/app.rs index c1862adc..010c41bc 100644 --- a/egui/src/demos/app.rs +++ b/egui/src/demos/app.rs @@ -359,7 +359,7 @@ impl Default for Widgets { button_enabled: true, radio: 0, count: 0, - slider_value: 3.14, + slider_value: 3.4, single_line_text_input: "Hello World!".to_owned(), multiline_text_input: "Text can both be so wide that it needs a linebreak, but you can also add manual linebreak by pressing enter, creating new paragraphs.\nThis is the start of the next paragraph.\n\nClick me to edit me!".to_owned(), } diff --git a/egui/src/math.rs b/egui/src/math.rs index f7d5dbe7..91f70800 100644 --- a/egui/src/math.rs +++ b/egui/src/math.rs @@ -607,7 +607,7 @@ pub fn ease_in_ease_out(t: f32) -> f32 { /// /// Represents one turn in radian angles. Equal to `2 * pi`. /// -/// See https://tauday.com/ +/// See pub const TAU: f32 = 2.0 * std::f32::consts::PI; pub fn round_to_precision(value: f32, precision: usize) -> f32 { diff --git a/egui/src/paint/tessellator.rs b/egui/src/paint/tessellator.rs index 638f49fc..d2248ffd 100644 --- a/egui/src/paint/tessellator.rs +++ b/egui/src/paint/tessellator.rs @@ -1,4 +1,5 @@ -/// Outputs render info in a format suitable for e.g. OpenGL. +#![allow(clippy::identity_op)] + use { super::{ color::{self, srgba, Color}, diff --git a/egui_web/src/lib.rs b/egui_web/src/lib.rs index 6c49bf08..df5be715 100644 --- a/egui_web/src/lib.rs +++ b/egui_web/src/lib.rs @@ -37,7 +37,7 @@ pub fn now_sec() -> f64 { pub fn seconds_since_midnight() -> f64 { let d = js_sys::Date::new_0(); let seconds = (d.get_hours() * 60 + d.get_minutes()) * 60 + d.get_seconds(); - return seconds as f64 + 1e-3 * (d.get_milliseconds() as f64); + seconds as f64 + 1e-3 * (d.get_milliseconds() as f64) } pub fn pixels_per_point() -> f32 { @@ -187,7 +187,7 @@ pub fn location_hash() -> Option { /// Web sends all all keys as strings, so it is up to us to figure out if it is /// a real text input or the name of a key. fn should_ignore_key(key: &str) -> bool { - let is_function_key = key.starts_with("F") && key.len() > 1; + let is_function_key = key.starts_with('F') && key.len() > 1; is_function_key || matches!( key,