Commit 82b176d0 authored by Robert Knight's avatar Robert Knight

Add a note about a scenario where the thresholds will be inappropriate

This function is used to scroll to the "nearest" highlight when clicking the
top/bottom buckets in the bucket bar. This can likely be reimplemented in a
simpler way in future that doesn't rely on knowing where the buckets are
relative to the viewport. If instead we assume that all the passed-in anchors
are off-screen, we could just scroll to the top/bottom one.
parent 839d44bf
...@@ -66,6 +66,10 @@ export function findClosestOffscreenAnchor( ...@@ -66,6 +66,10 @@ export function findClosestOffscreenAnchor(
): Anchor | null { ): Anchor | null {
// Thresholds for how far away an anchor has to be from the top/bottom of // Thresholds for how far away an anchor has to be from the top/bottom of
// the viewport to be considered off-screen. // the viewport to be considered off-screen.
//
// TODO - This needs to be adapted for when a custom bucket container is
// being used. In that case these thresholds might not match where the
// above/below-screen buckets are in the viewport.
const BUCKET_TOP_THRESHOLD = 137; const BUCKET_TOP_THRESHOLD = 137;
const BUCKET_BOTTOM_THRESHOLD = 22; const BUCKET_BOTTOM_THRESHOLD = 22;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment