mikaelgrev/miglayout

Rotate is not handled correctly

Opened this issue · 5 comments

tbee commented

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 commented

Code is committed in the test sources

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

On 19 Aug 2016, at 10:33, Tom Eugelink notifications@github.com 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 #47 (comment), or mute the thread https://github.com/notifications/unsubscribe-auth/AA4AufGJQtKMvS5wuSo7afBl95qSXRTgks5qhWpQgaJpZM4JoQgN.

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

tbee commented

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.

hjohn commented

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