diff --git a/src/core/images.rs b/src/core/images.rs index fda63f4..cd9b2e7 100644 --- a/src/core/images.rs +++ b/src/core/images.rs @@ -10,8 +10,8 @@ use crisp::types::{Keyword, Symbol, Value}; use miette::{IntoDiagnostic, Result}; use serde::{Deserialize, Serialize}; use sqlx::{ - pool::PoolConnection, query, query_as, Sqlite, SqliteConnection, - SqlitePool, + Sqlite, SqliteConnection, SqlitePool, pool::PoolConnection, + query, query_as, }; use std::path::{Path, PathBuf}; use tracing::{debug, error}; diff --git a/src/core/model.rs b/src/core/model.rs index a778a14..13ddda8 100644 --- a/src/core/model.rs +++ b/src/core/model.rs @@ -1,6 +1,6 @@ use std::mem::replace; -use miette::{miette, Result}; +use miette::{Result, miette}; use sqlx::{Connection, SqliteConnection}; #[derive(Debug, Clone)] diff --git a/src/core/presentations.rs b/src/core/presentations.rs index 4ada88e..76d19ea 100644 --- a/src/core/presentations.rs +++ b/src/core/presentations.rs @@ -4,8 +4,8 @@ use miette::{IntoDiagnostic, Result}; use mupdf::{Colorspace, Document, Matrix}; use serde::{Deserialize, Serialize}; use sqlx::{ - pool::PoolConnection, prelude::FromRow, query, sqlite::SqliteRow, - Row, Sqlite, SqliteConnection, SqlitePool, + Row, Sqlite, SqliteConnection, SqlitePool, pool::PoolConnection, + prelude::FromRow, query, sqlite::SqliteRow, }; use std::path::{Path, PathBuf}; use tracing::{debug, error}; diff --git a/src/core/service_items.rs b/src/core/service_items.rs index 3912fa0..5b4aed7 100644 --- a/src/core/service_items.rs +++ b/src/core/service_items.rs @@ -12,7 +12,7 @@ use crate::Slide; use super::images::Image; use super::presentations::Presentation; -use super::songs::{lisp_to_song, Song}; +use super::songs::{Song, lisp_to_song}; use super::videos::Video; use super::kinds::ServiceItemKind; diff --git a/src/core/slide.rs b/src/core/slide.rs index 30bf847..70e60c1 100644 --- a/src/core/slide.rs +++ b/src/core/slide.rs @@ -2,7 +2,7 @@ use cosmic::widget::image::Handle; // use cosmic::dialog::ashpd::url::Url; use crisp::types::{Keyword, Symbol, Value}; use iced_video_player::Video; -use miette::{miette, Result}; +use miette::{Result, miette}; use serde::{Deserialize, Serialize}; use std::{ fmt::Display, diff --git a/src/core/songs.rs b/src/core/songs.rs index feb9d65..2be3a66 100644 --- a/src/core/songs.rs +++ b/src/core/songs.rs @@ -1,15 +1,15 @@ use std::{collections::HashMap, option::Option, path::PathBuf}; use crisp::types::{Keyword, Symbol, Value}; -use miette::{miette, IntoDiagnostic, Result}; +use miette::{IntoDiagnostic, Result, miette}; use serde::{Deserialize, Serialize}; use sqlx::{ - pool::PoolConnection, query, sqlite::SqliteRow, Acquire, FromRow, - Row, Sqlite, SqliteConnection, SqlitePool, + Acquire, FromRow, Row, Sqlite, SqliteConnection, SqlitePool, + pool::PoolConnection, query, sqlite::SqliteRow, }; use tracing::error; -use crate::{core::slide, Slide, SlideBuilder}; +use crate::{Slide, SlideBuilder, core::slide}; use super::{ content::Content, diff --git a/src/core/videos.rs b/src/core/videos.rs index dc97db6..c881572 100644 --- a/src/core/videos.rs +++ b/src/core/videos.rs @@ -11,8 +11,8 @@ use crisp::types::{Keyword, Symbol, Value}; use miette::{IntoDiagnostic, Result}; use serde::{Deserialize, Serialize}; use sqlx::{ - pool::PoolConnection, query, query_as, Sqlite, SqliteConnection, - SqlitePool, + Sqlite, SqliteConnection, SqlitePool, pool::PoolConnection, + query, query_as, }; use std::path::{Path, PathBuf}; use tracing::{debug, error}; diff --git a/src/lisp.rs b/src/lisp.rs index 2f803e4..c2f4c8f 100644 --- a/src/lisp.rs +++ b/src/lisp.rs @@ -40,11 +40,11 @@ mod test { use std::{fs::read_to_string, path::PathBuf}; use crate::{ + Background, TextAlignment, core::{ images::Image, kinds::ServiceItemKind, service_items::ServiceTrait, songs::Song, videos::Video, }, - Background, TextAlignment, }; use super::*; diff --git a/src/main.rs b/src/main.rs index e2d9871..3618fb0 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,4 +1,4 @@ -use clap::{command, Parser}; +use clap::{Parser, command}; use core::service_items::ServiceItem; use core::slide::{ Background, BackgroundKind, Slide, SlideBuilder, TextAlignment, @@ -9,8 +9,8 @@ use cosmic::iced::alignment::Vertical; use cosmic::iced::keyboard::{Key, Modifiers}; use cosmic::iced::window::{Mode, Position}; use cosmic::iced::{ - self, event, window, Background as IcedBackground, Border, Color, - Length, + self, Background as IcedBackground, Border, Color, Length, event, + window, }; use cosmic::iced_core::text::Wrapping; use cosmic::iced_futures::Subscription; @@ -21,18 +21,18 @@ use cosmic::widget::menu::key_bind::Modifier; use cosmic::widget::menu::{ItemWidth, KeyBind}; use cosmic::widget::nav_bar::nav_bar_style; use cosmic::widget::tooltip::Position as TPosition; +use cosmic::widget::{Container, menu}; use cosmic::widget::{ - button, context_menu, horizontal_space, mouse_area, nav_bar, - nav_bar_toggle, responsive, scrollable, search_input, tooltip, - vertical_space, Space, + Space, button, context_menu, horizontal_space, mouse_area, + nav_bar, nav_bar_toggle, responsive, scrollable, search_input, + tooltip, vertical_space, }; use cosmic::widget::{container, text}; use cosmic::widget::{icon, slider}; -use cosmic::widget::{menu, Container}; -use cosmic::{executor, Application, ApplicationExt, Element}; +use cosmic::{Application, ApplicationExt, Element, executor}; use crisp::types::Value; use lisp::parse_lisp; -use miette::{miette, Result}; +use miette::{Result, miette}; use rayon::prelude::*; use resvg::usvg::fontdb; use std::collections::HashMap; @@ -42,10 +42,10 @@ use std::sync::Arc; use tracing::{debug, level_filters::LevelFilter}; use tracing::{error, warn}; use tracing_subscriber::EnvFilter; +use ui::EditorMode; use ui::library::{self, Library}; use ui::presenter::{self, Presenter}; use ui::song_editor::{self, SongEditor}; -use ui::EditorMode; use crate::core::kinds::ServiceItemKind; use crate::ui::image_editor::{self, ImageEditor}; diff --git a/src/ui/image_editor.rs b/src/ui/image_editor.rs index 878fe8e..194484f 100644 --- a/src/ui/image_editor.rs +++ b/src/ui/image_editor.rs @@ -2,15 +2,15 @@ use std::{io, path::PathBuf}; use crate::core::images::Image; use cosmic::{ - dialog::file_chooser::{open::Dialog, FileFilter}, - iced::{alignment::Vertical, Length}, + Element, Task, + dialog::file_chooser::{FileFilter, open::Dialog}, + iced::{Length, alignment::Vertical}, iced_widget::{column, row}, theme, widget::{ - self, button, container, horizontal_space, icon, text, - text_input, Space, + self, Space, button, container, horizontal_space, icon, text, + text_input, }, - Element, Task, }; use tracing::{debug, error, warn}; diff --git a/src/ui/library.rs b/src/ui/library.rs index 3a1921a..48fb8e8 100644 --- a/src/ui/library.rs +++ b/src/ui/library.rs @@ -4,8 +4,7 @@ use cosmic::{ dialog::file_chooser::open::Dialog, iced::{ alignment::Vertical, clipboard::dnd::DndAction, - futures::FutureExt, keyboard::Modifiers, Background, Border, - Color, Length, + keyboard::Modifiers, Background, Border, Color, Length, }, iced_core::widget::tree::State, iced_widget::{column, row as rowm, text as textm}, @@ -53,8 +52,8 @@ pub struct Library { #[derive(Debug, Clone, Eq, PartialEq, Copy)] enum MenuMessage { - Delete((LibraryKind, i32)), - Open, + Delete, + Open((LibraryKind, i32)), } impl MenuAction for MenuMessage { @@ -62,10 +61,10 @@ impl MenuAction for MenuMessage { fn message(&self) -> Self::Message { match self { - MenuMessage::Delete((kind, index)) => { - Message::DeleteItem((*kind, *index)) + MenuMessage::Delete => Message::DeleteItem, + MenuMessage::Open((kind, index)) => { + Message::OpenItem(Some((*kind, *index))) } - MenuMessage::Open => todo!(), } } } @@ -80,7 +79,7 @@ pub enum Action { #[derive(Clone, Debug)] pub enum Message { AddItem, - DeleteItem((LibraryKind, i32)), + DeleteItem, OpenItem(Option<(LibraryKind, i32)>), HoverLibrary(Option), OpenLibrary(Option), @@ -135,7 +134,7 @@ impl<'a> Library { pub fn update(&'a mut self, message: Message) -> Action { match message { Message::None => (), - Message::DeleteItem((kind, index)) => { + Message::DeleteItem => { return self.delete_items(); } Message::AddItem => { @@ -185,6 +184,7 @@ impl<'a> Library { return self.update(Message::OpenItem(item)); } Message::AddVideos(videos) => { + debug!(?videos); if let Some(videos) = videos { for video in videos { if let Err(e) = @@ -604,7 +604,10 @@ impl<'a> Library { if let Some(context_id) = self.context_menu { if index == context_id as usize { - let menu_items = vec![menu::Item::Button("Delete", None, MenuMessage::Delete((model.kind, index as i32)))]; + let menu_items = vec![ + menu::Item::Button("Open", None, MenuMessage::Open((model.kind, index as i32))), + menu::Item::Button("Delete", None, MenuMessage::Delete) + ]; let context_menu = context_menu( mouse_area, self.context_menu.map_or_else(|| None, |_| { @@ -684,11 +687,11 @@ impl<'a> Library { "text/org".into(), ], ) - .on_enter(|x, y, mimes| { + .on_enter(|_, _, mimes| { warn!(?mimes); Message::None }) - .on_finish(|mime, data, action, x, y| { + .on_finish(|mime, data, action, _, _| { warn!(?mime, ?data, ?action); Message::None }); @@ -892,23 +895,23 @@ impl<'a> Library { return Action::None; }; items.sort_by(|(_, index), (_, other)| index.cmp(other)); - let tasks: Vec> = items - .iter() - .rev() - .map(|(kind, index)| match kind { - LibraryKind::Song => { - if let Some(song) = - self.song_library.get_item(*index) - { - let song = song.clone(); - if let Err(e) = - self.song_library.remove_item(*index) + let tasks: Vec> = + items + .iter() + .rev() + .map(|(kind, index)| match kind { + LibraryKind::Song => { + if let Some(song) = + self.song_library.get_item(*index) { - error!(?e); - Task::none() - } else { - - Task::future(self.db.acquire()) + let song = song.clone(); + if let Err(e) = + self.song_library.remove_item(*index) + { + error!(?e); + Task::none() + } else { + Task::future(self.db.acquire()) .and_then(move |db| { Task::perform( songs::remove_from_db( @@ -922,24 +925,23 @@ impl<'a> Library { }, ) }) - } - } else { - Task::none() - } - } - LibraryKind::Video => { - if let Some(video) = - self.video_library.get_item(*index) - { - let video = video.clone(); - if let Err(e) = - self.video_library.remove_item(*index) - { - error!(?e); - Task::none() + } } else { - - Task::future(self.db.acquire()) + Task::none() + } + } + LibraryKind::Video => { + if let Some(video) = + self.video_library.get_item(*index) + { + let video = video.clone(); + if let Err(e) = + self.video_library.remove_item(*index) + { + error!(?e); + Task::none() + } else { + Task::future(self.db.acquire()) .and_then(move |db| { Task::perform( videos::remove_from_db( @@ -953,24 +955,23 @@ impl<'a> Library { }, ) }) - } - } else { - Task::none() - } - } - LibraryKind::Image => { - if let Some(image) = - self.image_library.get_item(*index) - { - let image = image.clone(); - if let Err(e) = - self.image_library.remove_item(*index) - { - error!(?e); - Task::none() + } } else { - - Task::future(self.db.acquire()) + Task::none() + } + } + LibraryKind::Image => { + if let Some(image) = + self.image_library.get_item(*index) + { + let image = image.clone(); + if let Err(e) = + self.image_library.remove_item(*index) + { + error!(?e); + Task::none() + } else { + Task::future(self.db.acquire()) .and_then(move |db| { Task::perform( images::remove_from_db( @@ -984,25 +985,24 @@ impl<'a> Library { }, ) }) - } - } else { - Task::none() - } - } - LibraryKind::Presentation => { - if let Some(presentation) = - self.presentation_library.get_item(*index) - { - let presentation = presentation.clone(); - if let Err(e) = self - .presentation_library - .remove_item(*index) - { - error!(?e); - Task::none() + } } else { - - Task::future(self.db.acquire()) + Task::none() + } + } + LibraryKind::Presentation => { + if let Some(presentation) = + self.presentation_library.get_item(*index) + { + let presentation = presentation.clone(); + if let Err(e) = self + .presentation_library + .remove_item(*index) + { + error!(?e); + Task::none() + } else { + Task::future(self.db.acquire()) .and_then(move |db| { Task::perform( presentations::remove_from_db( @@ -1017,13 +1017,13 @@ impl<'a> Library { }, ) }) + } + } else { + Task::none() } - } else { - Task::none() } - } - }) - .collect(); + }) + .collect(); if !tasks.is_empty() { self.selected_items = None; } diff --git a/src/ui/presentation_editor.rs b/src/ui/presentation_editor.rs index 2d8e6e1..17f4a9f 100644 --- a/src/ui/presentation_editor.rs +++ b/src/ui/presentation_editor.rs @@ -5,15 +5,15 @@ use crate::core::{ slide::Slide, }; use cosmic::{ - dialog::file_chooser::{open::Dialog, FileFilter}, - iced::{alignment::Vertical, Length}, + Element, Task, + dialog::file_chooser::{FileFilter, open::Dialog}, + iced::{Length, alignment::Vertical}, iced_widget::{column, row}, theme, widget::{ - button, container, horizontal_space, icon, text, - text_input, Space, + Space, button, container, horizontal_space, icon, text, + text_input, }, - Element, Task, }; use tracing::{debug, error, warn}; diff --git a/src/ui/presenter.rs b/src/ui/presenter.rs index 73022dd..84b9e18 100644 --- a/src/ui/presenter.rs +++ b/src/ui/presenter.rs @@ -7,37 +7,36 @@ use std::{ }; use cosmic::{ + Task, iced::{ - font::{Family, Stretch, Style, Weight}, Background, Border, Color, ContentFit, Font, Length, Shadow, Vector, + font::{Family, Stretch, Style, Weight}, }, iced_widget::{ scrollable::{ - scroll_to, AbsoluteOffset, Direction, Scrollbar, + AbsoluteOffset, Direction, Scrollbar, scroll_to, }, stack, vertical_rule, }, prelude::*, widget::{ - container, image, mouse_area, responsive, scrollable, text, - Container, Id, Row, Space, + Container, Id, Row, Space, container, image, mouse_area, + responsive, scrollable, text, }, - Task, }; -use iced_video_player::{gst_pbutils, Position, Video, VideoPlayer}; +use iced_video_player::{Position, Video, VideoPlayer, gst_pbutils}; use rodio::{Decoder, OutputStream, OutputStreamBuilder, Sink}; use tracing::{debug, error, info, warn}; use url::Url; use crate::{ - core::{service_items::ServiceItem, slide::Slide}, BackgroundKind, + core::{service_items::ServiceItem, slide::Slide}, }; const REFERENCE_WIDTH: f32 = 1920.0; -static DEFAULT_SLIDE: LazyLock = - LazyLock::new(Slide::default); +static DEFAULT_SLIDE: LazyLock = LazyLock::new(Slide::default); // #[derive(Default, Clone, Debug)] pub(crate) struct Presenter { @@ -156,8 +155,11 @@ impl Presenter { let slide = items.first().and_then(|item| item.slides.first()); - let audio = items.first() - .and_then(|item| item.slides.first().map(|slide| slide.audio())) + let audio = items + .first() + .and_then(|item| { + item.slides.first().map(|slide| slide.audio()) + }) .flatten(); Self { diff --git a/src/ui/service.rs b/src/ui/service.rs index 5b35459..ceca63c 100644 --- a/src/ui/service.rs +++ b/src/ui/service.rs @@ -2,16 +2,16 @@ use cosmic::iced::Size; use cosmic::iced_core::widget::tree; use cosmic::{ + Element, iced::{ + Event, Length, Point, Rectangle, Vector, clipboard::dnd::{DndEvent, SourceEvent}, - event, mouse, Event, Length, Point, Rectangle, Vector, + event, mouse, }, iced_core::{ - self, layout, renderer, widget::Tree, - Clipboard, Shell, + self, Clipboard, Shell, layout, renderer, widget::Tree, }, widget::Widget, - Element, }; use tracing::debug; @@ -199,23 +199,21 @@ impl && position .distance(left_pressed_position) > self.drag_threshold + { + if let Some(on_start) = + self.on_start.as_ref() { - if let Some(on_start) = - self.on_start.as_ref() - { - shell - .publish(on_start.clone()) - } - let offset = Vector::new( - left_pressed_position.x - - layout.bounds().x, - left_pressed_position.y - - layout.bounds().y, - ); - state.is_dragging = true; - state.left_pressed_position = - None; + shell.publish(on_start.clone()) } + let offset = Vector::new( + left_pressed_position.x + - layout.bounds().x, + left_pressed_position.y + - layout.bounds().y, + ); + state.is_dragging = true; + state.left_pressed_position = None; + } if !cursor.is_over(layout.bounds()) { state.hovered = false; diff --git a/src/ui/slide_editor.rs b/src/ui/slide_editor.rs index c9ae9cb..ca6ce51 100644 --- a/src/ui/slide_editor.rs +++ b/src/ui/slide_editor.rs @@ -1,13 +1,13 @@ use std::{io, path::PathBuf}; use cosmic::{ + Renderer, iced::{Color, Font, Length, Size}, widget::{ self, canvas::{self, Program, Stroke}, container, }, - Renderer, }; use tracing::debug; diff --git a/src/ui/song_editor.rs b/src/ui/song_editor.rs index 6a524bd..309e86c 100644 --- a/src/ui/song_editor.rs +++ b/src/ui/song_editor.rs @@ -1,8 +1,9 @@ use std::{io, path::PathBuf, sync::Arc}; use cosmic::{ - dialog::file_chooser::{open::Dialog, FileFilter}, - iced::{alignment::Vertical, Length}, + Element, Task, + dialog::file_chooser::{FileFilter, open::Dialog}, + iced::{Length, alignment::Vertical}, iced_wgpu::graphics::text::cosmic_text::fontdb, iced_widget::{column, row}, theme, @@ -10,7 +11,6 @@ use cosmic::{ button, combo_box, container, horizontal_space, icon, progress_bar, scrollable, text, text_editor, text_input, }, - Element, Task, }; use dirs::font_dir; use iced_video_player::Video; @@ -18,11 +18,11 @@ use rayon::iter::{IntoParallelIterator, ParallelIterator}; use tracing::{debug, error}; use crate::{ + Background, BackgroundKind, core::{service_items::ServiceTrait, slide::Slide, songs::Song}, ui::{ presenter::slide_view, slide_editor::SlideEditor, text_svg, }, - Background, BackgroundKind, }; #[derive(Debug)] diff --git a/src/ui/text_svg.rs b/src/ui/text_svg.rs index 58c574a..07b0e9a 100644 --- a/src/ui/text_svg.rs +++ b/src/ui/text_svg.rs @@ -8,16 +8,16 @@ use std::{ use colors_transform::Rgb; use cosmic::{ iced::{ - font::{Style, Weight}, ContentFit, Length, Size, + font::{Style, Weight}, }, prelude::*, - widget::{image::Handle, Image}, + widget::{Image, image::Handle}, }; use rapidhash::v3::rapidhash_v3; use resvg::{ tiny_skia::{self, Pixmap}, - usvg::{fontdb, Tree}, + usvg::{Tree, fontdb}, }; use tracing::{debug, error}; diff --git a/src/ui/video_editor.rs b/src/ui/video_editor.rs index d0d4fd2..f4a27c1 100644 --- a/src/ui/video_editor.rs +++ b/src/ui/video_editor.rs @@ -1,15 +1,15 @@ use std::{io, path::PathBuf}; use cosmic::{ - dialog::file_chooser::{open::Dialog, FileFilter}, - iced::{alignment::Vertical, Length}, + Element, Task, + dialog::file_chooser::{FileFilter, open::Dialog}, + iced::{Length, alignment::Vertical}, iced_widget::{column, row}, theme, widget::{ - button, container, horizontal_space, icon, progress_bar, - text, text_input, Space, + Space, button, container, horizontal_space, icon, + progress_bar, text, text_input, }, - Element, Task, }; use iced_video_player::{Video, VideoPlayer}; use tracing::{debug, error, warn}; diff --git a/src/ui/widgets/draggable/column.rs b/src/ui/widgets/draggable/column.rs index f6dc41c..14c8af2 100644 --- a/src/ui/widgets/draggable/column.rs +++ b/src/ui/widgets/draggable/column.rs @@ -22,17 +22,17 @@ // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +use cosmic::Theme; use cosmic::iced::advanced::layout::{self, Layout}; -use cosmic::iced::advanced::widget::{tree, Operation, Tree, Widget}; -use cosmic::iced::advanced::{overlay, renderer, Clipboard, Shell}; +use cosmic::iced::advanced::widget::{Operation, Tree, Widget, tree}; +use cosmic::iced::advanced::{Clipboard, Shell, overlay, renderer}; use cosmic::iced::alignment::{self, Alignment}; use cosmic::iced::event::{self, Event}; -use cosmic::iced::{self, mouse, Transformation}; +use cosmic::iced::{self, Transformation, mouse}; use cosmic::iced::{ Background, Border, Color, Element, Length, Padding, Pixels, Point, Rectangle, Size, Vector, }; -use cosmic::Theme; use super::{Action, DragEvent, DropPosition}; @@ -470,23 +470,20 @@ where cursor.position() && cursor_position.distance(origin) > self.deadband_zone - { - // Start dragging - *action = Action::Dragging { - index, - origin, - last_cursor: cursor_position, - }; - if let Some(on_reorder) = - &self.on_drag - { - shell.publish(on_reorder( - DragEvent::Picked { index }, - )); - } - event_status = - event::Status::Captured; + { + // Start dragging + *action = Action::Dragging { + index, + origin, + last_cursor: cursor_position, + }; + if let Some(on_reorder) = &self.on_drag { + shell.publish(on_reorder( + DragEvent::Picked { index }, + )); } + event_status = event::Status::Captured; + } } Action::Dragging { origin, index, .. } => { if let Some(cursor_position) = diff --git a/src/ui/widgets/draggable/row.rs b/src/ui/widgets/draggable/row.rs index 810f589..67f2212 100644 --- a/src/ui/widgets/draggable/row.rs +++ b/src/ui/widgets/draggable/row.rs @@ -23,11 +23,11 @@ // CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. use cosmic::iced::advanced::layout::{self, Layout}; -use cosmic::iced::advanced::widget::{tree, Operation, Tree, Widget}; -use cosmic::iced::advanced::{overlay, renderer, Clipboard, Shell}; +use cosmic::iced::advanced::widget::{Operation, Tree, Widget, tree}; +use cosmic::iced::advanced::{Clipboard, Shell, overlay, renderer}; use cosmic::iced::alignment::{self, Alignment}; use cosmic::iced::event::{self, Event}; -use cosmic::iced::{self, mouse, Transformation}; +use cosmic::iced::{self, Transformation, mouse}; use cosmic::iced::{ Background, Border, Color, Element, Length, Padding, Pixels, Point, Rectangle, Size, Theme, Vector, @@ -456,23 +456,20 @@ where cursor.position() && cursor_position.distance(origin) > self.deadband_zone - { - // Start dragging - *action = Action::Dragging { - index, - origin, - last_cursor: cursor_position, - }; - if let Some(on_reorder) = - &self.on_drag - { - shell.publish(on_reorder( - DragEvent::Picked { index }, - )); - } - event_status = - event::Status::Captured; + { + // Start dragging + *action = Action::Dragging { + index, + origin, + last_cursor: cursor_position, + }; + if let Some(on_reorder) = &self.on_drag { + shell.publish(on_reorder( + DragEvent::Picked { index }, + )); } + event_status = event::Status::Captured; + } } Action::Dragging { origin, index, .. } => { if let Some(cursor_position) =