1
0
mirror of https://github.com/aNNiMON/HotaruFX.git synced 2024-09-19 14:14:21 +03:00

Add arc type property

This commit is contained in:
Victor 2017-09-08 11:15:51 +03:00
parent 5e403681a2
commit 7e11b5eccb
2 changed files with 13 additions and 3 deletions

View File

@ -8,6 +8,7 @@ import com.annimon.hotarufx.visual.visitors.NodeVisitor;
import javafx.scene.shape.Arc;
import javafx.scene.shape.ArcType;
import static com.annimon.hotarufx.visual.PropertyType.NUMBER;
import static com.annimon.hotarufx.visual.PropertyType.STRING;
public class ArcNode extends ShapeNode {
@ -15,6 +16,7 @@ public class ArcNode extends ShapeNode {
private PropertyTimelineHolder<Number> centerX, centerY, radiusX, radiusY;
private PropertyTimelineHolder<Number> startAngle, length;
private PropertyTimelineHolder<String> type;
public ArcNode() {
this(new Arc());
@ -30,6 +32,7 @@ public class ArcNode extends ShapeNode {
radiusY = PropertyTimelineHolder.empty();
startAngle = PropertyTimelineHolder.empty();
length = PropertyTimelineHolder.empty();
type = PropertyTimelineHolder.empty();
}
public PropertyTimeline<Number> centerXProperty() {
@ -56,6 +59,10 @@ public class ArcNode extends ShapeNode {
return length.setIfEmptyThenGet(arc::lengthProperty);
}
public PropertyTimeline<String> typeProperty() {
return type.setIfEmptyThenGet(enumToString(ArcType.class, arc.typeProperty()));
}
@Override
public void buildTimeline(TimeLine timeline) {
super.buildTimeline(timeline);
@ -65,6 +72,7 @@ public class ArcNode extends ShapeNode {
radiusY.applyIfPresent(timeline);
startAngle.applyIfPresent(timeline);
length.applyIfPresent(timeline);
type.applyIfPresent(timeline);
}
@Override
@ -78,7 +86,8 @@ public class ArcNode extends ShapeNode {
.add("radiusY", NUMBER, this::radiusYProperty)
.add("angle", NUMBER, this::startAngleProperty)
.add("startAngle", NUMBER, this::startAngleProperty)
.add("length", NUMBER, this::lengthProperty);
.add("length", NUMBER, this::lengthProperty)
.add("type", STRING, this::typeProperty);
}
@Override

View File

@ -292,12 +292,13 @@
</graphic>
<code>
arc({\n
__cx: 0\n
__cy: 0\n
__cx: 0,\n
__cy: 0,\n
__radiusX: 50,\n
__radiusY: 50,\n
__startAngle: 60,\n
__length: 240\n
__type: "ROUND" # OPEN, CHORD, ROUND\n
__fill: "#1b8118",\n
__strokeWidth: 4,\n
__stroke: "#4cbc72"\n