HanSolo / medusa

A JavaFX library for Gauges
Apache License 2.0
692 stars 131 forks source link

LINEAR: Takes up to much space surrounding the Gauge #161

Closed DJViking closed 5 years ago

DJViking commented 5 years ago

A simple LINEAR Gauge without ticks,labels and value visible takes up to much space. Using this as an offset meter +/-500.

I have added a RED border around the Gauge: screenshot_20190203_135753

If I resize down to acceptable size, then the Gauge becomes to small. screenshot_20190203_135807

    Gauge gauge1 = GaugeBuilder.create()
                    .skinType(SkinType.LINEAR)
                    .prefSize(450, 450)
                    .minValue(-500.0)
                    .maxValue(500.0)
                    .decimals(2)
                    .startFromZero(true)
                    .minorTickMarksVisible(false)
                    .mediumTickMarksVisible(false)
                    .majorTickMarksVisible(false)
                    .tickLabelsVisible(false)
                    .tickLabelSectionsVisible(false)
                    .valueVisible(false)
                    .build();

    gauge1.setValue(250);

    gauge1.setOrientation(Orientation.HORIZONTAL);
    root.getChildren().add(gauge1);

    gauge1.setBorder(new Border(new BorderStroke(Color.RED, BorderStrokeStyle.SOLID,
                                                 CornerRadii.EMPTY, BorderWidths.DEFAULT)));
DJViking commented 5 years ago

Perhaps the Nodes also should set Managed in addition to Visible.

HanSolo commented 5 years ago

Instead of tweaking the existing skin it might be much easier to create a new skin with the needed functionality. Therefor you simply copy the LinearSkin and remove all things that you don't need. After that you can adjust the scaling in the skin. This is what I did with the PlainAmpSkin. So you could simply create the skin on your own and set it later on in your code. You can find an example on how to do that in the medusademo project on github.