Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tick mark ring displayed in a wrong position when scale direction is counter clockwise #115

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions src/main/java/eu/hansolo/medusa/Test.java
Original file line number Diff line number Diff line change
Expand Up @@ -81,13 +81,15 @@ public class Test extends Application {
.build();

gauge = GaugeBuilder.create()
.skinType(SkinType.MODERN)
.skinType(SkinType.HORIZONTAL)
//.prefSize(400, 400)
.knobPosition(Pos.BOTTOM_LEFT)
.tickLabelLocation(TickLabelLocation.OUTSIDE)
.tickMarkRingVisible(true)
.scaleDirection(Gauge.ScaleDirection.COUNTER_CLOCKWISE)
.decimals(2)
.minValue(-20)
.maxValue(120)
.maxValue(100)
.startFromZero(true)
.animated(true)
//.checkThreshold(true)
Expand Down
8 changes: 4 additions & 4 deletions src/main/java/eu/hansolo/medusa/skins/QuarterSkin.java
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/eu/hansolo/medusa/tools/Helper.java
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down