Better mouse cursors selection on tabs and tab close areas
This commit is contained in:
1 parent
403cdf8174
commit
a85c57c8e7
1 file changed
+20
-17
+20
-17
@@ -8049,24 +8049,20 @@ fn tab_view(
|
||||
let inactive_bg = colors[ColorOption::SidebarBackground.index()];
|
||||
let outline = colors[ColorOption::ActiveTabOutline.index()];
|
||||
|
||||
let title_button = button(
|
||||
container(text(fit_title(&title)).size(15))
|
||||
.width(Length::Fill)
|
||||
.align_x(Alignment::Center),
|
||||
)
|
||||
.on_press(Message::SelectTab(window, tab))
|
||||
.padding(padding)
|
||||
.width(Length::Fill)
|
||||
.clip(true)
|
||||
.style(move |theme, status| {
|
||||
let mut style = button::text(theme, status);
|
||||
style.text_color = if active {
|
||||
let title_color = if active {
|
||||
text_color
|
||||
} else {
|
||||
text_color.scale_alpha(0.6)
|
||||
};
|
||||
style
|
||||
});
|
||||
|
||||
let title_button = mouse_area(
|
||||
container(text(fit_title(&title)).size(15).color(title_color))
|
||||
.width(Length::Fill)
|
||||
.padding(padding)
|
||||
.clip(true)
|
||||
.align_x(Alignment::Center),
|
||||
)
|
||||
.on_press(Message::SelectTab(window, tab));
|
||||
|
||||
let close_icon = |padding: Padding| {
|
||||
button(text("×").size(15))
|
||||
@@ -8198,6 +8194,7 @@ fn drag_ghost(
|
||||
});
|
||||
|
||||
Some(
|
||||
mouse_area(
|
||||
container(ghost)
|
||||
.width(Length::Fill)
|
||||
.height(Length::Fill)
|
||||
@@ -8208,7 +8205,9 @@ fn drag_ghost(
|
||||
left: x,
|
||||
right: 0.0,
|
||||
bottom: 0.0,
|
||||
})
|
||||
}),
|
||||
)
|
||||
.interaction(mouse::Interaction::Grabbing)
|
||||
.into(),
|
||||
)
|
||||
}
|
||||
@@ -11900,9 +11899,13 @@ impl canvas::Program<Message> for TerminalCanvas<'_> {
|
||||
fn mouse_interaction(
|
||||
&self,
|
||||
dragging: &Self::State,
|
||||
_bounds: Rectangle,
|
||||
_cursor: mouse::Cursor,
|
||||
bounds: Rectangle,
|
||||
cursor: mouse::Cursor,
|
||||
) -> mouse::Interaction {
|
||||
if !cursor.is_over(bounds) {
|
||||
return mouse::Interaction::None;
|
||||
}
|
||||
|
||||
if *dragging {
|
||||
mouse::Interaction::Grabbing
|
||||
} else {
|
||||
|
||||
Reference in new issue
Block a user