Fixing issue where swapping between list & grid view 'desync' the virtual cursor
This commit is contained in:
parent
4a3b95e615
commit
e774ea1774
1 changed files with 14 additions and 1 deletions
15
src/tab.rs
15
src/tab.rs
|
|
@ -2298,7 +2298,20 @@ impl Tab {
|
|||
}
|
||||
}
|
||||
Message::MouseAreaResized(_size, viewport) => {
|
||||
self.viewport_rect = Some(viewport);
|
||||
// if we have a scroll position, we want to subtract it from the viewport
|
||||
// so that we don't desync when swapping
|
||||
if let Some(scroll_pos) = self.scroll_opt {
|
||||
self.viewport_rect = Some(Rectangle {
|
||||
x: viewport.x - scroll_pos.x,
|
||||
y: viewport.y - scroll_pos.y,
|
||||
width: viewport.width,
|
||||
height: viewport.height
|
||||
});
|
||||
}
|
||||
else {
|
||||
self.viewport_rect = Some(viewport);
|
||||
}
|
||||
|
||||
}
|
||||
Message::DragEnd(_) => {
|
||||
self.clicked = None;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue