Skip to content

Commit

Permalink
Use correct cursor icons when resizing panels too wide or narrow
Browse files Browse the repository at this point in the history
  • Loading branch information
emilk committed Jul 3, 2024
1 parent 47accb0 commit c9eff7d
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions crates/egui/src/containers/panel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -310,11 +310,17 @@ impl SidePanel {

if resize_hover || is_resizing {
let cursor_icon = if width <= width_range.min {
CursorIcon::ResizeEast
match self.side {
Side::Left => CursorIcon::ResizeEast,
Side::Right => CursorIcon::ResizeWest,
}
} else if width < width_range.max {
CursorIcon::ResizeHorizontal
} else {
CursorIcon::ResizeWest
match self.side {
Side::Left => CursorIcon::ResizeWest,
Side::Right => CursorIcon::ResizeEast,
}
};
ui.ctx().set_cursor_icon(cursor_icon);
}
Expand Down Expand Up @@ -791,11 +797,17 @@ impl TopBottomPanel {

if resize_hover || is_resizing {
let cursor_icon = if height <= height_range.min {
CursorIcon::ResizeSouth
match self.side {
TopBottomSide::Top => CursorIcon::ResizeSouth,
TopBottomSide::Bottom => CursorIcon::ResizeNorth,
}
} else if height < height_range.max {
CursorIcon::ResizeVertical
} else {
CursorIcon::ResizeNorth
match self.side {
TopBottomSide::Top => CursorIcon::ResizeNorth,
TopBottomSide::Bottom => CursorIcon::ResizeSouth,
}
};
ui.ctx().set_cursor_icon(cursor_icon);
}
Expand Down

0 comments on commit c9eff7d

Please sign in to comment.