mirror of
https://github.com/aNNiMON/HotaruFX.git
synced 2024-09-19 14:14:21 +03:00
Switch to custom scene root
This commit is contained in:
parent
f2970464f9
commit
ef8aa0d364
@ -0,0 +1,47 @@
|
||||
package com.annimon.hotarufx.ui.control;
|
||||
|
||||
import javafx.collections.ObservableList;
|
||||
import javafx.scene.Group;
|
||||
import javafx.scene.Node;
|
||||
|
||||
public class NodesGroup extends Group {
|
||||
|
||||
private final double width, height;
|
||||
|
||||
public NodesGroup(double width, double height) {
|
||||
this.width = width;
|
||||
this.height = height;
|
||||
setAutoSizeChildren(false);
|
||||
setManaged(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ObservableList<Node> getChildren() {
|
||||
return super.getChildren();
|
||||
}
|
||||
|
||||
@Override
|
||||
public double prefWidth(double unused) {
|
||||
return width;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double prefHeight(double unused) {
|
||||
return height;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected double computePrefWidth(double unused) {
|
||||
return width;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected double computePrefHeight(double unused) {
|
||||
return height;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isResizable() {
|
||||
return false;
|
||||
}
|
||||
}
|
@ -1,6 +1,6 @@
|
||||
package com.annimon.hotarufx.visual;
|
||||
|
||||
import javafx.scene.Group;
|
||||
import com.annimon.hotarufx.ui.control.NodesGroup;
|
||||
import javafx.scene.Scene;
|
||||
import javafx.scene.input.KeyCode;
|
||||
import javafx.scene.paint.Color;
|
||||
@ -54,7 +54,7 @@ public class Composition {
|
||||
}
|
||||
|
||||
private VirtualScene newScene() {
|
||||
val group = new Group();
|
||||
val group = new NodesGroup(sceneWidth, sceneHeight);
|
||||
group.setScaleX(1d / factor);
|
||||
group.setScaleY(1d / factor);
|
||||
group.setTranslateX(sceneWidth / 2);
|
||||
|
@ -1,6 +1,6 @@
|
||||
package com.annimon.hotarufx.visual;
|
||||
|
||||
import javafx.scene.Group;
|
||||
import com.annimon.hotarufx.ui.control.NodesGroup;
|
||||
import javafx.scene.Node;
|
||||
import lombok.Getter;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
@ -9,7 +9,7 @@ import lombok.RequiredArgsConstructor;
|
||||
public class VirtualScene {
|
||||
|
||||
@Getter
|
||||
private final Group group;
|
||||
private final NodesGroup group;
|
||||
|
||||
@Getter
|
||||
private final int virtualWidth, virtualHeight;
|
||||
|
Loading…
Reference in New Issue
Block a user