Page MenuHome

UI: Improved "Area Close" Neighbor Selection
ClosedPublic

Authored by Harley Acheson (harley) on May 3 2021, 2:58 AM.

Details

Summary

Note that the following has nothing to do with the improved Area Join, and is only about a specific part of the new "Area Close" operator. Let me explain…

Since we are now able to join any area to any neighboring area, this has allowed us to add a “Close” operation. But since any area can be subsumed by any neighbor, we also have to choose which one. This should be able to follow a user’s intuition. Unfortunately, the current neighbor selection does not select the obvious one in some cases.

This example was pointed out by @Daniel Salazar (zanqdo) :

The above works as expected for all areas except for closing Timeline at the bottom, as it is replaced by Properties. The following illustrates why the current algorithm lets us down. Because it is only concerned with total amount of misalignment it considers "Properties" a better candidate because A is shorter than B or C.

Obviously, this is not what you would intuitively guess or want to happen. Looking at this you might guess that Timeline is about half-aligned with either 3DView, but only about a quarter aligned with Properties. This because we are comparing the ratios of the shared edges. And that is what this patch does instead of using absolute lengths.

This gives the expected result in all cases I have thrown at it. And of course this specific test case as well:

Diff Detail

Repository
rB Blender

Event Timeline

Harley Acheson (harley) requested review of this revision.May 3 2021, 2:58 AM
Harley Acheson (harley) created this revision.
Harley Acheson (harley) edited the summary of this revision. (Show Details)
Harley Acheson (harley) edited the summary of this revision. (Show Details)May 5 2021, 2:17 AM
Harley Acheson (harley) edited the summary of this revision. (Show Details)
Harley Acheson (harley) edited the summary of this revision. (Show Details)May 5 2021, 2:23 AM

Updated the original comment to correct that the area that does not close to the correct neighbor in the cited example is "Timeline" at the bottom, not "Outliner". So brain-fart correction.

This feels intuitive now and I haven't been able to find any other case that feels wrong to me. Big improvement.

This revision is now accepted and ready to land.May 9 2021, 3:14 AM

Accepting, however it would be good to have a detailed comment in the code explaining why this tends to work better.

If I stumbled on this code it wouldn't be clear why this method is significantly better than the simpler code this patch replaces.

Updated to simplify slightly and improve comments to make it easier to follow.