diff --git a/lib/minimap-element.coffee b/lib/minimap-element.coffee index 5eea87d8..6b7a58e5 100644 --- a/lib/minimap-element.coffee +++ b/lib/minimap-element.coffee @@ -120,19 +120,23 @@ class MinimapElement extends HTMLElement @visibleArea.classList.add('minimap-visible-area') @shadowRoot.appendChild(@visibleArea) + @controls = document.createElement('div') + @controls.classList.add('minimap-controls') + @shadowRoot.appendChild(@controls) + initializeScrollIndicator: -> @scrollIndicator = document.createElement('div') @scrollIndicator.classList.add 'minimap-scroll-indicator' - @shadowRoot.appendChild(@scrollIndicator) + @controls.appendChild(@scrollIndicator) disposeScrollIndicator: -> - @shadowRoot.removeChild(@scrollIndicator) + @controls.removeChild(@scrollIndicator) @scrollIndicator = undefined initializeOpenQuickSettings: -> @openQuickSettings = document.createElement('div') @openQuickSettings.classList.add 'open-minimap-quick-settings' - @shadowRoot.appendChild(@openQuickSettings) + @controls.appendChild(@openQuickSettings) @openQuickSettings.addEventListener 'click', (e) => MinimapQuickSettingsView ?= require './minimap-quick-settings-view' @@ -145,7 +149,7 @@ class MinimapElement extends HTMLElement }) disposeOpenQuickSettings: -> - @shadowRoot.removeChild(@openQuickSettings) + @controls.removeChild(@openQuickSettings) @openQuickSettings = undefined pauseDOMPolling: -> @@ -230,6 +234,8 @@ class MinimapElement extends HTMLElement @visibleArea.style.height = @minimap.getTextEditorHeight() + 'px' @transformElement @visibleArea, @makeTranslate(visibleAreaLeft, visibleAreaTop) + @controls.style.width = @canvas.width + 'px' + canvasTop = @minimap.getFirstVisibleScreenRow() * @minimap.getLineHeight() - @minimap.getMinimapScrollTop() @transformElement(@canvas, @makeTranslate(0, canvasTop)) @@ -241,11 +247,8 @@ class MinimapElement extends HTMLElement editorHeight = @getTextEditor().getHeight() indicatorHeight = editorHeight * (editorHeight / @minimap.getHeight()) indicatorScroll = (editorHeight - indicatorHeight) * @minimap.getTextEditorScrollRatio() - indicatorOffset = 0 - indicatorOffset = @marginRight if @adjustToSoftWrap - @scrollIndicator.style.height = indicatorHeight + 'px' - @transformElement @scrollIndicator, @makeTranslate(indicatorOffset, indicatorScroll) + @transformElement @scrollIndicator, @makeTranslate(0, indicatorScroll) @disposeScrollIndicator() if not @minimap.canScroll() diff --git a/spec/minimap-element-spec.coffee b/spec/minimap-element-spec.coffee index 64b95e5b..e85357bc 100644 --- a/spec/minimap-element-spec.coffee +++ b/spec/minimap-element-spec.coffee @@ -351,6 +351,15 @@ describe 'MinimapElement', -> indicator = minimapElement.shadowRoot.querySelector('.minimap-scroll-indicator') expect(realOffsetLeft(indicator)).toBeCloseTo(2, -1) + describe 'and when minimap.displayPluginsControls setting is true', -> + beforeEach -> + atom.config.set 'minimap.displayPluginsControls', true + nextAnimationFrame() + + it 'offsets the scroll indicator by the difference', -> + openQuickSettings = minimapElement.shadowRoot.querySelector('.open-minimap-quick-settings') + expect(realOffsetLeft(openQuickSettings)).toBeCloseTo(2 - openQuickSettings.offsetWidth, -1) + describe 'and then disabled', -> beforeEach -> atom.config.set 'minimap.adjustMinimapWidthToSoftWrap', false diff --git a/stylesheets/minimap.less b/stylesheets/minimap.less index aca14245..a86533a2 100644 --- a/stylesheets/minimap.less +++ b/stylesheets/minimap.less @@ -35,6 +35,11 @@ atom-text-editor::shadow, atom-text-editorĀ { cursor: -webkit-grab; } + .minimap-controls { + position: relative; + height: 100%; + } + .minimap-scroll-indicator { position: absolute; display: block;