Minor updates to Qt branches view.

This commit is contained in:
mjbudd77 2021-12-31 05:22:04 -05:00
parent 90a7dd9a0d
commit bb6f149e4d
1 changed files with 7 additions and 3 deletions

View File

@ -228,16 +228,20 @@ void BRANCHES::resetVars()
void BRANCHES::update() void BRANCHES::update()
{ {
clock_t currentTime;
if (mustRecalculateBranchesTree) if (mustRecalculateBranchesTree)
{ {
recalculateBranchesTree(); recalculateBranchesTree();
} }
currentTime = clock();
// once per 40 milliseconds update branches_bitmap // once per 40 milliseconds update branches_bitmap
if (clock() > nextAnimationTime) if (currentTime > nextAnimationTime)
{ {
// animate branches_bitmap // animate branches_bitmap
nextAnimationTime = clock() + BRANCHES_ANIMATION_TICK; nextAnimationTime = currentTime + BRANCHES_ANIMATION_TICK;
currentAnimationFrame = (currentAnimationFrame + 1) % BRANCHES_ANIMATION_FRAMES; currentAnimationFrame = (currentAnimationFrame + 1) % BRANCHES_ANIMATION_FRAMES;
if (bookmarks->editMode == EDIT_MODE_BRANCHES) if (bookmarks->editMode == EDIT_MODE_BRANCHES)
{ {
@ -1435,7 +1439,7 @@ void BRANCHES::recalculateBranchesTree()
if (BranchesLevels.size()-1 > 0) if (BranchesLevels.size()-1 > 0)
{ {
//grid_width = BRANCHES_CANVAS_WIDTH / (BranchesLevels.size()-1); //grid_width = BRANCHES_CANVAS_WIDTH / (BranchesLevels.size()-1);
grid_width = width() / (BranchesLevels.size()); grid_width = width() / (BranchesLevels.size()+1);
//if (grid_width < BRANCHES_GRID_MIN_WIDTH) //if (grid_width < BRANCHES_GRID_MIN_WIDTH)
//{ //{
// grid_width = BRANCHES_GRID_MIN_WIDTH; // grid_width = BRANCHES_GRID_MIN_WIDTH;