@@ -160,7 +160,7 @@ export default class CanvasDrawer extends Mixin {
160160
161161 renderData . context = this . frontLayer . context
162162
163- this . updateFrontDecorationsLayer ( firstRow , lastRow , renderData , lineHeight , editorElement , decorations )
163+ updateFrontDecorationsLayer ( this . frontLayer , firstRow , lastRow , this . offscreenFirstRow , this . offscreenLastRow , this . pendingFrontDecorationChanges , renderData , lineHeight , editorElement , decorations )
164164
165165 this . pendingChanges = [ ]
166166 this . pendingBackDecorationChanges = [ ]
@@ -180,58 +180,6 @@ export default class CanvasDrawer extends Mixin {
180180 this . offscreenLastRow = lastRow
181181 }
182182
183- /**
184- * Performs an update of the front decorations layer using the pending front
185- * decorations changes arrays.
186- *
187- * @param {number } firstRow firstRow the first row of the range to update
188- * @param {number } lastRow lastRow the last row of the range to update
189- *
190- * @param {Object } renderData
191- * @param {number } lineHeight this.minimap.getLineHeight() * devicePixelRatio
192- * @param {TextEditorElement } editorElement this.minimap.getTextEditorElement()
193- * @param {Array<Decoration> } decorations
194- * @access private
195- */
196- updateFrontDecorationsLayer ( firstRow , lastRow , renderData , lineHeight , editorElement , decorations ) {
197- const intactRanges = computeIntactRanges ( firstRow , lastRow , this . pendingFrontDecorationChanges , this . offscreenFirstRow , this . offscreenLastRow )
198-
199- // NOTE: this method is the hot function of Minimap. Do not refactor. The code is inlined delibarately.
200-
201- // redrawRangesOnLayer
202-
203- this . frontLayer . clearCanvas ( )
204-
205- if ( intactRanges . length === 0 ) {
206- drawFrontDecorationsForLines ( firstRow , lastRow , 0 , renderData , lineHeight , editorElement , decorations )
207- } else {
208- for ( let j = 0 , len = intactRanges . length ; j < len ; j ++ ) {
209- const intact = intactRanges [ j ]
210-
211- this . frontLayer . copyPartFromOffscreen (
212- intact . offscreenRow * lineHeight ,
213- ( intact . start - firstRow ) * lineHeight ,
214- ( intact . end - intact . start ) * lineHeight
215- )
216- }
217- // drawLinesForRanges
218- let currentRow = firstRow
219- for ( let i = 0 , len = intactRanges . length ; i < len ; i ++ ) {
220- const range = intactRanges [ i ]
221-
222- drawFrontDecorationsForLines ( currentRow , range . start , currentRow - firstRow , renderData , lineHeight , editorElement , decorations )
223-
224- currentRow = range . end
225- }
226- if ( currentRow <= lastRow ) {
227- drawFrontDecorationsForLines ( currentRow , lastRow , currentRow - firstRow , renderData , lineHeight , editorElement , decorations )
228- }
229- }
230-
231- this . frontLayer . resetOffscreenSize ( )
232- this . frontLayer . copyToOffscreen ( )
233- }
234-
235183 // ######## ######## ### ## ##
236184 // ## ## ## ## ## ## ## ## ##
237185 // ## ## ## ## ## ## ## ## ##
@@ -424,6 +372,62 @@ function updateBackDecorationsLayer (backLayer, firstRow, lastRow, offscreenFirs
424372 backLayer . copyToOffscreen ( )
425373}
426374
375+ /**
376+ * Performs an update of the front decorations layer using the pending front
377+ * decorations changes arrays.
378+ *
379+ * @param {CanvasLayer } frontLayer
380+ * @param {number } firstRow firstRow the first row of the range to update
381+ * @param {number } lastRow lastRow the last row of the range to update
382+ *
383+ * @param {number } offscreenFirstRow
384+ * @param {number } offscreenLastRow
385+ * @param {Array<> } pendingFrontDecorationChanges
386+ * @param {Object } renderData
387+ * @param {number } lineHeight this.minimap.getLineHeight() * devicePixelRatio
388+ * @param {TextEditorElement } editorElement this.minimap.getTextEditorElement()
389+ * @param {Array<Decoration> } decorations
390+ * @access private
391+ */
392+ function updateFrontDecorationsLayer ( frontLayer , firstRow , lastRow , offscreenFirstRow , offscreenLastRow , pendingFrontDecorationChanges , renderData , lineHeight , editorElement , decorations ) {
393+ const intactRanges = computeIntactRanges ( firstRow , lastRow , pendingFrontDecorationChanges , offscreenFirstRow , offscreenLastRow )
394+
395+ // NOTE: this method is the hot function of Minimap. Do not refactor. The code is inlined delibarately.
396+
397+ // redrawRangesOnLayer
398+
399+ frontLayer . clearCanvas ( )
400+
401+ if ( intactRanges . length === 0 ) {
402+ drawFrontDecorationsForLines ( firstRow , lastRow , 0 , renderData , lineHeight , editorElement , decorations )
403+ } else {
404+ for ( let j = 0 , len = intactRanges . length ; j < len ; j ++ ) {
405+ const intact = intactRanges [ j ]
406+
407+ frontLayer . copyPartFromOffscreen (
408+ intact . offscreenRow * lineHeight ,
409+ ( intact . start - firstRow ) * lineHeight ,
410+ ( intact . end - intact . start ) * lineHeight
411+ )
412+ }
413+ // drawLinesForRanges
414+ let currentRow = firstRow
415+ for ( let i = 0 , len = intactRanges . length ; i < len ; i ++ ) {
416+ const range = intactRanges [ i ]
417+
418+ drawFrontDecorationsForLines ( currentRow , range . start , currentRow - firstRow , renderData , lineHeight , editorElement , decorations )
419+
420+ currentRow = range . end
421+ }
422+ if ( currentRow <= lastRow ) {
423+ drawFrontDecorationsForLines ( currentRow , lastRow , currentRow - firstRow , renderData , lineHeight , editorElement , decorations )
424+ }
425+ }
426+
427+ frontLayer . resetOffscreenSize ( )
428+ frontLayer . copyToOffscreen ( )
429+ }
430+
427431const whitespaceTokenRegex = / ^ \s + $ /
428432const oneOrMoreWhiteSpaceRegexp = / \s + /
429433
0 commit comments