use of com.ait.lienzo.client.core.shape.wires.PickerPart in project kie-wb-common by kiegroup.
the class CaseManagementColorMapBackedPicker method addDropZone.
void addDropZone(final AbstractCaseManagementShape<?> prim) {
final Optional<MultiPath> optMultiPath = prim.getDropZone();
if (optMultiPath.isPresent()) {
final MultiPath multiPath = optMultiPath.get();
multiPath.getAttributes().setX(prim.getX());
multiPath.getAttributes().setY(prim.getY());
drawShape(m_colorKeyRotor.next(), multiPath.getStrokeWidth(), multiPath, new PickerPart(prim, PickerPart.ShapePart.BODY), true);
}
}
use of com.ait.lienzo.client.core.shape.wires.PickerPart in project lienzo-core by ahome-it.
the class ColorMapBackedPicker method addShapes.
protected void addShapes(final NFastArrayList<WiresShape> shapes) {
for (int j = 0; j < shapes.size(); j++) {
final WiresShape prim = shapes.get(j);
if (m_options.shapesToSkip.contains(prim)) {
continue;
}
final MultiPath multiPath = prim.getPath();
drawShape(m_colorKeyRotor.next(), multiPath.getStrokeWidth(), new PickerPart(prim, PickerPart.ShapePart.BODY), true);
addSupplementaryPaths(prim);
if (m_options.hotspotsEnabled) {
drawShape(m_colorKeyRotor.next(), m_options.hotspotWidth, new PickerPart(prim, PickerPart.ShapePart.BORDER_HOTSPOT), false);
// need to be able to detect the difference between the actual border selection and the border hotspot
drawShape(m_colorKeyRotor.next(), multiPath.getStrokeWidth(), new PickerPart(prim, PickerPart.ShapePart.BORDER), false);
}
if ((prim.getChildShapes() != null) && !prim.getChildShapes().isEmpty()) {
addShapes(prim.getChildShapes());
}
}
}
use of com.ait.lienzo.client.core.shape.wires.PickerPart 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.PickerPart in project lienzo-core by ahome-it.
the class WiresParentPickerControlImpl method onMove.
@Override
public boolean onMove(final double dx, final double dy) {
if (!shapeLocationControl.onMove(dx, dy)) {
final Point2D currentLocation = getCurrentLocation();
final double x = currentLocation.getX();
final double y = currentLocation.getY();
WiresContainer parent = null;
PickerPart parentPart = findShapeAt(x, y);
if (parentPart != null) {
parent = parentPart.getShape();
}
if ((parent != m_parent) || (parentPart != m_parentPart)) {
parentPart = findShapeAt(x, y);
parent = null != parentPart ? parentPart.getShape() : null;
}
m_parent = parent;
m_parentPart = parentPart;
}
return false;
}
use of com.ait.lienzo.client.core.shape.wires.PickerPart in project lienzo-core by ahome-it.
the class WiresShapeControlImpl method onMove.
@Override
public boolean onMove(final double dx, final double dy) {
if (isOutOfBounds(dx, dy)) {
return true;
}
if (parentPickerControl.onMove(dx, dy)) {
m_adjust = parentPickerControl.getAdjust();
return true;
}
final Point2D dxy = new Point2D(dx, dy);
final boolean isDockAdjust = (null != m_dockingAndControl) && m_dockingAndControl.onMove(dx, dy);
if (isDockAdjust) {
final Point2D dadjust = m_dockingAndControl.getAdjust();
dxy.setX(dadjust.getX());
dxy.setY(dadjust.getY());
}
final boolean isContAdjust = (null != m_containmentControl) && m_containmentControl.onMove(dx, dy);
if (isContAdjust) {
final Point2D cadjust = m_containmentControl.getAdjust();
dxy.setX(cadjust.getX());
dxy.setY(cadjust.getY());
}
final boolean isAlignDistroAdjust = (null != m_alignAndDistributeControl) && m_alignAndDistributeControl.isDraggable() && m_alignAndDistributeControl.dragAdjust(dxy);
// Special adjustments.
boolean adjust = true;
if ((isDockAdjust || isContAdjust) && isAlignDistroAdjust && ((dxy.getX() != dx) || (dxy.getY() != dy))) {
final BoundingBox box = getShape().getPath().getBoundingBox();
final PickerPart part = getPicker().findShapeAt((int) (shapeBounds.getMinX() + dxy.getX() + (box.getWidth() / 2)), (int) (shapeBounds.getMinY() + dxy.getY() + (box.getHeight() / 2)));
if ((part == null) || (part.getShapePart() != PickerPart.ShapePart.BORDER)) {
dxy.setX(dx);
dxy.setY(dy);
adjust = false;
}
}
// Cache the current adjust point.
m_adjust = dxy;
parentPickerControl.onMoveAdjusted(m_adjust);
shapeUpdated(false);
return adjust;
}
Aggregations