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())));
}
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());
}
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();
}
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;
}
}
}
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);
}
}
Aggregations