logic: Refactored Code View to process all contents in one update
* Use unified showCodeSnippets method for setting file information on CodeView * Made async initial file and snippet expansion synced * Add ScrollParams API to CodeView * Regard scope size when scrolling to definition * Only use QtThreadedLambdaFunctor in QtCodeView now
This commit is contained in:
@@ -58,7 +58,7 @@ void QtCodeNavigateable::ensureWidgetVisibleAnimated(
|
||||
}
|
||||
}
|
||||
|
||||
void QtCodeNavigateable::ensurePercentVisibleAnimated(double percent, bool animated, bool onTop)
|
||||
void QtCodeNavigateable::ensurePercentVisibleAnimated(double percentA, double percentB, bool animated, bool onTop)
|
||||
{
|
||||
QAbstractScrollArea* area = getScrollArea();
|
||||
if (!area)
|
||||
@@ -74,10 +74,34 @@ void QtCodeNavigateable::ensurePercentVisibleAnimated(double percent, bool anima
|
||||
return;
|
||||
}
|
||||
|
||||
int scrollHeight = totalHeight * percent;
|
||||
int scrollHeight = totalHeight * percentA;
|
||||
if (!onTop)
|
||||
{
|
||||
scrollHeight -= visibleHeight / 3;
|
||||
if (percentB)
|
||||
{
|
||||
int scrollHeightB = totalHeight * percentB;
|
||||
int rectHeight = scrollHeightB - scrollHeight;
|
||||
|
||||
if (rectHeight < visibleHeight)
|
||||
{
|
||||
if (rectHeight < visibleHeight / 2)
|
||||
{
|
||||
scrollHeight -= visibleHeight / 4;
|
||||
}
|
||||
else
|
||||
{
|
||||
scrollHeight += rectHeight / 2 - visibleHeight / 2;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
scrollHeight -= 20;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
scrollHeight -= visibleHeight / 4;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user