use of com.ait.lienzo.client.core.shape.wires.WiresShape in project lienzo-core by ahome-it.
the class WiresParentPickerControlImpl method onMoveStart.
@Override
public void onMoveStart(final double x, final double y) {
shapeLocationControl.onMoveStart(x, y);
initialParent = getShape().getParent();
m_parent = getShape().getParent();
rebuildPicker();
if ((m_parent != null) && (m_parent instanceof WiresShape)) {
if (getShape().getDockedTo() == null) {
m_parentPart = new PickerPart((WiresShape) m_parent, PickerPart.ShapePart.BODY);
} else {
m_parentPart = findShapeAt((int) shapeLocationControl.getShapeStartCenterX(), (int) shapeLocationControl.getShapeStartCenterY());
}
}
}
use of com.ait.lienzo.client.core.shape.wires.WiresShape in project lienzo-core by ahome-it.
the class WiresShapeControlImpl method accept.
@Override
public boolean accept() {
Point2D location = null;
d_accept = (null != getDockingControl()) && getDockingControl().accept();
c_accept = !d_accept && (null != getContainmentControl()) && getContainmentControl().accept();
if (c_accept) {
location = getContainmentControl().getCandidateLocation();
} else if (d_accept) {
location = getDockingControl().getCandidateLocation();
}
boolean accept = false;
if (null != location) {
accept = getShape().getWiresManager().getLocationAcceptor().accept(new WiresShape[] { getShape() }, new Point2D[] { location });
}
return accept;
}
use of com.ait.lienzo.client.core.shape.wires.WiresShape in project lienzo-core by ahome-it.
the class WiresShapeHandler method doAdjust.
@Override
protected boolean doAdjust(final Point2D dxy) {
// Keep parent shape and part instances before moving to another location.
final WiresShape parent = getParentShape();
final PickerPart.ShapePart parentPart = getParentShapePart();
boolean adjusted = false;
if (control.onMove(dxy.getX(), dxy.getY())) {
dxy.set(control.getAdjust());
adjusted = true;
}
// Check acceptors' allow methods.
final boolean isDockAllowed = (null != getControl().getDockingControl()) && getControl().getDockingControl().isAllow();
final boolean isContAllow = (null != getControl().getContainmentControl()) && getControl().getContainmentControl().isAllow();
// Highlights.
final WiresShape newParent = getParentShape();
final PickerPart.ShapePart newParentPart = getParentShapePart();
if ((parent != newParent) || (parentPart != newParentPart)) {
highlight.restore();
}
if (null != newParent) {
if (isDockAllowed) {
highlight.highlight(newParent, PickerPart.ShapePart.BORDER);
} else if (isContAllow) {
highlight.highlight(newParent, PickerPart.ShapePart.BODY);
}
}
batch();
return adjusted;
}
Aggregations