miglayout icon indicating copy to clipboard operation
miglayout copied to clipboard

Rotate is not handled correctly

Open tbee opened this issue 8 years ago • 5 comments

Comment out the setRotate and things are peachy, leaving it in not so much. Resizing also works in the wrong direction. Try 45 degrees or adding it to the regular layout. We need to compensate for / undo the rotation somehow.

` package org.tbee.javafx.scene.layout.trial;

import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.control.Label;
import javafx.scene.control.Button;
import javafx.stage.Stage;
import net.miginfocom.layout.CC;
import net.miginfocom.layout.LC;
import org.tbee.javafx.scene.layout.MigPane;

public class MigPaneTrial1 extends Application {

    public static void main(String[] args) {
        launch(args);
    }

    @Override
    public void start(Stage stage) throws Exception {
        MigPane migPane = new MigPane(new LC());
        migPane.add(new Label("Label"), new CC().wrap());
        migPane.add(new Label("Label"), new CC().wrap().push().grow());
        migPane.add(new Label("Label"), new CC().wrap());
        Button button = new Button("Button");
        migPane.add(button, new CC().dockWest().grow());
        //migPane.add(button, new CC().wrap().grow().push());
        button.setRotate(90);
        Scene scene = new Scene(migPane);
        stage.setScene(scene);
        stage.show();
    }
}

`

tbee avatar Aug 19 '16 08:08 tbee

Code is committed in the test sources

tbee avatar Aug 19 '16 08:08 tbee

Copy, Tom. Swamped atm but it’s in the queue of things to check. :)

On 19 Aug 2016, at 10:33, Tom Eugelink [email protected] wrote:

Code is committed in the test sources

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/mikaelgrev/miglayout/issues/47#issuecomment-240960319, or mute the thread https://github.com/notifications/unsubscribe-auth/AA4AufGJQtKMvS5wuSo7afBl95qSXRTgks5qhWpQgaJpZM4JoQgN.

mikaelgrev avatar Aug 20 '16 08:08 mikaelgrev

Tried it and it looks funny. Fortunately I think that rotated components are rare. I'm not going to do anything about this atm. :)

mikaelgrev avatar Aug 27 '16 18:08 mikaelgrev

What I see happening is that the rotation is not taking into account; when the node is rotated 90 degrees, it is stretched on its original height vector when the cell it occupies is growing in Y. This makes the node seem to grow X. So I suspect all that needs to be done is cos / sin the rotation into the X / Y. Maybe I have the time to take a peek.

tbee avatar Aug 27 '16 19:08 tbee

Rotations like that are done with a transform. The button won't report correct layout bounds when this happens, unless wrapped in a Group.

hjohn avatar Dec 15 '18 04:12 hjohn