@@ -31,9 +31,9 @@ public class ScrollableTable implements IRenderableFrame, IClickableFrame, IKeyE
31
31
@ Override public boolean getHovered () {return false ;}
32
32
@ Override public void setHovered (boolean hovered ) {}
33
33
34
- private double horizontalScrollFactor = 1 ;
34
+ private float horizontalScrollFactor = 1 ;
35
35
private ScrollbarFrame horizontalScrollbar = null ;
36
- private double verticalScrollFactor = 1 ;
36
+ private float verticalScrollFactor = 1 ;
37
37
private ScrollbarFrame verticalScrollbar = null ;
38
38
private FormatData uniformColFormat = null ;
39
39
private FormatData uniformRowFormat = null ;
@@ -109,11 +109,11 @@ public void updateScrollbarRanges() {
109
109
FrameConfig lastConfig = getCellConfig (getAmountOfColumns () - 1 , rows .size () - 1 );
110
110
if (horizontalScrollbar != null ) {
111
111
horizontalScrollbar .setScrollbarSize (100d / lastConfig .xEnd );
112
- horizontalScrollFactor = lastConfig .xEnd / 100d ;
112
+ horizontalScrollFactor = lastConfig .xEnd / 100f ;
113
113
}
114
114
if (verticalScrollbar != null ) {
115
115
verticalScrollbar .setScrollbarSize (100d / lastConfig .yEnd );
116
- verticalScrollFactor = lastConfig .yEnd / 100d ;
116
+ verticalScrollFactor = lastConfig .yEnd / 100f ;
117
117
}
118
118
}
119
119
@@ -391,6 +391,7 @@ public void doFills(float x1, float y1, float x2, float y2, float borderPx) {
391
391
}
392
392
393
393
public void renderTableFrame (IRenderableFrame frame , float perceivedX1 , float perceivedY1 , float perceivedX2 , float perceivedY2 , int guiScale , FrameConfig frameConfig , boolean allowOutOfBounds ) {
394
+ float epsilon = 0.01f ;
394
395
float width = perceivedX2 - perceivedX1 ;
395
396
float height = perceivedY2 - perceivedY1 ;
396
397
float x1 = getPercentValue (width , frameConfig .x ) + perceivedX1 ;
@@ -403,21 +404,21 @@ public void renderTableFrame(IRenderableFrame frame, float perceivedX1, float pe
403
404
frame .drawTexts (x1 , y1 , x2 , y2 );
404
405
return ;
405
406
}
406
- double scrollViewStartX = perceivedX1 ;
407
- double scrollViewEndX = perceivedX2 ;
408
- double scrollViewStartY = perceivedY1 ;
409
- double scrollViewEndY = perceivedY2 ;
407
+ float scrollViewStartX = perceivedX1 ;
408
+ float scrollViewEndX = perceivedX2 ;
409
+ float scrollViewStartY = perceivedY1 ;
410
+ float scrollViewEndY = perceivedY2 ;
410
411
if (horizontalScrollbar != null ) {
411
412
double factor = width * horizontalScrollFactor ;
412
413
double scrollpos = horizontalScrollbar .scrollbarPos * (1 - horizontalScrollbar .getScrollbarSize ());
413
- scrollViewStartX = perceivedX1 + (factor * scrollpos );
414
- scrollViewEndX = perceivedX1 + (factor * (scrollpos + horizontalScrollbar .getScrollbarSize ()));
414
+ scrollViewStartX = ( float )( perceivedX1 + (factor * scrollpos ) );
415
+ scrollViewEndX = ( float )( perceivedX1 + (factor * (scrollpos + horizontalScrollbar .getScrollbarSize () )));
415
416
}
416
417
if (verticalScrollbar != null ) {
417
418
double factor = height * verticalScrollFactor ;
418
419
double scrollpos = verticalScrollbar .scrollbarPos * (1 - verticalScrollbar .getScrollbarSize ());
419
- scrollViewStartY = perceivedY1 + (factor * scrollpos );
420
- scrollViewEndY = perceivedY1 + (factor * (scrollpos + verticalScrollbar .getScrollbarSize ()));
420
+ scrollViewStartY = ( float )( perceivedY1 + (factor * scrollpos ) );
421
+ scrollViewEndY = ( float )( perceivedY1 + (factor * (scrollpos + verticalScrollbar .getScrollbarSize () )));
421
422
}
422
423
423
424
/*double scrollViewStartX = horizontalScrollbar.scrollbarPos * (1 - horizontalScrollbar.getScrollbarSize());
@@ -428,16 +429,16 @@ public void renderTableFrame(IRenderableFrame frame, float perceivedX1, float pe
428
429
scrollViewEndX = (scrollViewEndX * width * horizontalScrollFactor) + perceivedX1;
429
430
scrollViewStartY = (scrollViewStartY * height * verticalScrollFactor) + perceivedY1;
430
431
scrollViewEndY = (scrollViewEndY * height * verticalScrollFactor) + perceivedY1;*/
431
- if (x1 < scrollViewStartX || x2 > scrollViewEndX || y1 < scrollViewStartY || y2 > scrollViewEndY ) {
432
+ if (( x1 + epsilon ) < scrollViewStartX || ( x2 - epsilon ) > scrollViewEndX || ( y1 + epsilon ) < scrollViewStartY || ( y2 - epsilon ) > scrollViewEndY ) {
432
433
//frame would be outside of table
433
434
//System.out.println("horizscrollbarpos: "+horizontalScrollbar.scrollbarPos+" | horizscrollbarsize: "+horizontalScrollbar.getScrollbarSize()+" | horizscrollfactor: "+horizontalScrollFactor+" | vertscrollbarpos: "+verticalScrollbar.scrollbarPos+" | vertscrollbarsize: "+verticalScrollbar.getScrollbarSize()+" | vertscrollfactor: "+verticalScrollFactor+" | width: "+width+" | height: "+height);
434
435
//System.out.println("rendertableframe: "+x1+" | "+scrollViewStartX+" | "+x2+" | "+scrollViewEndX+" | "+y1+" | "+scrollViewStartY+" | "+y2+" | "+scrollViewEndY);
435
436
return ;
436
437
}
437
- x1 = (int )( x1 - scrollViewStartX + perceivedX1 );
438
- x2 = (int )( x2 - scrollViewStartX + perceivedX1 );
439
- y1 = (int )( y1 - scrollViewStartY + perceivedY1 );
440
- y2 = (int )( y2 - scrollViewStartY + perceivedY1 );
438
+ x1 = (x1 - scrollViewStartX + perceivedX1 );
439
+ x2 = (x2 - scrollViewStartX + perceivedX1 );
440
+ y1 = (y1 - scrollViewStartY + perceivedY1 );
441
+ y2 = (y2 - scrollViewStartY + perceivedY1 );
441
442
frame .doFills (x1 , y1 , x2 , y2 , frameConfig .borderThickness / guiScale );
442
443
frame .drawTexts (x1 , y1 , x2 , y2 );
443
444
}
0 commit comments