Revert tooltip delay to Duration::ZERO
This commit is contained in:
parent
b02db5e6f8
commit
2ac62f7512
2 changed files with 9 additions and 12 deletions
|
|
@ -11,13 +11,13 @@ pub fn main() -> iced::Result {
|
||||||
#[derive(Default)]
|
#[derive(Default)]
|
||||||
struct Tooltip {
|
struct Tooltip {
|
||||||
position: Position,
|
position: Position,
|
||||||
is_immediate: bool,
|
delay: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone)]
|
#[derive(Debug, Clone)]
|
||||||
enum Message {
|
enum Message {
|
||||||
ChangePosition,
|
ChangePosition,
|
||||||
ToggleImmediate(bool),
|
ToggleDelay(bool),
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Tooltip {
|
impl Tooltip {
|
||||||
|
|
@ -34,8 +34,8 @@ impl Tooltip {
|
||||||
|
|
||||||
self.position = position;
|
self.position = position;
|
||||||
}
|
}
|
||||||
Message::ToggleImmediate(is_immediate) => {
|
Message::ToggleDelay(is_immediate) => {
|
||||||
self.is_immediate = is_immediate;
|
self.delay = is_immediate;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -48,12 +48,12 @@ impl Tooltip {
|
||||||
self.position,
|
self.position,
|
||||||
)
|
)
|
||||||
.gap(10)
|
.gap(10)
|
||||||
.delay(seconds(if self.is_immediate { 0 } else { 2 }))
|
.delay(seconds(if self.delay { 1 } else { 0 }))
|
||||||
.style(container::rounded_box);
|
.style(container::rounded_box);
|
||||||
|
|
||||||
let checkbox = checkbox(self.is_immediate)
|
let checkbox = checkbox(self.delay)
|
||||||
.label("Show immediately")
|
.label("Delay")
|
||||||
.on_toggle(Message::ToggleImmediate);
|
.on_toggle(Message::ToggleDelay);
|
||||||
|
|
||||||
center(
|
center(
|
||||||
column![tooltip, checkbox]
|
column![tooltip, checkbox]
|
||||||
|
|
|
||||||
|
|
@ -88,9 +88,6 @@ where
|
||||||
/// The default padding of a [`Tooltip`] drawn by this renderer.
|
/// The default padding of a [`Tooltip`] drawn by this renderer.
|
||||||
const DEFAULT_PADDING: f32 = 5.0;
|
const DEFAULT_PADDING: f32 = 5.0;
|
||||||
|
|
||||||
/// The default delay before a [`Tooltip`] is shown.
|
|
||||||
const DEFAULT_DELAY: Duration = Duration::from_secs(2);
|
|
||||||
|
|
||||||
/// Creates a new [`Tooltip`].
|
/// Creates a new [`Tooltip`].
|
||||||
///
|
///
|
||||||
/// [`Tooltip`]: struct.Tooltip.html
|
/// [`Tooltip`]: struct.Tooltip.html
|
||||||
|
|
@ -106,7 +103,7 @@ where
|
||||||
gap: 0.0,
|
gap: 0.0,
|
||||||
padding: Self::DEFAULT_PADDING,
|
padding: Self::DEFAULT_PADDING,
|
||||||
snap_within_viewport: true,
|
snap_within_viewport: true,
|
||||||
delay: Self::DEFAULT_DELAY,
|
delay: Duration::ZERO,
|
||||||
class: Theme::default(),
|
class: Theme::default(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue