Skip to content

Commit

Permalink
🐛 Fix missing forced update when minimap become visible again
Browse files Browse the repository at this point in the history
If decorations were removed (as with git-diff after committing changes)
for a hidden minimap, displaying the minimap again will still display
previously rendered decorations as no update is required on display
changes.
  • Loading branch information
abe33 committed Mar 10, 2015
1 parent fba2aa2 commit 8ed9aae
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/minimap-element.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,11 @@ class MinimapElement extends HTMLElement
@requestForcedUpdate() if @attached

pollDOM: ->
@measureHeightAndWidth(false) if @isVisible()
if @isVisible()
@requestForcedUpdate() unless !@wasVisible

@measureHeightAndWidth(false)


checkForVisibilityChange: ->
if @isVisible()
Expand Down
9 changes: 9 additions & 0 deletions spec/minimap-element-spec.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,15 @@ describe 'MinimapElement', ->
expect(minimapElement.canvas.width).toEqual(canvasWidth)
expect(minimapElement.canvas.height).toEqual(canvasHeight)

describe 'from hidden to visible', ->
beforeEach ->
spyOn(minimapElement, 'requestForcedUpdate')
editorElement.style.display = ''
minimapElement.pollDOM()

it 'requests an update of the whole minimap', ->
expect(minimapElement.requestForcedUpdate).toHaveBeenCalled()

# ###### ###### ######## ####### ## ##
# ## ## ## ## ## ## ## ## ## ##
# ## ## ## ## ## ## ## ##
Expand Down

0 comments on commit 8ed9aae

Please sign in to comment.