mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2026-09-28 13:24:14 +02:00
825a1a594d
Mirror (M) and Flip (F) in the element editor reflected the selected parts across the element origin: every part's mirror() and flip() negated the scene x or y coordinate. A part drawn to the right of the origin landed the same distance to the left, so the selection jumped to the other side of the canvas instead of turning around. MirrorElementsCommand and FlipElementsCommand now compute the united scene bounding rectangle of the selected items and reflect across the vertical or horizontal line through its center. The center is snapped to the nearest half of the diagram grid, so points that were on the grid stay on the grid after the reflection. Terminals in particular keep their grid alignment. Each part's mirror() and flip() takes the axis coordinate as a parameter with a default of 0, so the previous behavior remains available to any other caller. The command stores the axis when it is created and undo reapplies the same reflection, which is its own inverse, so the existing undo path is unchanged. Parts covered: PartArc, PartDynamicTextField, PartEllipse, PartLine, PartPolygon, PartRectangle, PartTerminal, PartText. Fixes #812