Skip to content
Snippets Groups Projects
Commit c1005b95 authored by mcmlxxix's avatar mcmlxxix
Browse files

fix 0 index scrollbar display

parent 5802b8b1
No related branches found
No related tags found
No related merge requests found
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
function Scrollbar(x,y,length,orientation,color) function Scrollbar(x,y,length,orientation,color)
{ {
this.index; this.index;
this.bar;
this.x=x; this.x=x;
this.y=y; this.y=y;
this.orientation=orientation; this.orientation=orientation;
...@@ -16,14 +17,14 @@ function Scrollbar(x,y,length,orientation,color) ...@@ -16,14 +17,14 @@ function Scrollbar(x,y,length,orientation,color)
{ {
if(index>range) if(index>range)
return; return;
if(!index || !range) { if((isNaN(index) || isNaN(range)) &&
if(!this.index && !this.bar) (!this.index || !this.bar))
return;
}
else if(isNaN(index) || isNaN(range))
return; return;
this.index=Math.ceil(((index+1)/range)*this.length); this.index=Math.ceil(((index+1)/range)*this.length);
this.bar=Math.ceil((this.length/range)*this.length); this.bar=Math.ceil((this.length/range)*this.length);
if(this.orientation == "vertical") if(this.orientation == "vertical")
this.drawVert(this.index,this.index+this.bar); this.drawVert(this.index,this.index+this.bar);
else else
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment