File tree Expand file tree Collapse file tree 1 file changed +6
-5
lines changed
sources/net.sf.j2s.java.org.eclipse.swt/src/org/eclipse/swt/widgets Expand file tree Collapse file tree 1 file changed +6
-5
lines changed Original file line number Diff line number Diff line change @@ -404,14 +404,15 @@ public void setSelection (int value) {
404404}
405405
406406protected void updateSelection (int selection ) {
407- int blockSize = 9 ;
408- int w = ((style & SWT .HORIZONTAL ) != 0 ) ? width : height ;
407+ boolean isHr = (style & SWT .HORIZONTAL ) != 0 ;
408+ int w = isHr ? width : height ;
409+ int blockSize = Math .round ((isHr ? height : width ) * 0.668f ) - 2 ; // 9
409410 w = Math .round ((w - 2 ) * selection / maximum );
410411 if (w < 0 ) {
411412 w = 0 ;
412413 }
413414 if ((style & SWT .SMOOTH ) != 0 ) {
414- if (( style & SWT . HORIZONTAL ) != 0 ) {
415+ if (isHr ) {
415416 innerHandles [0 ].style .width = w + "px" ;
416417 innerHandles [0 ].style .height = ((height - 2 ) < 0 ? 0 : height - 2 ) + "px" ;
417418 } else {
@@ -433,7 +434,7 @@ protected void updateSelection(int selection) {
433434 if (el == null ) {
434435 el = document .createElement ("DIV" );
435436 handle .appendChild (el );
436- if (( style & SWT . HORIZONTAL ) != 0 ) {
437+ if (isHr ) {
437438 el .className = "progress-bar-horizontal" ;
438439 el .style .left = (i * (blockSize + 2 ) + 1 ) + "px" ;
439440 } else {
@@ -444,7 +445,7 @@ protected void updateSelection(int selection) {
444445 } else {
445446 el .style .display = "block" ;
446447 }
447- if (( style & SWT . HORIZONTAL ) != 0 ) {
448+ if (isHr ) {
448449 el .style .height = ((height - 2 ) < 0 ? 0 : height - 2 ) + "px" ;
449450 if ((i + 1 ) * (blockSize + 2 ) <= width - 2 ) {
450451 el .style .width = blockSize + "px" ;
You can’t perform that action at this time.
0 commit comments