use of com.ait.lienzo.client.core.shape.wires.WiresManager in project lienzo-core by ahome-it.
the class WiresCompositeControlImpl method onMove.
@Override
public boolean onMove(final double dx, final double dy) {
if (isOutOfBounds(dx, dy)) {
return true;
}
delta = new Point2D(dx, dy);
// Delegate location deltas to shape controls and obtain current locations for each one.
final Collection<WiresShape> shapes = selectedShapes;
if (!shapes.isEmpty()) {
final WiresManager wiresManager = shapes.iterator().next().getWiresManager();
final Point2D[] locs = new Point2D[shapes.size()];
int i = 0;
for (final WiresShape shape : shapes) {
shape.getControl().onMove(dx, dy);
locs[i++] = getCandidateShapeLocationRelativeToInitialParent(shape);
}
// Check if new locations are allowed.
final WiresShape[] shapesArray = toArray(shapes);
final boolean locationAllowed = wiresManager.getLocationAcceptor().allow(shapesArray, locs);
// Do the updates.
if (locationAllowed) {
i = 0;
for (final WiresShape shape : shapes) {
shape.getControl().getParentPickerControl().setShapeLocation(locs[i++]);
postUpdateShape(shape);
}
}
}
final Collection<WiresConnector> connectors = selectedConnectors;
if (!connectors.isEmpty()) {
// Update connectors and connections.
for (final WiresConnector connector : connectors) {
final WiresConnector.WiresConnectorHandler handler = connector.getWiresConnectorHandler();
handler.getControl().move(dx, dy, true, true);
WiresConnector.updateHeadTailForRefreshedConnector(connector);
}
}
ShapeControlUtils.updateSpecialConnections(m_connectorsWithSpecialConnections, false);
return false;
}
use of com.ait.lienzo.client.core.shape.wires.WiresManager in project lienzo-core by ahome-it.
the class WiresDockingControlImpl method _isAccept.
private boolean _isAccept() {
final WiresLayer layer = getParentPickerControl().getWiresLayer();
final WiresManager wiresManager = layer.getWiresManager();
final IDockingAcceptor dockingAcceptor = wiresManager.getDockingAcceptor();
return (null != getParent()) && (null != getParentShapePart()) && (getParentShapePart() == PickerPart.ShapePart.BORDER) && dockingAcceptor.acceptDocking(getParent(), getShape());
}
Aggregations