Skip to content

Commit

Permalink
fixed annotation list scroll position resetting when selecting an ann…
Browse files Browse the repository at this point in the history
…otation
  • Loading branch information
chrisj committed Sep 25, 2023
1 parent 33eb6f3 commit 974cd1a
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/neuroglancer/ui/annotations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -562,8 +562,12 @@ export class AnnotationLayerView extends Tab {
}
const oldLength = this.virtualListSource.length;
this.updateListLength();
// TODO, what problems does this change cause?
const insertCount = Math.max(0, listElements.length - oldLength);
const deleteCount = Math.max(0, oldLength - listElements.length);
const retainCount = Math.min(listElements.length, oldLength);
this.virtualListSource.changed!.dispatch(
[{retainCount: 0, deleteCount: oldLength, insertCount: listElements.length}]);
[{retainCount, deleteCount, insertCount}]);
this.mutableControls.style.display = isMutable ? 'contents' : 'none';
this.resetOnUpdate();
}
Expand Down

0 comments on commit 974cd1a

Please sign in to comment.