Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rotate is not handled correctly #47

Open
tbee opened this issue Aug 19, 2016 · 5 comments
Open

Rotate is not handled correctly #47

tbee opened this issue Aug 19, 2016 · 5 comments

Comments

@tbee
Copy link
Collaborator

tbee commented Aug 19, 2016

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
Copy link
Collaborator Author

tbee commented Aug 19, 2016

Code is committed in the test sources

@mikaelgrev
Copy link
Owner

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 #47 (comment), or mute the thread https://github.com/notifications/unsubscribe-auth/AA4AufGJQtKMvS5wuSo7afBl95qSXRTgks5qhWpQgaJpZM4JoQgN.

@mikaelgrev
Copy link
Owner

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
Copy link
Collaborator Author

tbee commented Aug 27, 2016

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
Copy link

hjohn commented Dec 15, 2018

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants