From 2b91d07fc8b0de6927363bf76abe64268dc5632b Mon Sep 17 00:00:00 2001 From: Claudio Rosati Date: Thu, 23 Mar 2017 15:41:29 +0100 Subject: [PATCH] Problem fixed for HORIZONTAL, VERTICAL, GAUGE and QUARTER --- src/main/java/eu/hansolo/medusa/Test.java | 7 ++++--- src/main/java/eu/hansolo/medusa/skins/QuarterSkin.java | 8 ++++---- src/main/java/eu/hansolo/medusa/tools/Helper.java | 6 +++--- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/src/main/java/eu/hansolo/medusa/Test.java b/src/main/java/eu/hansolo/medusa/Test.java index 26ed18ff..6eb6b85c 100644 --- a/src/main/java/eu/hansolo/medusa/Test.java +++ b/src/main/java/eu/hansolo/medusa/Test.java @@ -34,7 +34,6 @@ import javafx.collections.ObservableList; import javafx.geometry.Insets; import javafx.geometry.NodeOrientation; -import javafx.geometry.Orientation; import javafx.geometry.Pos; import javafx.scene.Node; import javafx.scene.Parent; @@ -82,12 +81,14 @@ public class Test extends Application { .build(); gauge = GaugeBuilder.create() - .skinType(SkinType.SLIM) + .skinType(SkinType.VERTICAL) //.prefSize(400, 400) .knobPosition(Pos.BOTTOM_LEFT) .tickLabelLocation(TickLabelLocation.OUTSIDE) + .tickMarkRingVisible(true) + .scaleDirection(Gauge.ScaleDirection.COUNTER_CLOCKWISE) .decimals(2) - .minValue(20) + .minValue(-20) .maxValue(100) .startFromZero(true) .animated(true) diff --git a/src/main/java/eu/hansolo/medusa/skins/QuarterSkin.java b/src/main/java/eu/hansolo/medusa/skins/QuarterSkin.java index 2d6cf851..98a82c14 100644 --- a/src/main/java/eu/hansolo/medusa/skins/QuarterSkin.java +++ b/src/main/java/eu/hansolo/medusa/skins/QuarterSkin.java @@ -576,10 +576,10 @@ private void drawTickMarks() { tickMarkCtx.save(); tickMarkCtx.setStroke(tickMarkColor); switch(knobPosition) { - case BOTTOM_LEFT: tickMarkCtx.strokeArc((-scaledSize * 0.46) + xy, xy, wh, wh, offset, -ANGLE_RANGE, ArcType.OPEN); break; - case TOP_LEFT : tickMarkCtx.strokeArc((-scaledSize * 0.46) + xy, (-scaledSize * 0.46) + xy, wh, wh, offset, -ANGLE_RANGE, ArcType.OPEN); break; - case TOP_RIGHT : tickMarkCtx.strokeArc(xy, (-scaledSize * 0.46) + xy, wh, wh, offset, -ANGLE_RANGE, ArcType.OPEN); break; - default : tickMarkCtx.strokeArc(xy, xy, wh, wh, offset, -ANGLE_RANGE, ArcType.OPEN); break; + case BOTTOM_LEFT: tickMarkCtx.strokeArc((-scaledSize * 0.46) + xy, xy, wh, wh, offset, ScaleDirection.CLOCKWISE == scaleDirection ? -ANGLE_RANGE : ANGLE_RANGE, ArcType.OPEN); break; + case TOP_LEFT : tickMarkCtx.strokeArc((-scaledSize * 0.46) + xy, (-scaledSize * 0.46) + xy, wh, wh, offset, ScaleDirection.CLOCKWISE == scaleDirection ? -ANGLE_RANGE : ANGLE_RANGE, ArcType.OPEN); break; + case TOP_RIGHT : tickMarkCtx.strokeArc(xy, (-scaledSize * 0.46) + xy, wh, wh, offset, ScaleDirection.CLOCKWISE == scaleDirection ? -ANGLE_RANGE : ANGLE_RANGE, ArcType.OPEN); break; + default : tickMarkCtx.strokeArc(xy, xy, wh, wh, offset, ScaleDirection.CLOCKWISE == scaleDirection ? -ANGLE_RANGE : ANGLE_RANGE, ArcType.OPEN); break; } tickMarkCtx.restore(); if (tickMarkSections.size() > 0) { diff --git a/src/main/java/eu/hansolo/medusa/tools/Helper.java b/src/main/java/eu/hansolo/medusa/tools/Helper.java index f7df675a..7adf40cc 100644 --- a/src/main/java/eu/hansolo/medusa/tools/Helper.java +++ b/src/main/java/eu/hansolo/medusa/tools/Helper.java @@ -508,9 +508,9 @@ public static void drawRadialTickMarks(final Gauge GAUGE, final GraphicsContext CTX.save(); CTX.setStroke(tickMarkColor); switch(skinType) { - case HORIZONTAL: CTX.strokeArc(xy + horVerOffset, xy, wh, wh, offset, -ANGLE_RANGE, ArcType.OPEN); break; - case VERTICAL : CTX.strokeArc(xy, xy + horVerOffset, wh, wh, offset, -ANGLE_RANGE, ArcType.OPEN); break; - default : CTX.strokeArc(xy, xy, wh, wh, offset, -ANGLE_RANGE, ArcType.OPEN); break; + case HORIZONTAL: CTX.strokeArc(xy + horVerOffset, xy, wh, wh, offset, ScaleDirection.CLOCKWISE == scaleDirection ? -ANGLE_RANGE : ANGLE_RANGE, ArcType.OPEN); break; + case VERTICAL : CTX.strokeArc(xy, xy + horVerOffset, wh, wh, offset, ScaleDirection.CLOCKWISE == scaleDirection ? -ANGLE_RANGE : ANGLE_RANGE, ArcType.OPEN); break; + default : CTX.strokeArc(xy, xy, wh, wh, offset, ScaleDirection.CLOCKWISE == scaleDirection ? -ANGLE_RANGE : ANGLE_RANGE, ArcType.OPEN); break; } CTX.restore();