]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.g2d/src/org/simantics/g2d/diagram/participant/ElementPainter.java
Combination of Simantics-platform related changes and fixes for district
[simantics/platform.git] / bundles / org.simantics.g2d / src / org / simantics / g2d / diagram / participant / ElementPainter.java
index d69ef69c69fadec257a3e07e2fc31a600cd5ed15..eb9e33607d5500197cc7c4fd8d0c061036d835c3 100644 (file)
@@ -1012,8 +1012,9 @@ public class ElementPainter extends AbstractDiagramParticipant implements Compos
         Shape shape = ElementUtils.getElementShapeOrBounds(e);
         Rectangle2D bounds = shape.getBounds2D();
         //System.out.println("selection bounds: "+bounds);
-        final double margin = 1;
-        bounds.setFrame(bounds.getMinX() - margin, bounds.getMinY() - margin, bounds.getWidth() + 2*margin, bounds.getHeight() + 2*margin);
+        final double marginX = 1 / selectionTransform.getScaleX();
+        final double marginY = 1 / selectionTransform.getScaleY();
+        bounds.setFrame(bounds.getMinX() - marginX, bounds.getMinY() - marginY, bounds.getWidth() + 2*marginX, bounds.getHeight() + 2*marginY);
 
         List<SelectionSpecification> ss = e.getElementClass().getItemsByClass(SelectionSpecification.class);
         if (!ss.isEmpty()) {