ScrollPane : custom ScrollPane max h value and content bounds change

"Sébastien Boulet [intactile DESIGN]" boulet.s at intactile.com
Wed Sep 30 10:53:59 UTC 2015


Hello,

i use a ScrollPane with a custom h max value and a custom v max value (to facilitate some calculations).

    ScrollPane scroll = new ScrollPane(content);
    scroll.setHmax(10000);
    scroll.setVmax(10000);

if for some reasons, the content layout bounds changes, the scroll hValue and vValue are set to 1.0.
It is due to the boundsChangeListener in the ScrollPaneSkin :

   private final ChangeListener<Bounds> boundsChangeListener = new ChangeListener<Bounds>() {
        @Override public void changed(ObservableValue<? extends Bounds> observable, Bounds oldBounds, Bounds newBounds) {
                ...
                
                double newValueY = (oldPositionY/newPositionY)*vsb.getValue();
                if (newValueY < 0.0) {
                    vsb.setValue(0.0);
                }
                else if (newValueY < 1.0) {
                    vsb.setValue(newValueY);
                }
                else if (newValueY > 1.0) {
                    vsb.setValue(1.0);
                }
                
                ...
            
                if (newValueX < 0.0) {
                    hsb.setValue(0.0);
                }
                else if (newValueX < 1.0) {
                    hsb.setValue(newValueX);
                }
                else if (newValueX > 1.0) {
                    hsb.setValue(1.0);
                }
            }
        }
   };

I think that the fixes values (0.0 and 1.0) should be replaced by (h|v)sb.getMin() or (h|v)sb.getMax().


                if (newValueY < vsb.getMin()) {
                    vsb.setValue(vsb.getMin());
                }
                else if (newValueY < vsb.getMax()) {
                    vsb.setValue(newValueY);
                }
                else if (newValueY > vsb.getMax()) {
                    vsb.setValue(vsb.getMax());
                }

Am i right or am i misunderstanding something ?

Regards

Seb



Sébastien BOULET
LEAD DÉVELOPPEUR

intactile DESIGN
Création d’interfaces + subtiles
04 67 52 88 61
09 50 12 05 66
20 rue du carré du roi
34000 MONTPELLIER
France
www.intactile.com <http://intactile.com/>

Les informations contenues dans cet email et ses documents attachés sont confidentielles. Elles sont exclusivement adressées aux destinataires explicitement désignés ci-dessus et ne peuvent être divulguées sans consentement de son auteur. Si vous n'êtes pas le destinataire de cet email vous ne devez pas employer, révéler, distribuer, copier, imprimer ou transmettre le contenu de cet email et devez le détruire immédiatement.



More information about the openjfx-dev mailing list