@@ -138,7 +138,7 @@ export default class CanvasDrawer extends Mixin {
138138
139139 const decorations = this . minimap . decorationsByTypeThenRows ( firstRow , lastRow )
140140
141- let renderData = {
141+ const renderData = {
142142 context : this . backLayer . context ,
143143 canvasWidth,
144144 canvasHeight,
@@ -149,7 +149,10 @@ export default class CanvasDrawer extends Mixin {
149149 }
150150
151151 this . updateBackDecorationsLayer ( firstRow , lastRow , renderData , lineHeight , editorElement , decorations )
152- this . updateFrontDecorationsLayer ( firstRow , lastRow , lineHeight , charHeight , charWidth , canvasWidth , canvasHeight , editorElement , decorations )
152+
153+ renderData . context = this . frontLayer . context
154+
155+ this . updateFrontDecorationsLayer ( firstRow , lastRow , renderData , lineHeight , editorElement , decorations )
153156
154157 this . pendingChanges = [ ]
155158 this . pendingBackDecorationChanges = [ ]
@@ -285,16 +288,13 @@ export default class CanvasDrawer extends Mixin {
285288 * @param {number } firstRow firstRow the first row of the range to update
286289 * @param {number } lastRow lastRow the last row of the range to update
287290 *
291+ * @param {Object } renderData
288292 * @param {number } lineHeight this.minimap.getLineHeight() * devicePixelRatio
289- * @param {number } charHeight this.minimap.getCharHeight() * devicePixelRatio
290- * @param {number } charWidth this.minimap.getCharWidth() * devicePixelRatio
291- * @param {number } canvasWidth this.tokensLayer.getSize().width
292- * @param {number } canvasHeight this.tokensLayer.getSize().height
293293 * @param {TextEditorElement } editorElement this.minimap.getTextEditorElement()
294294 * @param {Array<Decoration> } decorations
295295 * @access private
296296 */
297- updateFrontDecorationsLayer ( firstRow , lastRow , lineHeight , charHeight , charWidth , canvasWidth , canvasHeight , editorElement , decorations ) {
297+ updateFrontDecorationsLayer ( firstRow , lastRow , renderData , lineHeight , editorElement , decorations ) {
298298 const intactRanges = computeIntactRanges ( firstRow , lastRow , this . pendingFrontDecorationChanges , this . offscreenFirstRow , this . offscreenLastRow )
299299
300300 // NOTE: this method is the hot function of Minimap. Do not refactor. The code is inlined delibarately.
@@ -304,7 +304,7 @@ export default class CanvasDrawer extends Mixin {
304304 this . frontLayer . clearCanvas ( )
305305
306306 if ( intactRanges . length === 0 ) {
307- this . drawFrontDecorationsForLines ( firstRow , lastRow , 0 , lineHeight , charHeight , charWidth , canvasWidth , canvasHeight , editorElement , decorations )
307+ this . drawFrontDecorationsForLines ( firstRow , lastRow , 0 , renderData , lineHeight , editorElement , decorations )
308308 } else {
309309 for ( let j = 0 , len = intactRanges . length ; j < len ; j ++ ) {
310310 const intact = intactRanges [ j ]
@@ -320,12 +320,12 @@ export default class CanvasDrawer extends Mixin {
320320 for ( let i = 0 , len = intactRanges . length ; i < len ; i ++ ) {
321321 const range = intactRanges [ i ]
322322
323- this . drawFrontDecorationsForLines ( currentRow , range . start , currentRow - firstRow , lineHeight , charHeight , charWidth , canvasWidth , canvasHeight , editorElement , decorations )
323+ this . drawFrontDecorationsForLines ( currentRow , range . start , currentRow - firstRow , renderData , lineHeight , editorElement , decorations )
324324
325325 currentRow = range . end
326326 }
327327 if ( currentRow <= lastRow ) {
328- this . drawFrontDecorationsForLines ( currentRow , lastRow , currentRow - firstRow , lineHeight , charHeight , charWidth , canvasWidth , canvasHeight , editorElement , decorations )
328+ this . drawFrontDecorationsForLines ( currentRow , lastRow , currentRow - firstRow , renderData , lineHeight , editorElement , decorations )
329329 }
330330 }
331331
@@ -514,16 +514,13 @@ export default class CanvasDrawer extends Mixin {
514514 * @param {number } offsetRow the relative offset to apply to rows when
515515 * rendering them
516516 *
517+ * @param {Object } renderData
517518 * @param {number } lineHeight this.minimap.getLineHeight() * devicePixelRatio
518- * @param {number } charHeight this.minimap.getCharHeight() * devicePixelRatio
519- * @param {number } charWidth this.minimap.getCharWidth() * devicePixelRatio
520- * @param {number } canvasWidth this.tokensLayer.getSize().width
521- * @param {number } canvasHeight this.tokensLayer.getSize().height
522519 * @param {TextEditorElement } editorElement this.minimap.getTextEditorElement()
523520 * @param {Array<Decoration> } decorations
524521 * @access private
525522 */
526- drawFrontDecorationsForLines ( firstRow , lastRow , offsetRow , lineHeight , charHeight , charWidth , canvasWidth , canvasHeight , editorElement , decorations ) {
523+ drawFrontDecorationsForLines ( firstRow , lastRow , offsetRow , renderData , lineHeight , editorElement , decorations ) {
527524 if ( firstRow > lastRow ) { return }
528525
529526 const drawCustomDecorationLambda = ( decoration , data , decorationColor ) => drawCustomDecoration ( decoration , data , decorationColor , editorElement )
0 commit comments