aboutsummaryrefslogtreecommitdiffstats
path: root/src/test/java/at/ac/tuwien/sepm/assignment/groupphase/util/ScaledBounds.java
blob: 02c15c4ba8bd0866f8f5ed5f7b24d62b66251275 (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
31
32
33
34
package at.ac.tuwien.sepm.assignment.groupphase.util;

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());
    }
}