VirtualRenderer: Fix buggy offset
This commit is contained in:
parent
8b6ba9f702
commit
2df81fffae
1 changed files with 10 additions and 8 deletions
|
|
@ -146,7 +146,6 @@ var VirtualRenderer = function(container, theme) {
|
|||
* Triggers partial update of the text layer
|
||||
*/
|
||||
this.updateLines = function(firstRow, lastRow) {
|
||||
console.log("updateLines", firstRow, lastRow);
|
||||
if (lastRow === undefined)
|
||||
lastRow = Infinity;
|
||||
|
||||
|
|
@ -399,17 +398,20 @@ var VirtualRenderer = function(container, theme) {
|
|||
|
||||
var lineCount = Math.ceil(minHeight / this.lineHeight);
|
||||
var firstRow = Math.max(0, Math.round((this.scrollTop - offset) / this.lineHeight));
|
||||
//var lastRow = Math.max(0, Math.min(this.lines.length, firstRow + lineCount) - 1);
|
||||
var lastRow = firstRow + lineCount - 1;
|
||||
var lastRow = firstRow + lineCount;
|
||||
|
||||
// Add support for wrapped lines.
|
||||
// Map lines on the screen to lines in the document.
|
||||
var firstRowScreen, firstRowHeight;
|
||||
var lineHeight = { lineHeight: this.lineHeight };
|
||||
firstRow = this.doc.screenToDocumentRow(firstRow);
|
||||
var firstRowScreen = this.doc.documentToScreenRow(firstRow);
|
||||
lastRow = Math.min(this.doc.screenToDocumentRow(lastRow), this.doc.lines.length - 1);
|
||||
offset = this.scrollTop % this.doc.getRowHeight(lineHeight, firstRow);
|
||||
console.log("renderer.computeLayerConfig", firstRow, lastRow);
|
||||
firstRowScreen = this.doc.documentToScreenRow(firstRow);
|
||||
firstRowHeight = this.doc.getRowHeight(lineHeight, firstRow);
|
||||
|
||||
lastRow = Math.min(this.doc.screenToDocumentRow(lastRow), this.doc.lines.length - 1);
|
||||
minHeight = this.$size.scrollerHeight + this.doc.getRowHeight(lineHeight, lastRow)+
|
||||
firstRowHeight;
|
||||
|
||||
offset = this.scrollTop - firstRowScreen * this.lineHeight;
|
||||
|
||||
var layerConfig = this.layerConfig = {
|
||||
width : longestLine,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue