use of com.ait.lienzo.client.core.shape.Triangle in project kie-wb-common by kiegroup.
the class PrimitiveTooltip method buildDecorator.
private IPrimitive<?> buildDecorator(final double width, final double height, final Direction direction) {
final boolean isWest = isWest(direction);
final boolean isNorth = isNorth(direction);
final double h2 = height / 2;
final double w2 = width / 2;
final double s2 = TRIANGLE_SIZE / 2;
final Point2D a = isWest ? new Point2D(0, h2) : new Point2D(10, 0);
final Point2D b = isWest ? new Point2D(TRIANGLE_SIZE, h2 + s2) : new Point2D(10 + s2, TRIANGLE_SIZE);
final Point2D c = isWest ? new Point2D(TRIANGLE_SIZE, h2 - s2) : new Point2D(10 - s2, TRIANGLE_SIZE);
final Triangle triangle = new Triangle(a, b, c).setFillColor(BG_COLOR).setFillAlpha(ALPHA).setStrokeWidth(0);
final Rectangle rectangle = new Rectangle(width + (isWest ? TRIANGLE_SIZE : 0), height + (isNorth ? TRIANGLE_SIZE : 0)).setX(isWest ? TRIANGLE_SIZE : 0).setY(isWest ? 0 : TRIANGLE_SIZE).setCornerRadius(10).setFillColor(BG_COLOR).setFillAlpha(ALPHA).setStrokeAlpha(0).setCornerRadius(5);
final Group decorator = new Group();
decorator.add(rectangle);
decorator.add(triangle);
return decorator;
}