From d3edad1542195d3a627c2789107882ff39a10810 Mon Sep 17 00:00:00 2001 From: abe33 Date: Mon, 15 Dec 2014 23:55:23 +0100 Subject: [PATCH] :bug: Fix minimap redraw when scrolling down By adding an extra line to the canvas we are sure to render more than the height and have enough content to paste on the offscreen buffer --- lib/minimap-element.coffee | 11 +++++------ spec/minimap-element-spec.coffee | 2 +- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/lib/minimap-element.coffee b/lib/minimap-element.coffee index bd56c5b2..fd0ee8d9 100644 --- a/lib/minimap-element.coffee +++ b/lib/minimap-element.coffee @@ -41,13 +41,12 @@ class MinimapElement extends HTMLElement @shadowRoot.appendChild(@visibleArea) measureHeightAndWidth: -> - editorElement = @getTextEditorElement() - width = @clientWidth - height = @clientHeight + @width = @clientWidth + @height = @clientHeight - if width isnt @canvas.width or height isnt @canvas.height - @canvas.width = width * devicePixelRatio - @canvas.height = height * devicePixelRatio + if @width isnt @canvas.width or @height isnt @canvas.height + @canvas.width = @width * devicePixelRatio + @canvas.height = (@height + @minimap.getLineHeight()) * devicePixelRatio getTextEditor: -> @minimap.getTextEditor() diff --git a/spec/minimap-element-spec.coffee b/spec/minimap-element-spec.coffee index f9fa9247..59b3ee1b 100644 --- a/spec/minimap-element-spec.coffee +++ b/spec/minimap-element-spec.coffee @@ -93,7 +93,7 @@ describe 'MinimapElement', -> expect(minimapElement.offsetWidth).toBeCloseTo(editorElement.clientWidth / 10, -1) it 'resizes the canvas to fit the minimap', -> - expect(canvas.offsetHeight).toEqual(minimapElement.offsetHeight) + expect(canvas.offsetHeight).toEqual(minimapElement.offsetHeight + minimap.getLineHeight()) expect(canvas.offsetWidth).toEqual(minimapElement.offsetWidth) it 'requests an update', ->