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:
parent
5e403681a2
commit
7e11b5eccb
@ -8,6 +8,7 @@ import com.annimon.hotarufx.visual.visitors.NodeVisitor;
|
|||||||
import javafx.scene.shape.Arc;
|
import javafx.scene.shape.Arc;
|
||||||
import javafx.scene.shape.ArcType;
|
import javafx.scene.shape.ArcType;
|
||||||
import static com.annimon.hotarufx.visual.PropertyType.NUMBER;
|
import static com.annimon.hotarufx.visual.PropertyType.NUMBER;
|
||||||
|
import static com.annimon.hotarufx.visual.PropertyType.STRING;
|
||||||
|
|
||||||
public class ArcNode extends ShapeNode {
|
public class ArcNode extends ShapeNode {
|
||||||
|
|
||||||
@ -15,6 +16,7 @@ public class ArcNode extends ShapeNode {
|
|||||||
|
|
||||||
private PropertyTimelineHolder<Number> centerX, centerY, radiusX, radiusY;
|
private PropertyTimelineHolder<Number> centerX, centerY, radiusX, radiusY;
|
||||||
private PropertyTimelineHolder<Number> startAngle, length;
|
private PropertyTimelineHolder<Number> startAngle, length;
|
||||||
|
private PropertyTimelineHolder<String> type;
|
||||||
|
|
||||||
public ArcNode() {
|
public ArcNode() {
|
||||||
this(new Arc());
|
this(new Arc());
|
||||||
@ -30,6 +32,7 @@ public class ArcNode extends ShapeNode {
|
|||||||
radiusY = PropertyTimelineHolder.empty();
|
radiusY = PropertyTimelineHolder.empty();
|
||||||
startAngle = PropertyTimelineHolder.empty();
|
startAngle = PropertyTimelineHolder.empty();
|
||||||
length = PropertyTimelineHolder.empty();
|
length = PropertyTimelineHolder.empty();
|
||||||
|
type = PropertyTimelineHolder.empty();
|
||||||
}
|
}
|
||||||
|
|
||||||
public PropertyTimeline<Number> centerXProperty() {
|
public PropertyTimeline<Number> centerXProperty() {
|
||||||
@ -56,6 +59,10 @@ public class ArcNode extends ShapeNode {
|
|||||||
return length.setIfEmptyThenGet(arc::lengthProperty);
|
return length.setIfEmptyThenGet(arc::lengthProperty);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public PropertyTimeline<String> typeProperty() {
|
||||||
|
return type.setIfEmptyThenGet(enumToString(ArcType.class, arc.typeProperty()));
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void buildTimeline(TimeLine timeline) {
|
public void buildTimeline(TimeLine timeline) {
|
||||||
super.buildTimeline(timeline);
|
super.buildTimeline(timeline);
|
||||||
@ -65,6 +72,7 @@ public class ArcNode extends ShapeNode {
|
|||||||
radiusY.applyIfPresent(timeline);
|
radiusY.applyIfPresent(timeline);
|
||||||
startAngle.applyIfPresent(timeline);
|
startAngle.applyIfPresent(timeline);
|
||||||
length.applyIfPresent(timeline);
|
length.applyIfPresent(timeline);
|
||||||
|
type.applyIfPresent(timeline);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -78,7 +86,8 @@ public class ArcNode extends ShapeNode {
|
|||||||
.add("radiusY", NUMBER, this::radiusYProperty)
|
.add("radiusY", NUMBER, this::radiusYProperty)
|
||||||
.add("angle", NUMBER, this::startAngleProperty)
|
.add("angle", NUMBER, this::startAngleProperty)
|
||||||
.add("startAngle", NUMBER, this::startAngleProperty)
|
.add("startAngle", NUMBER, this::startAngleProperty)
|
||||||
.add("length", NUMBER, this::lengthProperty);
|
.add("length", NUMBER, this::lengthProperty)
|
||||||
|
.add("type", STRING, this::typeProperty);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -292,12 +292,13 @@
|
|||||||
</graphic>
|
</graphic>
|
||||||
<code>
|
<code>
|
||||||
arc({\n
|
arc({\n
|
||||||
__cx: 0\n
|
__cx: 0,\n
|
||||||
__cy: 0\n
|
__cy: 0,\n
|
||||||
__radiusX: 50,\n
|
__radiusX: 50,\n
|
||||||
__radiusY: 50,\n
|
__radiusY: 50,\n
|
||||||
__startAngle: 60,\n
|
__startAngle: 60,\n
|
||||||
__length: 240\n
|
__length: 240\n
|
||||||
|
__type: "ROUND" # OPEN, CHORD, ROUND\n
|
||||||
__fill: "#1b8118",\n
|
__fill: "#1b8118",\n
|
||||||
__strokeWidth: 4,\n
|
__strokeWidth: 4,\n
|
||||||
__stroke: "#4cbc72"\n
|
__stroke: "#4cbc72"\n
|
||||||
|
Loading…
Reference in New Issue
Block a user