Be more picky about anchor nodes #981
Draft
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The problem in #972 is that we choose the anchor node primarily on a node's bounding box. In a "balanced" tree, the bounding box for one below "Animals" covers most of the insect kingdom, so we don't bother considering any nodes below as an anchor node. Eventually this is too far away and everything goes wrong:
OZtree/OZprivate/rawJS/OZTreeModule/src/position_helper.js
Line 385 in 42ffe51
As well as a traditional heap of tidy-up (EDIT: Merged in #982), a4be6ed fixes this by insisting on gvar (bounding box on screen) and a tighter range of rvar (node zoom). This fixes the initial issue, as the bounding box now follows you down, but the flight back from "Elephant Hawk-Moth" to "Elephant Seal" is very broken. I suspect this is an unrelated issue, and flight code that hasn't been used before not doing the right thing.
If you want to play with the cut-off @jrosindell / @jaredkhan, 9ec50a4 stashes the anchor node away so you can do things like this in the JS console:
... and watch the anchor node move about as you go.
If I get a chance tomorrow I'll see if I can figure out what's up with the flight.