format: add some blank lines where it was needed
This commit is contained in:
parent
409fb968d3
commit
530e9f667c
14 changed files with 50 additions and 0 deletions
|
@ -38,6 +38,7 @@ pub use epi::NativeOptions;
|
|||
#[derive(Debug)]
|
||||
enum EventResult {
|
||||
Wait,
|
||||
|
||||
/// Causes a synchronous repaint inside the event handler. This should only
|
||||
/// be used in special situations if the window must be repainted while
|
||||
/// handling a specific event. This occurs on Windows when handling resizes.
|
||||
|
@ -45,20 +46,28 @@ enum EventResult {
|
|||
/// `RepaintNow` creates a new frame synchronously, and should therefore
|
||||
/// only be used for extremely urgent repaints.
|
||||
RepaintNow,
|
||||
|
||||
/// Queues a repaint for once the event loop handles its next redraw. Exists
|
||||
/// so that multiple input events can be handled in one frame. Does not
|
||||
/// cause any delay like `RepaintNow`.
|
||||
RepaintNext,
|
||||
|
||||
RepaintAt(Instant),
|
||||
|
||||
Exit,
|
||||
}
|
||||
|
||||
trait WinitApp {
|
||||
fn is_focused(&self) -> bool;
|
||||
|
||||
fn integration(&self) -> Option<&EpiIntegration>;
|
||||
|
||||
fn window(&self) -> Option<&winit::window::Window>;
|
||||
|
||||
fn save_and_destroy(&mut self);
|
||||
|
||||
fn paint(&mut self) -> EventResult;
|
||||
|
||||
fn on_event(
|
||||
&mut self,
|
||||
event_loop: &EventLoopWindowTarget<UserEvent>,
|
||||
|
|
|
@ -466,6 +466,7 @@ impl EventToUnsubscribe {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub struct AppRunnerContainer {
|
||||
pub runner: AppRunnerRef,
|
||||
|
||||
|
|
|
@ -105,11 +105,13 @@ pub enum WgpuError {
|
|||
DeviceError(wgpu::RequestDeviceError),
|
||||
SurfaceError(wgpu::CreateSurfaceError),
|
||||
}
|
||||
|
||||
impl std::fmt::Display for WgpuError {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
std::fmt::Debug::fmt(self, f)
|
||||
}
|
||||
}
|
||||
|
||||
impl std::error::Error for WgpuError {
|
||||
fn source(&self) -> Option<&(dyn std::error::Error + 'static)> {
|
||||
match self {
|
||||
|
@ -118,11 +120,13 @@ impl std::error::Error for WgpuError {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl From<wgpu::RequestDeviceError> for WgpuError {
|
||||
fn from(e: wgpu::RequestDeviceError) -> Self {
|
||||
Self::DeviceError(e)
|
||||
}
|
||||
}
|
||||
|
||||
impl From<wgpu::CreateSurfaceError> for WgpuError {
|
||||
fn from(e: wgpu::CreateSurfaceError) -> Self {
|
||||
Self::SurfaceError(e)
|
||||
|
|
|
@ -60,6 +60,7 @@ pub struct State {
|
|||
pointer_pos_in_points: Option<egui::Pos2>,
|
||||
any_pointer_button_down: bool,
|
||||
current_cursor_icon: Option<egui::CursorIcon>,
|
||||
|
||||
/// What egui uses.
|
||||
current_pixels_per_point: f32,
|
||||
|
||||
|
|
|
@ -9,6 +9,7 @@ pub(crate) struct AnimationManager {
|
|||
#[derive(Clone, Debug)]
|
||||
struct BoolAnim {
|
||||
value: bool,
|
||||
|
||||
/// when did `value` last toggle?
|
||||
toggle_time: f64,
|
||||
}
|
||||
|
@ -16,7 +17,9 @@ struct BoolAnim {
|
|||
#[derive(Clone, Debug)]
|
||||
struct ValueAnim {
|
||||
from_value: f32,
|
||||
|
||||
to_value: f32,
|
||||
|
||||
/// when did `value` last toggle?
|
||||
toggle_time: f64,
|
||||
}
|
||||
|
|
|
@ -19,11 +19,16 @@ use epaint::*;
|
|||
pub struct Frame {
|
||||
/// Margin within the painted frame.
|
||||
pub inner_margin: Margin,
|
||||
|
||||
/// Margin outside the painted frame.
|
||||
pub outer_margin: Margin,
|
||||
|
||||
pub rounding: Rounding,
|
||||
|
||||
pub shadow: Shadow,
|
||||
|
||||
pub fill: Color32,
|
||||
|
||||
pub stroke: Stroke,
|
||||
}
|
||||
|
||||
|
|
|
@ -65,6 +65,7 @@ struct ContextImpl {
|
|||
|
||||
/// Written to during the frame.
|
||||
layer_rects_this_frame: ahash::HashMap<LayerId, Vec<(Id, Rect)>>,
|
||||
|
||||
/// Read
|
||||
layer_rects_prev_frame: ahash::HashMap<LayerId, Vec<(Id, Rect)>>,
|
||||
|
||||
|
|
|
@ -447,8 +447,10 @@ impl InputState {
|
|||
#[derive(Clone, Debug, PartialEq)]
|
||||
pub(crate) struct Click {
|
||||
pub pos: Pos2,
|
||||
|
||||
/// 1 or 2 (double-click) or 3 (triple-click)
|
||||
pub count: u32,
|
||||
|
||||
/// Allows you to check for e.g. shift-click
|
||||
pub modifiers: Modifiers,
|
||||
}
|
||||
|
|
|
@ -96,10 +96,14 @@ struct GestureState {
|
|||
struct DynGestureState {
|
||||
/// used for proportional zooming
|
||||
avg_distance: f32,
|
||||
|
||||
/// used for non-proportional zooming
|
||||
avg_abs_distance2: Vec2,
|
||||
|
||||
avg_pos: Pos2,
|
||||
|
||||
avg_force: f32,
|
||||
|
||||
heading: f32,
|
||||
}
|
||||
|
||||
|
|
|
@ -513,18 +513,30 @@ pub mod special_emojis {
|
|||
#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
|
||||
pub enum WidgetType {
|
||||
Label, // TODO(emilk): emit Label events
|
||||
|
||||
/// e.g. a hyperlink
|
||||
Link,
|
||||
|
||||
TextEdit,
|
||||
|
||||
Button,
|
||||
|
||||
Checkbox,
|
||||
|
||||
RadioButton,
|
||||
|
||||
SelectableLabel,
|
||||
|
||||
ComboBox,
|
||||
|
||||
Slider,
|
||||
|
||||
DragValue,
|
||||
|
||||
ColorButton,
|
||||
|
||||
ImageButton,
|
||||
|
||||
CollapsingHeader,
|
||||
|
||||
/// If you cannot fit any of the above slots.
|
||||
|
|
|
@ -305,6 +305,7 @@ pub struct Spacing {
|
|||
|
||||
/// Margin between contents and scroll bar.
|
||||
pub scroll_bar_inner_margin: f32,
|
||||
|
||||
/// Margin between scroll bar and the outer container (e.g. right of a vertical scroll bar).
|
||||
pub scroll_bar_outer_margin: f32,
|
||||
}
|
||||
|
@ -491,6 +492,7 @@ pub struct Visuals {
|
|||
pub resize_corner_size: f32,
|
||||
|
||||
pub text_cursor_width: f32,
|
||||
|
||||
/// show where the text cursor would be if you clicked
|
||||
pub text_cursor_preview: bool,
|
||||
|
||||
|
|
|
@ -15,6 +15,7 @@ use crate::*;
|
|||
pub struct Pos2 {
|
||||
/// How far to the right.
|
||||
pub x: f32,
|
||||
|
||||
/// How far down.
|
||||
pub y: f32,
|
||||
// implicit w = 1
|
||||
|
|
|
@ -973,12 +973,16 @@ pub struct Tessellator {
|
|||
pixels_per_point: f32,
|
||||
options: TessellationOptions,
|
||||
font_tex_size: [usize; 2],
|
||||
|
||||
/// See [`TextureAtlas::prepared_discs`].
|
||||
prepared_discs: Vec<PreparedDisc>,
|
||||
|
||||
/// size of feathering in points. normally the size of a physical pixel. 0.0 if disabled
|
||||
feathering: f32,
|
||||
|
||||
/// Only used for culling
|
||||
clip_rect: Rect,
|
||||
|
||||
scratchpad_points: Vec<Pos2>,
|
||||
scratchpad_path: Path,
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
use eframe::egui;
|
||||
use egui::*;
|
||||
|
||||
fn main() -> Result<(), eframe::Error> {
|
||||
// Log to stdout (if you run with `RUST_LOG=debug`).
|
||||
tracing_subscriber::fmt::init();
|
||||
|
|
Loading…
Reference in a new issue