Search in sources :

Example 11 with WiresConnector

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

the class WiresConnectionControlImpl method acceptMagnetAndUpdateAutoConnection.

public static boolean acceptMagnetAndUpdateAutoConnection(final WiresConnection connection, final boolean isHead, final WiresShape headS, final WiresShape tailS, final WiresMagnet currentMagnet) {
    final WiresConnector connector = connection.getConnector();
    boolean accept = true;
    // Only set the current magnet, if auto connection is false
    final boolean isAuto = connection.isAutoConnection();
    if (!isAuto) {
        if (isHead) {
            accept = accept && connector.getConnectionAcceptor().acceptHead(connection, currentMagnet);
        } else {
            accept = accept && connector.getConnectionAcceptor().acceptTail(connection, currentMagnet);
        }
        if (accept) {
            // Set the magnet on the current connection
            // magnet could also be null
            connection.setMagnet(currentMagnet);
        }
    }
    if (accept) {
        // can be used during drag, as we know the current connection will have a null shape
        // this will cause the other side to be updated
        accept = accept && connector.updateForAutoConnections(headS, tailS, isAuto);
        connector.updateForCenterConnection();
    }
    return accept;
}
Also used : WiresConnector(com.ait.lienzo.client.core.shape.wires.WiresConnector)

Aggregations

WiresConnector (com.ait.lienzo.client.core.shape.wires.WiresConnector)11 WiresShape (com.ait.lienzo.client.core.shape.wires.WiresShape)9 Point2D (com.ait.lienzo.client.core.types.Point2D)4 MultiPath (com.ait.lienzo.client.core.shape.MultiPath)1 OrthogonalPolyLine (com.ait.lienzo.client.core.shape.OrthogonalPolyLine)1 WiresConnection (com.ait.lienzo.client.core.shape.wires.WiresConnection)1 WiresMagnet (com.ait.lienzo.client.core.shape.wires.WiresMagnet)1 WiresManager (com.ait.lienzo.client.core.shape.wires.WiresManager)1 WiresConnectorControl (com.ait.lienzo.client.core.shape.wires.handlers.WiresConnectorControl)1 BoundingBox (com.ait.lienzo.client.core.types.BoundingBox)1 Point2DArray (com.ait.lienzo.client.core.types.Point2DArray)1 HashMap (java.util.HashMap)1 WiresConnectorView (org.kie.workbench.common.stunner.client.lienzo.shape.view.wires.WiresConnectorView)1 DragProxyCallback (org.kie.workbench.common.stunner.core.client.components.drag.DragProxyCallback)1 AbstractDragProxy (org.kie.workbench.common.stunner.lienzo.primitive.AbstractDragProxy)1 WiresConnectorDragProxy (org.kie.workbench.common.stunner.lienzo.primitive.WiresConnectorDragProxy)1 WiresShapeDragProxy (org.kie.workbench.common.stunner.lienzo.primitive.WiresShapeDragProxy)1