Skip to content

Commit

Permalink
🐛 Fix broken minimap when shadowRoot isn't enabled
Browse files Browse the repository at this point in the history
  • Loading branch information
abe33 committed Dec 5, 2014
1 parent c1d6e09 commit f5f6e77
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
12 changes: 8 additions & 4 deletions lib/minimap-view.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,8 @@ class MinimapView extends View
@offsetTop = 0
@indicator = new MinimapIndicator()

@scrollView = @editorView.shadowRoot.querySelector('.scroll-view')
@scrollView = @getEditorViewRoot().querySelector('.scroll-view')

@scrollViewLines = @scrollView.querySelector('.lines')

@subscribeToEditor()
Expand Down Expand Up @@ -194,7 +195,7 @@ class MinimapView extends View
@scaleX = @scaleY = computedLineHeight / originalLineHeight

getEditorLineHeight: ->
lineHeight = window.getComputedStyle(@editorView.shadowRoot.querySelector('.lines')).getPropertyValue('line-height')
lineHeight = window.getComputedStyle(@getEditorViewRoot().querySelector('.lines')).getPropertyValue('line-height')
parseInt(lineHeight)

# Destroys this view and release all its subobjects.
Expand All @@ -220,6 +221,9 @@ class MinimapView extends View
@obsPane.dispose()
@obsPane = @pane.observeActiveItem @onActiveItemChanged

getEditorViewRoot: ->
@editorView.shadowRoot ? @editorView

# ######## #### ###### ######## ## ### ## ##
# ## ## ## ## ## ## ## ## ## ## ## ##
# ## ## ## ## ## ## ## ## ## ####
Expand Down Expand Up @@ -353,15 +357,15 @@ class MinimapView extends View
@editorView.style.paddingLeft = maxWidth
else
@editorView.style.paddingRight = maxWidth
@editorView.shadowRoot.querySelector('.vertical-scrollbar').style.right = maxWidth
@getEditorViewRoot().querySelector('.vertical-scrollbar').style.right = maxWidth

# Internal: Resets the styles modified when the minimap width is adjusted
# based on the soft-wrap.
resetMinimapWidthWithWrap: ->
@css maxWidth: ''
@editorView.style.paddingRight = ''
@editorView.style.paddingLeft = ''
@editorView.shadowRoot.querySelector('.vertical-scrollbar').style.right = ''
@getEditorViewRoot().querySelector('.vertical-scrollbar').style.right = ''

# Internal: Updates the vertical scrolling of the minimap.
#
Expand Down
2 changes: 1 addition & 1 deletion lib/mixins/dom-styles-reader.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class DOMStylesReader extends Mixin
@dummyNode = document.createElement('span')
@dummyNode.style.visibility = 'hidden'
if shadowRoot
@editorView.shadowRoot.appendChild(@dummyNode)
@minimapView.getEditorViewRoot().appendChild(@dummyNode)
else
@editorView.appendChild(@dummyNode)

Expand Down

0 comments on commit f5f6e77

Please sign in to comment.