diff --git a/sources/diagramevent/diagrameventaddpaste.cpp b/sources/diagramevent/diagrameventaddpaste.cpp index 5c867936c..a22d7d485 100644 --- a/sources/diagramevent/diagrameventaddpaste.cpp +++ b/sources/diagramevent/diagrameventaddpaste.cpp @@ -40,6 +40,7 @@ DiagramEventAddPaste::DiagramEventAddPaste(Diagram *diagram, const QPointF &start_pos) : DiagramEventInterface(diagram) { + Q_UNUSED(start_pos); // items stay at their original XML position //DiagramEventInterface::init() is called by Diagram::setEventInterface //only when it is replacing an earlier interface, so call it here as //DiagramEventAddMacro does. @@ -85,33 +86,23 @@ }; const QPointF grid_origin = snapGrid(top_left); - //Move the group to the cursor, rather than the cursor to the - //group. Both put the copy under the pointer, but warping the - //pointer also drags it back to the original's position, so the - //copy appears exactly on top of what was copied until the mouse - //is moved -- which is the thing pasting under the cursor was - //meant to avoid (issue #913). Taking the pointer away from - //where the user put it is also its own surprise. - m_group_origin = snapGrid(start_pos); - const QPointF offset = m_group_origin - grid_origin; - - //Store each item's position after the move. moveTo() applies a + //Store each item's original position. moveTo() applies a //grid-snapped delta from the baseline to these, so items //preserve their layout and move in whole grid steps. for (auto *item : movable) { - item->setPos(item->pos() + offset); m_relative_pos.insert(item, item->pos()); } + m_group_origin = grid_origin; - //The conductors were laid out against the old terminal + //The conductors were laid out against the original terminal //positions, so re-route them before anything is drawn. const QList conductors = m_content.conductors(DiagramContent::AnyConductor); for (auto *conductor : conductors) { conductor->updatePath(); } - //The baseline is known now, so moveTo() does not have to - //capture one from the first mouse movement. + //The baseline is the group's grid-snapped origin, so moveTo() + //does not have to capture one from the first mouse movement. m_initial_cursor = m_group_origin; m_baseline_captured = true;