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