fix viewport calculation
This commit is contained in:
parent
03d5b56989
commit
1197583582
2 changed files with 3 additions and 3 deletions
|
|
@ -8,7 +8,7 @@ function GutterLayer(parentEl)
|
||||||
GutterLayer.prototype.update = function(config)
|
GutterLayer.prototype.update = function(config)
|
||||||
{
|
{
|
||||||
var html = [];
|
var html = [];
|
||||||
for (var i=config.firstRow; i<config.lastRow; i++)
|
for (var i=config.firstRow; i<=config.lastRow; i++)
|
||||||
{
|
{
|
||||||
html.push(
|
html.push(
|
||||||
"<div class='gutter-cell' style='height:" + config.lineHeight + "px;'>",
|
"<div class='gutter-cell' style='height:" + config.lineHeight + "px;'>",
|
||||||
|
|
|
||||||
|
|
@ -88,7 +88,7 @@ VirtualRenderer.prototype.draw = function()
|
||||||
|
|
||||||
var lineCount = Math.ceil(minHeight / this.lineHeight);
|
var lineCount = Math.ceil(minHeight / this.lineHeight);
|
||||||
var firstRow = Math.round((this.scrollTop - offset) / this.lineHeight);
|
var firstRow = Math.round((this.scrollTop - offset) / this.lineHeight);
|
||||||
var lastRow = Math.min(lines.length, firstRow+lineCount);
|
var lastRow = Math.min(lines.length, firstRow+lineCount)-1;
|
||||||
|
|
||||||
var layerConfig = this.layerConfig = {
|
var layerConfig = this.layerConfig = {
|
||||||
width: longestLine,
|
width: longestLine,
|
||||||
|
|
@ -97,7 +97,7 @@ VirtualRenderer.prototype.draw = function()
|
||||||
lineHeight: this.lineHeight,
|
lineHeight: this.lineHeight,
|
||||||
characterWidth: this.characterWidth
|
characterWidth: this.characterWidth
|
||||||
};
|
};
|
||||||
|
|
||||||
for (var i=0; i < this.layers.length; i++)
|
for (var i=0; i < this.layers.length; i++)
|
||||||
{
|
{
|
||||||
var layer = this.layers[i];
|
var layer = this.layers[i];
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue