Skip to content

Commit

Permalink
🐛 Fix visibility changes not properly watched when a tab become active
Browse files Browse the repository at this point in the history
  • Loading branch information
abe33 committed Aug 3, 2015
1 parent e82b1ae commit 806dd4b
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/minimap-element.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -384,10 +384,11 @@ class MinimapElement extends HTMLElement

# Internal: Polling callback used to detect visibility and size changes.
pollDOM: ->
visibilityChanged = @checkForVisibilityChange()
if @isVisible()
@requestForcedUpdate() unless @wasVisible

@measureHeightAndWidth(false)
@measureHeightAndWidth(visibilityChanged, false)

# Internal: A method that checks for visibility changes in the
# {MinimapElement}. The method returns `true` when the visibility changed
Expand All @@ -412,9 +413,8 @@ class MinimapElement extends HTMLElement
#
# forceUpdate - A {Boolean} that forces the update even when no changes were
# detected.
measureHeightAndWidth: (forceUpdate=true) ->
measureHeightAndWidth: (visibilityChanged, forceUpdate=true) ->
wasResized = @width isnt @clientWidth or @height isnt @clientHeight
visibilityChanged = @checkForVisibilityChange()

@height = @clientHeight
@width = @clientWidth
Expand Down

0 comments on commit 806dd4b

Please sign in to comment.