Commit 5299ffa4 authored by Jakob Schöttl's avatar Jakob Schöttl

Bugfix: element must not be selected for copy&paste

parent fd353205
......@@ -44,7 +44,7 @@ public class ActionInsertCopiedElement extends TopographyAction {
VPoint elementPos = getElementPosition(elementToCopy);
VPoint diff = model.getMousePosition().subtract(elementPos);
VShape newShape = model.translate(diff);
VShape newShape = model.translateElement(elementToCopy, diff);
if (elementToCopy instanceof AgentWrapper) {
VPoint position = new VPoint(newShape.getBounds2D().getCenterX(), newShape.getBounds2D().getCenterY());
......
......@@ -165,4 +165,6 @@ public interface IDrawPanelModel<T extends DefaultConfig> extends IDefaultModel<
void setCopiedElement(ScenarioElement copiedElement);
VShape translate(VPoint vector);
VShape translateElement(ScenarioElement elementToCopy, VPoint diff);
}
......@@ -329,15 +329,19 @@ public class TopographyCreatorModel extends DefaultModel implements IDrawPanelMo
@Override
public VShape translate(final Point vector) {
// double factor = Math.max(10,1/getGridResulution());
VPoint worldVector = new VPoint(vector.x / getScaleFactor(), -vector.y / getScaleFactor());
return translate(worldVector);
}
@Override
public VShape translate(final VPoint vector) {
// double factor = Math.max(10,1/getGridResulution());
return getSelectedElement().getShape().translatePrecise(alignToGrid(vector));
return translateElement(getSelectedElement(), vector);
}
@Override
public VShape translateElement(ScenarioElement elementToCopy, VPoint vector) {
// double factor = Math.max(10,1/getGridResulution()); // ?? related to scaleTopography?
return elementToCopy.getShape().translatePrecise(alignToGrid(vector));
}
@Override
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment