fix(grid dnd): offset dnd icon by grid item padding
This commit is contained in:
parent
319fa5faec
commit
10f234bf79
1 changed files with 10 additions and 1 deletions
11
src/tab.rs
11
src/tab.rs
|
|
@ -5366,6 +5366,7 @@ impl Tab {
|
||||||
self.size_opt.set(Some(size));
|
self.size_opt.set(Some(size));
|
||||||
|
|
||||||
let cosmic_theme::Spacing {
|
let cosmic_theme::Spacing {
|
||||||
|
space_xxxs,
|
||||||
space_xxs,
|
space_xxs,
|
||||||
space_xs,
|
space_xs,
|
||||||
..
|
..
|
||||||
|
|
@ -5395,6 +5396,7 @@ impl Tab {
|
||||||
let item_view =
|
let item_view =
|
||||||
DndSource::<Message, ClipboardCopy>::with_id(item_view, Id::new("tab-view"));
|
DndSource::<Message, ClipboardCopy>::with_id(item_view, Id::new("tab-view"));
|
||||||
|
|
||||||
|
let view = self.config.view;
|
||||||
let item_view = match drag_list {
|
let item_view = match drag_list {
|
||||||
Some(drag_list) if self.selected_clicked => {
|
Some(drag_list) if self.selected_clicked => {
|
||||||
let drag_list = ArcElementWrapper::<Message>(Arc::new(Mutex::new(drag_list)));
|
let drag_list = ArcElementWrapper::<Message>(Arc::new(Mutex::new(drag_list)));
|
||||||
|
|
@ -5407,7 +5409,14 @@ impl Tab {
|
||||||
(
|
(
|
||||||
Element::from(drag_list.clone()).map(|_m| ()),
|
Element::from(drag_list.clone()).map(|_m| ()),
|
||||||
state,
|
state,
|
||||||
Vector::ZERO,
|
match view {
|
||||||
|
// offset by grid padding so that we grab the top left corner of the item in the drag grid.
|
||||||
|
View::Grid => Vector::new(
|
||||||
|
-3. * space_xxs as f32 - space_xxxs as f32,
|
||||||
|
-4. * (space_xxxs as f32),
|
||||||
|
),
|
||||||
|
View::List => Vector::ZERO,
|
||||||
|
},
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue