From 0fa960858758a66ca98b646211f825e70fe5ca9b Mon Sep 17 00:00:00 2001 From: vezwork Date: Fri, 20 May 2022 07:27:25 -0400 Subject: [PATCH] docs: add comment about topSoFar --- .../studio/src/panels/SequenceEditorPanel/layout/tree.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/theatre/studio/src/panels/SequenceEditorPanel/layout/tree.ts b/theatre/studio/src/panels/SequenceEditorPanel/layout/tree.ts index d5b9e78..978ae06 100644 --- a/theatre/studio/src/panels/SequenceEditorPanel/layout/tree.ts +++ b/theatre/studio/src/panels/SequenceEditorPanel/layout/tree.ts @@ -131,7 +131,9 @@ export const calculateSequenceEditorTree = ( } arrayOfChildren.push(row) nSoFar += 1 - topSoFar += HEIGHT_OF_ANY_TITLE + // As we add rows to the tree, top to bottom, we accumulate the pixel + // distance to the top of the tree from the bottom of the current row: + topSoFar += row.nodeHeight if (!isCollapsed) { addProps( sheetObject, @@ -235,7 +237,7 @@ export const calculateSequenceEditorTree = ( n: nSoFar, } arrayOfChildren.push(row) - topSoFar += HEIGHT_OF_ANY_TITLE + topSoFar += row.nodeHeight if (!isCollapsed) { nSoFar += 1 @@ -275,7 +277,7 @@ export const calculateSequenceEditorTree = ( } arrayOfChildren.push(row) nSoFar += 1 - topSoFar += HEIGHT_OF_ANY_TITLE + topSoFar += row.nodeHeight } return tree