From 8ed9aae0ee5e0dfc5aebb506b1de75b2a11a5123 Mon Sep 17 00:00:00 2001 From: abe33 Date: Tue, 10 Mar 2015 10:15:32 +0100 Subject: [PATCH] :bug: Fix missing forced update when minimap become visible again 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. --- lib/minimap-element.coffee | 6 +++++- spec/minimap-element-spec.coffee | 9 +++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/lib/minimap-element.coffee b/lib/minimap-element.coffee index f3706fab..8df431fe 100644 --- a/lib/minimap-element.coffee +++ b/lib/minimap-element.coffee @@ -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() diff --git a/spec/minimap-element-spec.coffee b/spec/minimap-element-spec.coffee index 9510b2e8..a2278936 100644 --- a/spec/minimap-element-spec.coffee +++ b/spec/minimap-element-spec.coffee @@ -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() + # ###### ###### ######## ####### ## ## # ## ## ## ## ## ## ## ## ## ## # ## ## ## ## ## ## ## ##