I'm showing a HBox containing a few nodes. The HBox is made hidden and some value is set for 'rotate' attribute. When the HBox is made visible, the result shows as if HBox was rotated around its origin instead of center. When a visible HBox is rotated, it rotates around its center.
To reproduce, run the below code. Deselect the 'visible' checkbox and move the 'Rotate' slider. Select the 'visible' checkbox. It could be seen that the HBox shows rotated around its origin.
import javafx.ext.swing.*;
import javafx.scene.*;
import javafx.stage.*;
import javafx.scene.shape.*;
import javafx.scene.paint.*;
import javafx.scene.layout.*;
var visible: Boolean = true;
var rotate: Integer = 0;
Stage {
width: 500
height: 400
scene: Scene {
content: [HBox {
content: [for (i in [0..10]) Rectangle {
width: 20
height: 20
fill: Color.RED
stroke: Color.GREEN
strokeWidth: 3
}]
rotate: bind rotate
visible: bind visible
}, HBox {
content: [SwingCheckBox {
text: "Visible"
selected: bind visible with inverse
width: 80
}, SwingLabel {
text: "Rotation"
}, SwingSlider {
minimum: 0
maximum: 360
value: bind rotate with inverse
width: 150
}]
translateX: 50
translateY: 300
}]
}
}
To reproduce, run the below code. Deselect the 'visible' checkbox and move the 'Rotate' slider. Select the 'visible' checkbox. It could be seen that the HBox shows rotated around its origin.
import javafx.ext.swing.*;
import javafx.scene.*;
import javafx.stage.*;
import javafx.scene.shape.*;
import javafx.scene.paint.*;
import javafx.scene.layout.*;
var visible: Boolean = true;
var rotate: Integer = 0;
Stage {
width: 500
height: 400
scene: Scene {
content: [HBox {
content: [for (i in [0..10]) Rectangle {
width: 20
height: 20
fill: Color.RED
stroke: Color.GREEN
strokeWidth: 3
}]
rotate: bind rotate
visible: bind visible
}, HBox {
content: [SwingCheckBox {
text: "Visible"
selected: bind visible with inverse
width: 80
}, SwingLabel {
text: "Rotation"
}, SwingSlider {
minimum: 0
maximum: 360
value: bind rotate with inverse
width: 150
}]
translateX: 50
translateY: 300
}]
}
}