diff --git a/lib/mixins/canvas-drawer.js b/lib/mixins/canvas-drawer.js index 0913776e..ac9a520c 100644 --- a/lib/mixins/canvas-drawer.js +++ b/lib/mixins/canvas-drawer.js @@ -482,11 +482,17 @@ export default class CanvasDrawer extends Mixin { const context = this.tokensLayer.context const {width: canvasWidth} = this.tokensLayer.getSize() + if (!this.tokenLinesForScreenRows) { return } + + const screenRowsTokens = this.tokenLinesForScreenRows(firstRow, lastRow) + let y = offsetRow * lineHeight - for (let tokens of this.tokenLinesForScreenRows(firstRow, lastRow)) { + for (let i = 0; i < screenRowsTokens.length; i++) { + let tokens = screenRowsTokens[i] let x = 0 context.clearRect(x, y, canvasWidth, lineHeight) - for (let token of tokens) { + for (let j = 0; j < tokens.length; j++) { + let token = tokens[j] if (/^\s+$/.test(token.value)) { x += token.value.length * charWidth } else {