allowed.add(PositionType.NEXT);
}
} else {
- if (component.getNext() == null) {
+ if (component.getNext() == null || component.getControlPoint().isVariableLength()) {
allowed.add(PositionType.NEXT);
}
- if (component.getPrevious() == null) {
+ if (component.getPrevious() == null || component.getControlPoint().isVariableLength()) {
allowed.add(PositionType.PREVIOUS);
}
- if (component instanceof InlineComponent && !component.getControlPoint().isFixedLength()){
+ if (component instanceof InlineComponent && component.getControlPoint().isVariableLength()){
allowed.add(PositionType.SPLIT);
}
}
Vector3d v = new Vector3d(dir);
if (insertAdjustable) {
+ // Prevent moving of adjacent components - always insert at end of a connected variable length component
+ if (position == PositionType.NEXT && component.getNext() != null ||
+ position == PositionType.PREVIOUS && component.getPrevious() != null)
+ insertPosition = PositionType.PREVIOUS;
+
if (insertPosition == PositionType.NEXT)
v.scale(newComponent.getControlPoint().getInlineLength());
else if (insertPosition == PositionType.SPLIT)
case NEXT:
if (toPcp.isDualInline())
toPcp = toPcp.getDualSub();
- newPcp.insert(toPcp, Direction.NEXT);
newPcp.setWorldPosition(pos);
+ if (toPcp.getNext() != null)
+ PipingRules.splitVariableLengthComponent(newComponent, (InlineComponent)component, false);
+ else
+ newPcp.insert(toPcp, Direction.NEXT);
break;
case PREVIOUS:
if (toPcp.isDualSub())
toPcp = toPcp.parent;
- newPcp.insert(toPcp, Direction.PREVIOUS);
newPcp.setWorldPosition(pos);
+ if (toPcp.getPrevious() != null)
+ PipingRules.splitVariableLengthComponent(newComponent, (InlineComponent)component, false);
+ else
+ newPcp.insert(toPcp, Direction.PREVIOUS);
break;
case SPLIT:
PipingRules.splitVariableLengthComponent(newComponent, (InlineComponent)component, true);