diff options
| author | Stephen Blott | 2016-09-25 11:56:56 +0100 |
|---|---|---|
| committer | Stephen Blott | 2016-09-25 11:56:56 +0100 |
| commit | f691391539ddaa2725e9e7f6eeb29bbafcf40eed (patch) | |
| tree | c7ae70cbb8fcba9d021548a9ada84293ee1fdcba | |
| parent | 19e1178b16fd27882c7834d66ad6597847e6baff (diff) | |
| download | vimium-f691391539ddaa2725e9e7f6eeb29bbafcf40eed.tar.bz2 | |
Hint rotation, tweaks for readability.
| -rw-r--r-- | content_scripts/link_hints.coffee | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/content_scripts/link_hints.coffee b/content_scripts/link_hints.coffee index 77235ef5..751aa12c 100644 --- a/content_scripts/link_hints.coffee +++ b/content_scripts/link_hints.coffee @@ -201,7 +201,8 @@ class LinkHintsMode # Creates a link marker for the given link. # createMarkerFor: do -> - # This generates z-index values which are greater than all of the other z-index values used by Vimium. + # This is the starting z-index value; it produces z-index values which are greater than all of the other + # z-index values used by Vimium. baseZIndex = 2140000000 (desc) -> @@ -342,16 +343,18 @@ class LinkHintsMode stackForThisMarker = null stacks = for stack in stacks - if markerOverlapsStack marker, stack - if stackForThisMarker? - # Merge stack into stackForThisMarker and discard stack. - stackForThisMarker.push stack... - continue - else - stack.push marker - stackForThisMarker = stack + markerOverlapsThisStack = markerOverlapsStack marker, stack + if markerOverlapsThisStack and not stackForThisMarker? + # We've found an existing stack for this marker. + stack.push marker + stackForThisMarker = stack + else if markerOverlapsThisStack and stackForThisMarker? + # This marker overlaps a second (or subsequent) stack; merge that stack into stackForThisMarker + # and discard it. + stackForThisMarker.push stack... + continue # Discard this stack. else - stack + stack # Keep this stack. stacks.push [marker] unless stackForThisMarker? # Rotate the z-indexes within each stack. |
