Skip to content

Commit 3e1263f

Browse files
committed
refactor: change widget order for button event handling
1 parent fc33ded commit 3e1263f

File tree

1 file changed

+21
-21
lines changed

1 file changed

+21
-21
lines changed

src/widgets/application.rs

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,8 @@ impl<'a, Message: Clone + 'static> ApplicationButton<'a, Message> {
101101
};
102102
let path_ = path.clone();
103103
let image_clone = image.clone();
104-
let content = button::custom(
105-
dnd_source(
104+
let content = dnd_source(
105+
button::custom(
106106
column![
107107
image
108108
.as_cosmic_icon()
@@ -119,26 +119,26 @@ impl<'a, Message: Clone + 'static> ApplicationButton<'a, Message> {
119119
.align_x(Alignment::Center)
120120
.width(Length::Fill),
121121
)
122-
.drag_icon(move || {
123-
(
124-
image_clone
125-
.as_cosmic_icon()
126-
.width(Length::Fixed(72.0))
127-
.height(Length::Fixed(72.0))
128-
.into(),
129-
tree::State::None,
130-
)
131-
})
132-
.drag_content(move || AppletString(path_.clone().unwrap()))
133-
.on_start(on_start)
134-
.on_cancel(on_cancel)
135-
.on_finish(on_finish),
122+
.selected(selected)
123+
.width(Length::FillPortion(1))
124+
.class(theme::Button::IconVertical)
125+
.padding(space_s)
126+
.on_press_maybe(on_pressed.clone()),
136127
)
137-
.selected(selected)
138-
.width(Length::FillPortion(1))
139-
.class(theme::Button::IconVertical)
140-
.padding(space_s)
141-
.on_press_maybe(on_pressed.clone())
128+
.drag_icon(move || {
129+
(
130+
image_clone
131+
.as_cosmic_icon()
132+
.width(Length::Fixed(72.0))
133+
.height(Length::Fixed(72.0))
134+
.into(),
135+
tree::State::None,
136+
)
137+
})
138+
.drag_content(move || AppletString(path_.clone().unwrap()))
139+
.on_start(on_start)
140+
.on_cancel(on_cancel)
141+
.on_finish(on_finish)
142142
.into();
143143
Self {
144144
path: path.clone().unwrap(),

0 commit comments

Comments
 (0)