use of com.ait.lienzo.client.core.types.BoundingBox in project kie-wb-common by kiegroup.
the class PrimitiveTextTooltipTest method testBoundingLocationExecutor.
@Test
@SuppressWarnings("unchecked")
public void testBoundingLocationExecutor() {
final PrimitiveTextTooltip.BoundingLocationExecutor executor = new PrimitiveTextTooltip.BoundingLocationExecutor();
BoundingBox boundingBox = new BoundingBox(0d, 0d, 100d, 200d);
executor.at(Direction.SOUTH).forBoundingBox(() -> boundingBox).accept(tooltip);
final ArgumentCaptor<Point2D> pointCaptor = ArgumentCaptor.forClass(Point2D.class);
verify(tooltip, times(1)).setLocation(pointCaptor.capture());
Point2D point = pointCaptor.getValue();
assertEquals(50, point.getX(), 0);
assertEquals(200, point.getY(), 0);
}
use of com.ait.lienzo.client.core.types.BoundingBox in project kie-wb-common by kiegroup.
the class HoverPalette method drawPaletteDecorator.
private void drawPaletteDecorator() {
if (null == decorator) {
addPaletteDecorator();
}
if (null != decorator) {
final double halfOfPadding = padding != 0 ? padding / 2 : 0;
final BoundingBox boundingBox = itemsGroup.getBoundingBox();
final double width = boundingBox.getWidth();
final double height = boundingBox.getHeight();
final double w = width + halfOfPadding;
final double h = height + halfOfPadding;
decorator.setWidth(w).setHeight(h).setX(x + (halfOfPadding / 2)).setY(y + halfOfPadding);
}
}
use of com.ait.lienzo.client.core.types.BoundingBox in project kie-wb-common by kiegroup.
the class ButtonGridItemImpl method buildArrow.
private MultiPath buildArrow() {
final BoundingBox bb = this.button.getBoundingBox().get();
final double l = bb.getWidth() * 0.4;
final double h = bb.getHeight() * 0.2;
return buildArrow(l, h);
}
use of com.ait.lienzo.client.core.types.BoundingBox in project kie-wb-common by kiegroup.
the class LienzoMultipleSelectionControl method rebuildSelectionArea.
private void rebuildSelectionArea() {
if (null != selectionShapeProvider.getShape()) {
getSelectionManager().getSelectedItems().rebuildBoundingBox();
// Let's workaroud it - THIS CAN BE REFACTORED ONCE MOVING TO NEXT LIENZO RELEASE.
if (getSelectionManager().getSelectedItems().isEmpty()) {
return;
}
BoundingBox bbox = getSelectionManager().getSelectedItems().getBoundingBox();
getSelectionManager().drawSelectionShape(bbox.getX(), bbox.getY(), bbox.getWidth(), bbox.getHeight(), getWiresManager().getLayer().getLayer().getOverLayer());
}
}
use of com.ait.lienzo.client.core.types.BoundingBox in project kie-wb-common by kiegroup.
the class LienzoShapeUtils method scalePicture.
public static void scalePicture(final Picture picture, final double width, final double height) {
final BoundingBox bb = picture.getBoundingBox();
final double[] scale = LienzoUtils.getScaleFactor(bb.getWidth(), bb.getHeight(), width, height);
picture.setScale(scale[0], scale[1]);
}
Aggregations