use of org.geepawhill.contentment.jfx.ScaleListener in project contentment by GeePawHill.
the class MainView method makeViewport.
private Pane makeViewport() {
Pane owner = new Pane();
owner.setPrefSize(1600d, 900d);
Background background = new Background(new BackgroundFill(Color.BLACK, null, null));
owner.setBackground(background);
player.scriptProperty().addListener((p, o, n) -> scriptChanged());
media = new MediaView();
owner.getChildren().add(media);
// non-media background
ScaleListener listener = new ScaleListener(owner, player.context().canvas, media);
owner.widthProperty().addListener(listener);
owner.heightProperty().addListener(listener);
listener.changed(null, 300, 300);
owner.setOnMouseClicked((event) -> mouseClicked(event));
owner.getChildren().add(player.context().canvas);
return owner;
}
Aggregations