@@ -506,7 +506,7 @@ public void run(final DisplayEditor editor, final boolean selected)
506506 .mapToInt (w -> w .propWidth ().getValue ())
507507 .sum ();
508508
509- final double offset = ( ( double ) max - ( double ) min - ( double ) totalWidth ) / ( ( double ) N - 1.0 );
509+ final double offset = (double ) ( max - min - totalWidth ) / (double ) ( N - 1 );
510510 final List <Widget > sortedWidgets = widgets .stream ()
511511 .sorted (( w1 , w2 ) ->
512512 {
@@ -550,7 +550,7 @@ else if ( w1x >= w2x && w1x + w1w >= w2x + w2w )
550550 // Equal gap distribution...
551551 // ------------------------------------------------------------
552552 Widget widget = sortedWidgets .get (0 );
553- double location = widget .propX ().getValue ();
553+ double location = ( double ) widget .propX ().getValue ();
554554 int width = widget .propWidth ().getValue ();
555555
556556 for ( int i = 1 ; i < N - 1 ; i ++ )
@@ -582,13 +582,13 @@ else if ( offset < 0 )
582582 width = widget .propWidth ().getValue ();
583583
584584 final int leftCenter = location + width / 2 ;
585- final double coffset = ( rightCenter - leftCenter ) / ( ( double ) N - 1.0 );
585+ final double coffset = (rightCenter - ( double ) leftCenter ) / ( double ) ( N - 1 );
586586
587587 for ( int i = 1 ; i < N - 1 ; i ++ )
588588 {
589589 widget = sortedWidgets .get (i );
590590 width = widget .propWidth ().getValue ();
591- undo .execute (new SetWidgetPropertyAction <>(widget .propX (), (int ) Math .round (( leftCenter + i * coffset ) - (double ) width / 2.0 )));
591+ undo .execute (new SetWidgetPropertyAction <>(widget .propX (), (int ) Math .round ((leftCenter + ( double ) i * coffset - (double ) width / 2.0 ) )));
592592 }
593593 }
594594 }
@@ -620,7 +620,7 @@ public void run(final DisplayEditor editor, final boolean selected)
620620 .mapToInt (w -> w .propHeight ().getValue ())
621621 .sum ();
622622
623- final double offset = ( ( double ) max - ( double ) min - ( double ) totalHeight ) / ( ( double ) N - 1.0 );
623+ final double offset = (double ) ( max - min - totalHeight ) / (double ) ( N - 1 );
624624 final List <Widget > sortedWidgets = widgets .stream ()
625625 .sorted (( w1 , w2 ) ->
626626 {
@@ -710,12 +710,12 @@ else if ( offset < 0 )
710710 height = widget .propHeight ().getValue ();
711711
712712 final double topCenter = (double ) location + (double ) height / 2.0 ;
713- final double coffset = ( bottomCenter - topCenter ) / ( ( double ) N - 1.0 );
713+ final double coffset = (bottomCenter - topCenter ) / ( double ) ( N - 1 );
714714 for ( int i = 1 ; i < N - 1 ; i ++ )
715715 {
716716 widget = sortedWidgets .get (i );
717717 height = widget .propHeight ().getValue ();
718- undo .execute (new SetWidgetPropertyAction <>(widget .propY (), (int ) Math .round (( topCenter + (double ) i * coffset ) - (double ) height / 2.0 )));
718+ undo .execute (new SetWidgetPropertyAction <>(widget .propY (), (int ) Math .round ((topCenter + (double ) i * coffset - (double ) height / 2.0 ) )));
719719 }
720720 }
721721 }
0 commit comments