Skip to content

Commit

Permalink
Extracting a code that cause freezing
Browse files Browse the repository at this point in the history
  • Loading branch information
mate-meszaros-epam committed May 8, 2024
1 parent ca3b83f commit a0dd19b
Showing 1 changed file with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1321,6 +1321,7 @@ export class DrawingEntitiesManager {
lastPosition: _lastPosition,
maxVerticalDistance: _maxVerticalDistance,
};

while (stack.length > 0) {
const stackItem = stack.pop();
assert(stackItem);
Expand Down Expand Up @@ -1359,13 +1360,17 @@ export class DrawingEntitiesManager {
lastRearrangeResult = rearrangeResult;
}

//Macro: Switching to Sequence mode causes page freeze task.
//Without it, there is no error.
/*
if (rearrangeResult?.nextMonomer) {
stack.push({
monomer: rearrangeResult.nextMonomer,
lastPosition: rearrangeResult.lastPosition,
maxVerticalDistance: rearrangeResult.maxVerticalDistance,
});
}
*/
}

return {
Expand Down Expand Up @@ -1447,6 +1452,7 @@ export class DrawingEntitiesManager {
monomersWithSideChain,
0,
);

command.merge(rearrangeResult.command);
lastPosition = rearrangeResult.lastPosition;
// need to calculate the vertical distance before the next row gets to display
Expand All @@ -1466,6 +1472,7 @@ export class DrawingEntitiesManager {
[Peptide, Chem, Sugar, Phosphate],
currentMonomerChain,
);

if (rearrangedMonomersSet.has(monomerWithSideChain.id)) {
return;
}
Expand Down Expand Up @@ -1503,12 +1510,14 @@ export class DrawingEntitiesManager {
rearrangedMonomersSet,
lastPosition,
);

command.merge(rearrangeResult.command);

lastPosition = rearrangeResult.lastPosition;
});
}
});

return { command, lastPosition };
}

Expand Down

0 comments on commit a0dd19b

Please sign in to comment.