-
Notifications
You must be signed in to change notification settings - Fork 90
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
gave ToolBar FlowPane a more natural LCARS look
- Loading branch information
1 parent
dd894e5
commit c20f699
Showing
3 changed files
with
73 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
47 changes: 47 additions & 0 deletions
47
chartfx-chart/src/main/java/de/gsi/chart/utils/ToolBarShapeHelper.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
package de.gsi.chart.utils; | ||
|
||
import javafx.scene.shape.CubicCurveTo; | ||
import javafx.scene.shape.LineTo; | ||
import javafx.scene.shape.MoveTo; | ||
import javafx.scene.shape.Path; | ||
import javafx.scene.shape.Shape; | ||
|
||
/** | ||
* @author rstein | ||
*/ | ||
public final class ToolBarShapeHelper { | ||
|
||
private ToolBarShapeHelper() { | ||
|
||
} | ||
|
||
public static Shape getToolBarShape(final double width, final double height, final double radii) { | ||
final double centreX = 0.0; | ||
final double centreY = 0.0; | ||
final double halfWidth = 0.5 * width + 2 * radii; | ||
final double halfHeight = 0.5 * height; | ||
|
||
Path path = new Path(); | ||
|
||
// go to left-top most corner | ||
path.getElements().add(new MoveTo(centreX - halfWidth - 4 * radii, centreY - halfHeight)); | ||
|
||
// cubic sweep down | ||
path.getElements().add(new CubicCurveTo(// | ||
centreX - halfWidth - 0 * radii, centreY - halfHeight, // first control point | ||
centreX - halfWidth - 4 * radii, centreY + halfHeight, // second control point | ||
centreX - halfWidth + 0 * radii, centreY + halfHeight)); // to coordinate | ||
// line on bottom | ||
path.getElements().add(new LineTo(centreX + halfWidth, centreY + halfHeight)); | ||
|
||
// cubic sweep up | ||
path.getElements().add(new CubicCurveTo(// | ||
centreX + halfWidth + 4 * radii, centreY + halfHeight, // first control point | ||
centreX + halfWidth + 0 * radii, centreY - halfHeight, // second control point | ||
centreX + halfWidth + 4 * radii, centreY - halfHeight)); // to coordinate | ||
|
||
// return to top left corner | ||
path.getElements().add(new LineTo(centreX - halfWidth - 2 * radii, centreY - halfHeight)); | ||
return path; | ||
} | ||
} |