merge: pop-os/iced a l'etat pinne par libcosmic 7f715bc5d (epoch-1.10.0)
Some checks are pending
Audit / vulnerabilities (push) Waiting to run
Check / wasm (push) Waiting to run
Check / widget (push) Waiting to run
Document / all (push) Waiting to run
Format / all (push) Waiting to run
Lint / all (push) Waiting to run
Test / all (macOS-latest, 1.88) (push) Waiting to run
Test / all (macOS-latest, beta) (push) Waiting to run
Test / all (macOS-latest, stable) (push) Waiting to run
Test / all (ubuntu-latest, 1.88) (push) Waiting to run
Test / all (ubuntu-latest, beta) (push) Waiting to run
Test / all (ubuntu-latest, stable) (push) Waiting to run
Test / all (windows-latest, 1.88) (push) Waiting to run
Test / all (windows-latest, beta) (push) Waiting to run
Test / all (windows-latest, stable) (push) Waiting to run

This commit is contained in:
Lionel DARNIS 2026-10-11 06:57:56 +02:00
commit f8ac890b9c
7 changed files with 118 additions and 40 deletions

View file

@ -344,7 +344,7 @@ where
_renderer: &Renderer,
_clipboard: &mut dyn Clipboard,
shell: &mut Shell<'_, Message>,
_viewport: &Rectangle,
viewport: &Rectangle,
) {
let state = tree.state.downcast_mut::<State>();
@ -452,6 +452,8 @@ where
Event::Mouse(mouse::Event::ButtonReleased(
mouse::Button::Left,
))
| Event::Mouse(mouse::Event::CursorLeft)
| Event::Mouse(mouse::Event::CursorEntered)
| Event::Touch(touch::Event::FingerLifted { .. })
| Event::Touch(touch::Event::FingerLost { .. }) => {
if state.is_dragging {
@ -464,13 +466,20 @@ where
Event::Mouse(mouse::Event::CursorMoved { .. })
| Event::Touch(touch::Event::FingerMoved { .. }) => {
if state.is_dragging {
let _ = cursor
.land()
.position()
.and_then(locate)
.map(change);
let position = cursor.land().position();
let outside = position.is_none_or(|position| {
!viewport.contains(position)
});
shell.capture_event();
if outside {
if let Some(on_release) = self.on_release.clone() {
shell.publish(on_release);
}
state.is_dragging = false;
} else {
let _ = position.and_then(locate).map(change);
shell.capture_event();
}
}
}
Event::Mouse(mouse::Event::WheelScrolled { delta })

View file

@ -255,7 +255,7 @@ where
_renderer: &Renderer,
_clipboard: &mut dyn Clipboard,
shell: &mut Shell<'_, Message>,
_viewport: &Rectangle,
viewport: &Rectangle,
) {
let state = tree.state.downcast_mut::<State>();
let is_dragging = state.is_dragging;
@ -354,6 +354,8 @@ where
}
}
Event::Mouse(mouse::Event::ButtonReleased(mouse::Button::Left))
| Event::Mouse(mouse::Event::CursorLeft)
| Event::Mouse(mouse::Event::CursorEntered)
| Event::Touch(touch::Event::FingerLifted { .. })
| Event::Touch(touch::Event::FingerLost { .. }) => {
if is_dragging {
@ -366,10 +368,20 @@ where
Event::Mouse(mouse::Event::CursorMoved { .. })
| Event::Touch(touch::Event::FingerMoved { .. }) => {
if is_dragging {
let _ =
cursor.land().position().and_then(locate).map(change);
let position = cursor.land().position();
let outside = position.is_none_or(|position| {
!viewport.contains(position)
});
shell.capture_event();
if outside {
if let Some(on_release) = self.on_release.clone() {
shell.publish(on_release);
}
state.is_dragging = false;
} else {
let _ = position.and_then(locate).map(change);
shell.capture_event();
}
}
}
Event::Mouse(mouse::Event::WheelScrolled { delta })