UI: Fix the Property Browser window scrollbar

- Scrolling with the scrollbar now works properly.

- Do not scroll with the mouse wheel while an edit field is active in
  the property browser.

Fixes: https://github.com/solvespace/solvespace/issues/782
This commit is contained in:
ruevs 2020-10-28 00:21:23 +02:00 committed by phkahler
parent 3694c9b3ee
commit 7e99ba0096

View File

@ -252,8 +252,8 @@ void TextWindow::Init() {
MouseLeave(); MouseLeave();
return true; return true;
} else if(event.type == MouseEvent::Type::SCROLL_VERT) { } else if(event.type == MouseEvent::Type::SCROLL_VERT) {
window->SetScrollbarPosition(window->GetScrollbarPosition() - ScrollbarEvent(window->GetScrollbarPosition() -
LINE_HEIGHT / 2 * event.scrollDelta); LINE_HEIGHT / 2 * event.scrollDelta);
} }
return false; return false;
}; };
@ -1130,7 +1130,7 @@ void TextWindow::MouseLeave() {
void TextWindow::ScrollbarEvent(double newPos) { void TextWindow::ScrollbarEvent(double newPos) {
if(window->IsEditorVisible()) { if(window->IsEditorVisible()) {
window->SetScrollbarPosition(scrollPos); // An edit field is active. Do not move the scrollbar.
return; return;
} }
@ -1140,6 +1140,7 @@ void TextWindow::ScrollbarEvent(double newPos) {
if(newPos != scrollPos) { if(newPos != scrollPos) {
scrollPos = (int)newPos; scrollPos = (int)newPos;
window->SetScrollbarPosition(scrollPos);
window->Invalidate(); window->Invalidate();
} }
} }