X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;f=org.simantics.plant3d%2Fsrc%2Forg%2Fsimantics%2Fplant3d%2Factions%2FAddComponentAction.java;h=174d6f1166eac0718aa4aa814bb491b34ae67c66;hb=refs%2Fchanges%2F04%2F3104%2F1;hp=4f35291e88a8a7695171f43ddda2ec1b309e9baa;hpb=c17574943c09c562588136dbbc8585d6615b3a49;p=simantics%2F3d.git diff --git a/org.simantics.plant3d/src/org/simantics/plant3d/actions/AddComponentAction.java b/org.simantics.plant3d/src/org/simantics/plant3d/actions/AddComponentAction.java index 4f35291e..174d6f11 100644 --- a/org.simantics.plant3d/src/org/simantics/plant3d/actions/AddComponentAction.java +++ b/org.simantics.plant3d/src/org/simantics/plant3d/actions/AddComponentAction.java @@ -227,10 +227,21 @@ public class AddComponentAction extends vtkSwtAction { } else if (toPcp.isTurn() && toPcp.isFixed()) { dir = new Vector3d(toPcp.getDirection(position == PositionType.NEXT ? Direction.NEXT : Direction.PREVIOUS)); pos = new Vector3d(toPcp.getWorldPosition()); - if (!lengthAdjustable || insertPosition == PositionType.NEXT) { + if (!lengthAdjustable) { Vector3d v = new Vector3d(dir); v.scale(toPcp.getInlineLength()); pos.add(v); + } else { + if (insertPosition == PositionType.NEXT) { + Vector3d v = new Vector3d(dir); + v.scale(toPcp.getInlineLength()); + pos.add(v); + } else if (insertPosition == PositionType.SPLIT) { + // scale 0.5*length so that we don't remove the length twice from the new component + Vector3d v = new Vector3d(dir); + v.scale(toPcp.getInlineLength()*0.5); + pos.add(v); + } } }