use of com.ait.lienzo.client.core.shape.wires.IControlHandleList in project lienzo-core by ahome-it.
the class WiresMagnetsControlImpl method shapeChanged.
@Override
public void shapeChanged() {
final IControlHandleList controlHandles = null != getMagnets() ? getMagnets().getMagnets() : null;
if ((null == controlHandles) || controlHandles.isEmpty()) {
return;
}
final Direction[] cardinals = controlHandles.size() == 9 ? EIGHT_CARDINALS : FOUR_CARDINALS;
final Point2DArray points = MagnetManager.getWiresIntersectionPoints(shape, cardinals);
final int size = controlHandles.size() <= points.size() ? controlHandles.size() : points.size();
for (int i = 0; i < size; i++) {
final Point2D p = points.get(i);
final WiresMagnet m = (WiresMagnet) controlHandles.getHandle(i);
m.setRx(p.getX()).setRy(p.getY());
}
shapeMoved();
}
Aggregations