Skip to content

Commit

Permalink
Fix timeline bug
Browse files Browse the repository at this point in the history
  • Loading branch information
p-yukusai committed Jun 23, 2023
1 parent f3e4771 commit 36ccb26
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/gui/TimeLineWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,14 +92,19 @@ double TimeLineWidget::getOneFrameTime() const
QPoint TimeLineWidget::viewportTransform() const
{
// @note bug? Sometimes, the value of vertical scroll bar is different from the set value.-
return QPoint(-this->horizontalScrollBar()->value(), -this->verticalScrollBar()->value());
QPoint point = {-this->horizontalScrollBar()->value(), -this->verticalScrollBar()->value()};
// @note by yukusai: Fixed by the heresy you see below you, Qt is atrocious I swear...
if(mVerticalScrollValue!=this->verticalScrollBar()->value()){
point.setY(mVerticalScrollValue > this->verticalScrollBar()->value()? -mVerticalScrollValue: -this->verticalScrollBar()->value());
}
return point;
}

void TimeLineWidget::setScrollBarValue(const QPoint& aViewportTransform)
{
this->horizontalScrollBar()->setValue(-aViewportTransform.x());
this->verticalScrollBar()->setValue(-aViewportTransform.y());
mVerticalScrollValue = -aViewportTransform.y();
this->horizontalScrollBar()->setValue(aViewportTransform.x());
this->verticalScrollBar()->setValue(aViewportTransform.y());
mVerticalScrollValue = aViewportTransform.y();
}

void TimeLineWidget::updateCamera()
Expand Down

0 comments on commit 36ccb26

Please sign in to comment.