aboutsummaryrefslogtreecommitdiffstats
path: root/src/test/java/at/ac/tuwien/sepm/assignment/groupphase/ScaledBounds.java
blob: adf029e183b0d932d228f793010e2ac6e440cc8b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
package at.ac.tuwien.sepm.assignment.groupphase;

import java.awt.GraphicsEnvironment;
import javafx.geometry.BoundingBox;
import javafx.geometry.Bounds;

public class ScaledBounds extends BoundingBox {
    private static final double scale;
    static {
        scale =
                1
                        / GraphicsEnvironment.getLocalGraphicsEnvironment()
                        .getDefaultScreenDevice()
                        .getDefaultConfiguration()
                        .getDefaultTransform()
                        .getScaleX();
    }
    public static ScaledBounds wrap(Bounds bounds) {
        return new ScaledBounds(bounds);
    }
    private ScaledBounds(Bounds wrapped) {
        super(
                wrapped.getMinX() * scale,
                wrapped.getMinY() * scale,
                wrapped.getMinZ() * scale,
                wrapped.getWidth() * scale,
                wrapped.getHeight() * scale,
                wrapped.getDepth());
    }
}