Skip to content

Commit

Permalink
🐛 Fix missing canvas scaling without smooth scrolling
Browse files Browse the repository at this point in the history
Fixes #480
  • Loading branch information
abe33 committed May 6, 2016
1 parent 95172cd commit bff59ea
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions lib/minimap-element.js
Original file line number Diff line number Diff line change
Expand Up @@ -795,21 +795,26 @@ export default class MinimapElement {

let canvasTop = minimap.getFirstVisibleScreenRow() * minimap.getLineHeight() - minimap.getScrollTop()

let canvasTransform = this.makeTranslate(0, canvasTop)
if (devicePixelRatio !== 1) {
canvasTransform += ' ' + this.makeScale(1 / devicePixelRatio)
}

if (this.smoothScrolling) {
if (SPEC_MODE) {
this.applyStyles(this.backLayer.canvas, {top: canvasTop + 'px'})
this.applyStyles(this.tokensLayer.canvas, {top: canvasTop + 'px'})
this.applyStyles(this.frontLayer.canvas, {top: canvasTop + 'px'})
} else {
let canvasTransform = this.makeTranslate(0, canvasTop)
if (devicePixelRatio !== 1) {
canvasTransform += ' ' + this.makeScale(1 / devicePixelRatio)
}
this.applyStyles(this.backLayer.canvas, {transform: canvasTransform})
this.applyStyles(this.tokensLayer.canvas, {transform: canvasTransform})
this.applyStyles(this.frontLayer.canvas, {transform: canvasTransform})
}
} else {
const canvasTransform = this.makeScale(1 / devicePixelRatio)
this.applyStyles(this.backLayer.canvas, {transform: canvasTransform})
this.applyStyles(this.tokensLayer.canvas, {transform: canvasTransform})
this.applyStyles(this.frontLayer.canvas, {transform: canvasTransform})
}

if (this.minimapScrollIndicator && minimap.canScroll() && !this.scrollIndicator) {
Expand Down

0 comments on commit bff59ea

Please sign in to comment.