Skip to content

Commit

Permalink
🐛 Fix minimap canvas scaling when device pixel ratio > 1
Browse files Browse the repository at this point in the history
Fixes #192
  • Loading branch information
abe33 committed Jan 6, 2015
1 parent 83830ca commit 8c066ee
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
11 changes: 9 additions & 2 deletions lib/minimap-element.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -262,8 +262,9 @@ class MinimapElement extends HTMLElement

canvasTop = @minimap.getFirstVisibleScreenRow() * @minimap.getLineHeight() - @minimap.getMinimapScrollTop()

@applyStyles @canvas,
transform: @makeTranslate(0, canvasTop)
canvasTransform = @makeTranslate(0, canvasTop)
canvasTransform += " " + @makeScale(1/devicePixelRatio) if devicePixelRatio isnt 1
@applyStyles @canvas, transform: canvasTransform

if @minimapScrollIndicator and @minimap.canScroll() and not @scrollIndicator
@initializeScrollIndicator()
Expand Down Expand Up @@ -405,6 +406,12 @@ class MinimapElement extends HTMLElement
else
"translate(#{x}px, #{y}px)"

makeScale: (x=0,y=x) ->
if @useHardwareAcceleration
"scale3d(#{x}, #{y}, 1)"
else
"scale(#{x}, #{y})"

# ######## ## ######## ## ## ######## ## ## ########
# ## ## ## ### ### ## ### ## ##
# ## ## ## #### #### ## #### ## ##
Expand Down
1 change: 1 addition & 0 deletions stylesheets/minimap.less
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ atom-text-editor::shadow, atom-text-editor {
position: absolute;
top: 0;
left: 0;
transform-origin: 0 0;
}

.minimap-visible-area {
Expand Down

0 comments on commit 8c066ee

Please sign in to comment.