parent
1f3609d7df
commit
8f6dd9309d
2 changed files with 10 additions and 11 deletions
10
src/main.rs
10
src/main.rs
|
@ -13,12 +13,12 @@ use cosmic::iced_widget::{column, row};
|
|||
use cosmic::widget::dnd_destination::DragId;
|
||||
use cosmic::widget::nav_bar::nav_bar_style;
|
||||
use cosmic::widget::segmented_button::Entity;
|
||||
use cosmic::widget::text;
|
||||
use cosmic::widget::tooltip::Position as TPosition;
|
||||
use cosmic::widget::{
|
||||
button, horizontal_space, nav_bar, search_input, tooltip, Space,
|
||||
};
|
||||
use cosmic::widget::{icon, slider};
|
||||
use cosmic::widget::{mouse_area, text};
|
||||
use cosmic::{executor, Application, ApplicationExt, Element};
|
||||
use cosmic::{prelude::*, theme};
|
||||
use cosmic::{widget::Container, Theme};
|
||||
|
@ -249,11 +249,9 @@ impl cosmic::Application for App {
|
|||
debug!("left");
|
||||
cosmic::Action::App(Message::DndLeave(entity))
|
||||
})
|
||||
.on_dnd_drop::<ServiceItem>(|entity, data, action| {
|
||||
.on_dnd_drop::<ServiceItem>(|_, _, _| {
|
||||
debug!("dropped");
|
||||
cosmic::Action::App(Message::DndDrop(
|
||||
entity, data, action,
|
||||
))
|
||||
cosmic::Action::App(Message::DndDrop)
|
||||
})
|
||||
.drag_id(DragId::new())
|
||||
.on_context(|id| {
|
||||
|
@ -639,7 +637,7 @@ impl cosmic::Application for App {
|
|||
// debug!(?action);
|
||||
// debug!(?service_item);
|
||||
|
||||
if let Some(library) = self.library {
|
||||
if let Some(library) = &self.library {
|
||||
if let Some((lib, item)) = library.dragged_item {
|
||||
// match lib {
|
||||
// core::model::LibraryKind::Song => ,
|
||||
|
|
|
@ -46,7 +46,7 @@ pub(crate) struct Library {
|
|||
|
||||
pub(crate) enum Action {
|
||||
OpenItem(Option<(LibraryKind, i32)>),
|
||||
DraggedItem(Option<(LibraryKind, i32)>),
|
||||
DraggedItem(ServiceItem),
|
||||
Task(Task<Message>),
|
||||
None,
|
||||
}
|
||||
|
@ -60,7 +60,7 @@ pub(crate) enum Message {
|
|||
OpenLibrary(Option<LibraryKind>),
|
||||
HoverItem(Option<(LibraryKind, i32)>),
|
||||
SelectItem(Option<(LibraryKind, i32)>),
|
||||
DragItem(Option<(LibraryKind, i32)>),
|
||||
DragItem(ServiceItem),
|
||||
UpdateSong(Song),
|
||||
SongChanged,
|
||||
UpdateImage(Image),
|
||||
|
@ -121,8 +121,9 @@ impl<'a> Library {
|
|||
self.selected_item = item;
|
||||
}
|
||||
Message::DragItem(item) => {
|
||||
self.dragged_item = item;
|
||||
// return Action::DraggedItem(item);
|
||||
debug!(?item);
|
||||
// self.dragged_item = item;
|
||||
return Action::DraggedItem(item);
|
||||
}
|
||||
Message::UpdateSong(song) => {
|
||||
let Some((kind, index)) = self.editing_item else {
|
||||
|
@ -372,7 +373,7 @@ impl<'a> Library {
|
|||
.map(|_| Message::None);
|
||||
DndSource::<Message, ServiceItem>::new(
|
||||
mouse_area(visual_item)
|
||||
.on_drag(Message::DragItem(Some((model.kind, index as i32))))
|
||||
.on_drag(Message::DragItem(service_item.clone()))
|
||||
.on_enter(Message::HoverItem(
|
||||
Some((
|
||||
model.kind,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue