From 7e11b5eccb3592adab2214e956bca6edda6ec279 Mon Sep 17 00:00:00 2001 From: Victor Date: Fri, 8 Sep 2017 11:15:51 +0300 Subject: [PATCH] Add arc type property --- .../com/annimon/hotarufx/visual/objects/ArcNode.java | 11 ++++++++++- app/src/main/resources/fxml/Editor.fxml | 5 +++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/com/annimon/hotarufx/visual/objects/ArcNode.java b/app/src/main/java/com/annimon/hotarufx/visual/objects/ArcNode.java index f337250..b55d0ad 100644 --- a/app/src/main/java/com/annimon/hotarufx/visual/objects/ArcNode.java +++ b/app/src/main/java/com/annimon/hotarufx/visual/objects/ArcNode.java @@ -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 centerX, centerY, radiusX, radiusY; private PropertyTimelineHolder startAngle, length; + private PropertyTimelineHolder 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 centerXProperty() { @@ -56,6 +59,10 @@ public class ArcNode extends ShapeNode { return length.setIfEmptyThenGet(arc::lengthProperty); } + public PropertyTimeline 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 diff --git a/app/src/main/resources/fxml/Editor.fxml b/app/src/main/resources/fxml/Editor.fxml index a52eba6..6ff1e0d 100644 --- a/app/src/main/resources/fxml/Editor.fxml +++ b/app/src/main/resources/fxml/Editor.fxml @@ -292,12 +292,13 @@ 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