Search in sources :

Example 21 with WiresShape

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

the class WiresDockingControlImpl method isAllow.

@Override
public boolean isAllow() {
    final WiresLayer layer = getParentPickerControl().getWiresLayer();
    final WiresManager wiresManager = layer.getWiresManager();
    final IDockingAcceptor dockingAcceptor = wiresManager.getDockingAcceptor();
    return !isEnabled() || ((null != getParent()) && (null != getParentShapePart()) && (getParent() instanceof WiresShape) && (getParentShapePart() == PickerPart.ShapePart.BORDER) && (dockingAcceptor.dockingAllowed(getParent(), getShape())));
}
Also used : WiresShape(com.ait.lienzo.client.core.shape.wires.WiresShape) IDockingAcceptor(com.ait.lienzo.client.core.shape.wires.IDockingAcceptor) WiresManager(com.ait.lienzo.client.core.shape.wires.WiresManager) WiresLayer(com.ait.lienzo.client.core.shape.wires.WiresLayer)

Example 22 with WiresShape

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

the class WiresShapeControlImpl method onMoveStart.

@Override
public void onMoveStart(final double x, final double y) {
    shapeBounds = getShape().getGroup().getComputedBoundingPoints().getBoundingBox();
    m_adjust = new Point2D(0, 0);
    d_accept = false;
    c_accept = false;
    // Important - skip the shape and its children, if any, from the picker.
    // Otherwise children or the shape itself are being processed by the parent picker
    // and it ends up with wrong parent-child nested issues.
    final NFastArrayList<WiresShape> shapesToSkip = parentPickerControl.getPickerOptions().getShapesToSkip();
    shapesToSkip.clear();
    shapesToSkip.add(getShape());
    final NFastArrayList<WiresShape> children = getShape().getChildShapes();
    for (int i = 0; i < children.size(); i++) {
        shapesToSkip.add(children.get(i));
    }
    if (m_dockingAndControl != null) {
        m_dockingAndControl.onMoveStart(x, y);
    }
    if (m_containmentControl != null) {
        m_containmentControl.onMoveStart(x, y);
    }
    if (m_alignAndDistributeControl != null) {
        m_alignAndDistributeControl.dragStart();
    }
    // index nested shapes that have special connectors, to avoid searching during drag.
    m_connectorsWithSpecialConnections = ShapeControlUtils.collectionSpecialConnectors(getShape());
}
Also used : WiresShape(com.ait.lienzo.client.core.shape.wires.WiresShape) Point2D(com.ait.lienzo.client.core.types.Point2D)

Example 23 with WiresShape

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

the class WiresShapeHandler method startDrag.

@Override
public void startDrag(final DragContext dragContext) {
    super.startDrag(dragContext);
    // Delegate start dragging to shape control.
    control.onMoveStart(dragContext.getDragStartX(), dragContext.getDragStartY());
    // Highlights.
    final WiresShape parent = getParentShape();
    if (null != parent) {
        if (isDocked(getShape())) {
            highlight.highlight(getParentShape(), PickerPart.ShapePart.BORDER);
        } else {
            highlight.highlight(getParentShape(), PickerPart.ShapePart.BODY);
        }
    }
    batch();
}
Also used : WiresShape(com.ait.lienzo.client.core.shape.wires.WiresShape)

Example 24 with WiresShape

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

the class WiresShapeLocationControlImpl method onMoveStart.

@Override
public void onMoveStart(final double x, final double y) {
    m_delta = new Point2D(0, 0);
    shapeResetLocation = getShape().getLocation();
    shapeInitialLocation = getShape().getComputedLocation();
    m_mouseStartX = x;
    m_mouseStartY = y;
    final Point2D absShapeLoc = m_shape.getPath().getComputedLocation();
    final BoundingBox box = m_shape.getPath().getBoundingBox();
    m_shapeStartCenterX = absShapeLoc.getX() + (box.getWidth() / 2);
    m_shapeStartCenterY = absShapeLoc.getY() + (box.getHeight() / 2);
    m_startDocked = false;
    final WiresContainer parent = m_shape.getParent();
    if ((parent != null) && (parent instanceof WiresShape)) {
        if (m_shape.getDockedTo() != null) {
            m_startDocked = true;
        }
    }
}
Also used : WiresShape(com.ait.lienzo.client.core.shape.wires.WiresShape) Point2D(com.ait.lienzo.client.core.types.Point2D) BoundingBox(com.ait.lienzo.client.core.types.BoundingBox) WiresContainer(com.ait.lienzo.client.core.shape.wires.WiresContainer)

Example 25 with WiresShape

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

the class WiresCompositeControlImpl method onMoveStart.

@Override
public void onMoveStart(final double x, final double y) {
    delta = new Point2D(0, 0);
    selectedShapes = new ArrayList<>(selectionContext.getShapes());
    selectedConnectors = new ArrayList<>(selectionContext.getConnectors());
    final Map<String, WiresConnector> connectors = new HashMap<>();
    for (final WiresShape shape : selectedShapes) {
        ShapeControlUtils.collectionSpecialConnectors(shape, connectors);
        if (shape.getMagnets() != null) {
            // Must do magnets first, to avoid attribute change updates being processed.
            shape.getMagnets().onNodeDragStart(null);
        // Don't need to do this for nested objects, as those just move with their containers, without attribute changes
        }
        disableDocking(shape.getControl());
        final Point2D location = shape.getComputedLocation();
        final double sx = location.getX();
        final double sy = location.getY();
        shape.getControl().onMoveStart(sx, sy);
    }
    m_connectorsWithSpecialConnections = connectors.values().toArray(new WiresConnector[connectors.size()]);
    for (final WiresConnector connector : selectedConnectors) {
        final WiresConnector.WiresConnectorHandler handler = connector.getWiresConnectorHandler();
        // records the start position of all the points
        handler.getControl().onMoveStart(x, y);
        WiresConnector.updateHeadTailForRefreshedConnector(connector);
    }
}
Also used : WiresShape(com.ait.lienzo.client.core.shape.wires.WiresShape) WiresConnector(com.ait.lienzo.client.core.shape.wires.WiresConnector) Point2D(com.ait.lienzo.client.core.types.Point2D) HashMap(java.util.HashMap)

Aggregations

WiresShape (com.ait.lienzo.client.core.shape.wires.WiresShape)58 Test (org.junit.Test)14 Point2D (com.ait.lienzo.client.core.types.Point2D)11 WiresConnector (com.ait.lienzo.client.core.shape.wires.WiresConnector)9 WiresContainer (com.ait.lienzo.client.core.shape.wires.WiresContainer)7 MultiPath (com.ait.lienzo.client.core.shape.MultiPath)6 WiresManager (com.ait.lienzo.client.core.shape.wires.WiresManager)4 PickerPart (com.ait.lienzo.client.core.shape.wires.PickerPart)3 IContainmentAcceptor (com.ait.lienzo.client.core.shape.wires.IContainmentAcceptor)2 WiresConnection (com.ait.lienzo.client.core.shape.wires.WiresConnection)2 WiresLayer (com.ait.lienzo.client.core.shape.wires.WiresLayer)2 BoundingBox (com.ait.lienzo.client.core.types.BoundingBox)2 AbstractCaseManagementShape (org.kie.workbench.common.stunner.cm.client.wires.AbstractCaseManagementShape)2 MockCaseManagementShape (org.kie.workbench.common.stunner.cm.client.wires.MockCaseManagementShape)2 Node (org.kie.workbench.common.stunner.core.graph.Node)2 Group (com.ait.lienzo.client.core.shape.Group)1 Layer (com.ait.lienzo.client.core.shape.Layer)1 Shape (com.ait.lienzo.client.core.shape.Shape)1 IDockingAcceptor (com.ait.lienzo.client.core.shape.wires.IDockingAcceptor)1 ILayoutHandler (com.ait.lienzo.client.core.shape.wires.ILayoutHandler)1