Search in sources :

Example 46 with BoundingBox

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);
}
Also used : Point2D(com.ait.lienzo.client.core.types.Point2D) BoundingBox(com.ait.lienzo.client.core.types.BoundingBox) Test(org.junit.Test)

Example 47 with BoundingBox

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);
    }
}
Also used : BoundingBox(com.ait.lienzo.client.core.types.BoundingBox)

Example 48 with BoundingBox

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);
}
Also used : BoundingBox(com.ait.lienzo.client.core.types.BoundingBox)

Example 49 with BoundingBox

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());
    }
}
Also used : BoundingBox(com.ait.lienzo.client.core.types.BoundingBox)

Example 50 with BoundingBox

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]);
}
Also used : BoundingBox(com.ait.lienzo.client.core.types.BoundingBox)

Aggregations

BoundingBox (com.ait.lienzo.client.core.types.BoundingBox)79 Point2D (com.ait.lienzo.client.core.types.Point2D)24 Test (org.junit.Test)16 ScratchPad (com.ait.lienzo.client.core.util.ScratchPad)8 MultiPath (com.ait.lienzo.client.core.shape.MultiPath)7 Point2DArray (com.ait.lienzo.client.core.types.Point2DArray)7 Context2D (com.ait.lienzo.client.core.Context2D)6 ArrayList (java.util.ArrayList)6 Direction (com.ait.lienzo.shared.core.types.Direction)5 Group (com.ait.lienzo.client.core.shape.Group)4 WiresShape (com.ait.lienzo.client.core.shape.wires.WiresShape)4 Text (com.ait.lienzo.client.core.shape.Text)3 Transform (com.ait.lienzo.client.core.types.Transform)3 NFastDoubleArrayJSO (com.ait.tooling.nativetools.client.collection.NFastDoubleArrayJSO)3 Shape (org.kie.workbench.common.stunner.core.client.shape.Shape)3 MultiPathDecorator (com.ait.lienzo.client.core.shape.MultiPathDecorator)2 WiresConnection (com.ait.lienzo.client.core.shape.wires.WiresConnection)2 WiresConnector (com.ait.lienzo.client.core.shape.wires.WiresConnector)2 WiresMagnet (com.ait.lienzo.client.core.shape.wires.WiresMagnet)2 BoundingPoints (com.ait.lienzo.client.core.types.BoundingPoints)2