Search in sources :

Example 11 with WiresContainer

use of com.ait.lienzo.client.core.shape.wires.WiresContainer in project lienzo-core by ahome-it.

the class WiresCompositeShapeHandler method doAdjust.

@Override
protected boolean doAdjust(final Point2D dxy) {
    final boolean adjusted = shapeControl.onMove(dxy.getX(), dxy.getY());
    if (adjusted) {
        dxy.set(shapeControl.getAdjust());
        return true;
    }
    boolean shouldRestore = true;
    if (shapeControl.isAllowed()) {
        final WiresContainer parent = shapeControl.getSharedParent();
        if ((null != parent) && (parent instanceof WiresShape)) {
            highlight.highlight((WiresShape) parent, PickerPart.ShapePart.BODY);
            shouldRestore = false;
        }
    }
    if (shouldRestore) {
        highlight.restore();
    }
    return false;
}
Also used : WiresShape(com.ait.lienzo.client.core.shape.wires.WiresShape) WiresContainer(com.ait.lienzo.client.core.shape.wires.WiresContainer)

Example 12 with WiresContainer

use of com.ait.lienzo.client.core.shape.wires.WiresContainer in project lienzo-core by ahome-it.

the class WiresContainmentControlImpl method calculateCandidateLocation.

public static Point2D calculateCandidateLocation(final WiresParentPickerControlImpl parentPickerControl) {
    final WiresLayer layer = parentPickerControl.getShape().getWiresManager().getLayer();
    final WiresContainer parent = parentPickerControl.getParent();
    final Point2D current = parentPickerControl.getShapeLocation();
    if ((parent == null) || (parent == layer)) {
        return current;
    } else {
        final Point2D trgAbsOffset = parent.getComputedLocation();
        return current.minus(trgAbsOffset);
    }
}
Also used : Point2D(com.ait.lienzo.client.core.types.Point2D) WiresContainer(com.ait.lienzo.client.core.shape.wires.WiresContainer) WiresLayer(com.ait.lienzo.client.core.shape.wires.WiresLayer)

Example 13 with WiresContainer

use of com.ait.lienzo.client.core.shape.wires.WiresContainer in project lienzo-core by ahome-it.

the class WiresParentPickerControlImpl method onMove.

@Override
public boolean onMove(final double dx, final double dy) {
    if (!shapeLocationControl.onMove(dx, dy)) {
        final Point2D currentLocation = getCurrentLocation();
        final double x = currentLocation.getX();
        final double y = currentLocation.getY();
        WiresContainer parent = null;
        PickerPart parentPart = findShapeAt(x, y);
        if (parentPart != null) {
            parent = parentPart.getShape();
        }
        if ((parent != m_parent) || (parentPart != m_parentPart)) {
            parentPart = findShapeAt(x, y);
            parent = null != parentPart ? parentPart.getShape() : null;
        }
        m_parent = parent;
        m_parentPart = parentPart;
    }
    return false;
}
Also used : Point2D(com.ait.lienzo.client.core.types.Point2D) WiresContainer(com.ait.lienzo.client.core.shape.wires.WiresContainer) PickerPart(com.ait.lienzo.client.core.shape.wires.PickerPart)

Aggregations

WiresContainer (com.ait.lienzo.client.core.shape.wires.WiresContainer)13 WiresShape (com.ait.lienzo.client.core.shape.wires.WiresShape)7 Point2D (com.ait.lienzo.client.core.types.Point2D)4 WiresLayer (com.ait.lienzo.client.core.shape.wires.WiresLayer)2 WiresManager (com.ait.lienzo.client.core.shape.wires.WiresManager)2 Group (com.ait.lienzo.client.core.shape.Group)1 IContainmentAcceptor (com.ait.lienzo.client.core.shape.wires.IContainmentAcceptor)1 PickerPart (com.ait.lienzo.client.core.shape.wires.PickerPart)1 BoundingBox (com.ait.lienzo.client.core.types.BoundingBox)1 Test (org.junit.Test)1