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