ScrollBar: fixed left/top arrow icon location (if visible) (issue #329)

(tested using FlatPaintingTest)
This commit is contained in:
Karl Tauber
2021-06-30 17:55:26 +02:00
parent 98b156bdde
commit 5318d5fa8e
2 changed files with 5 additions and 2 deletions

View File

@@ -17,6 +17,7 @@ FlatLaf Change Log
- Fixed white lines at bottom and right side of window (in dark themes on HiDPI
screens with scaling enabled).
- ScrollBar: Fixed left/top arrow icon location (if visible). (issue #329)
- ToolTip: Fixed positioning of huge tooltips. (issue #333)

View File

@@ -679,8 +679,10 @@ public class FlatUIUtils
int extra = chevron ? 1 : 0;
// compute arrow location
int ax = x + Math.round( ((width - (aw + extra)) / 2f) + UIScale.scale( (float) xOffset ) );
int ay = y + Math.round( ((height - (ah + extra)) / 2f) + UIScale.scale( (float) yOffset ) );
float ox = ((width - (aw + extra)) / 2f) + UIScale.scale( (float) xOffset );
float oy = ((height - (ah + extra)) / 2f) + UIScale.scale( (float) yOffset );
int ax = x + ((direction == SwingConstants.WEST) ? -Math.round( -ox ) : Math.round( ox ));
int ay = y + ((direction == SwingConstants.NORTH) ? -Math.round( -oy ) : Math.round( oy ));
// paint arrow
g.translate( ax, ay );