X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;f=bundles%2Forg.simantics.modeling%2Fsrc%2Forg%2Fsimantics%2Fmodeling%2FSCLScenegraph.java;h=82115ef0e0825e2c9b8b2c69793f6bffd015344b;hb=refs%2Fchanges%2F73%2F4673%2F1;hp=db65b4de38c33193a1c1fe7e9492c799ab4544e2;hpb=c8d0257f989f7269666d65ddb1510b234b8adf5f;p=simantics%2Fplatform.git
diff --git a/bundles/org.simantics.modeling/src/org/simantics/modeling/SCLScenegraph.java b/bundles/org.simantics.modeling/src/org/simantics/modeling/SCLScenegraph.java
index db65b4de3..82115ef0e 100644
--- a/bundles/org.simantics.modeling/src/org/simantics/modeling/SCLScenegraph.java
+++ b/bundles/org.simantics.modeling/src/org/simantics/modeling/SCLScenegraph.java
@@ -51,6 +51,7 @@ import org.simantics.g2d.canvas.ICanvasContext;
import org.simantics.g2d.diagram.DiagramHints;
import org.simantics.g2d.diagram.IDiagram;
import org.simantics.g2d.diagram.handler.DataElementMap;
+import org.simantics.g2d.diagram.participant.ElementPainter.SelectionShapeNode;
import org.simantics.g2d.diagram.participant.Selection;
import org.simantics.g2d.element.IElement;
import org.simantics.g2d.scenegraph.ICanvasSceneGraphProvider;
@@ -964,9 +965,31 @@ public class SCLScenegraph {
if (!hasContent)
return;
String svg = printSVGDocument(doc);
- parentBuilder.append(MAIN_SECTION, "");
- parentBuilder.append(MAIN_SECTION, svg);
- parentBuilder.append(MAIN_SECTION, "\n");
+ if (node instanceof SelectionShapeNode) {
+ SingleElementNode parentSEN = (SingleElementNode)NodeUtil.getNearestParentOfType(node, SingleElementNode.class);
+ if(parentSEN != null) {
+ String key = getKey(parentSEN);
+ RenderSVGContext parentBuilder2 = getParentBuilder(parentSEN);
+ parentBuilder2.append(SELECTION_SECTION, "\n");
+ parentBuilder2.append(SELECTION_SECTION, svg);
+ parentBuilder2.append(SELECTION_SECTION, "\n");
+
+ parentBuilder2.append(SELECTION_MASK_SECTION, "\n");
+ Rectangle2D rect = node.getBounds();
+ // NaN
+ if(rect.getHeight() == rect.getHeight() && rect.getWidth() == rect.getWidth()) {
+ parentBuilder2.append(SELECTION_MASK_SECTION,"");
+ }
+ parentBuilder2.append(SELECTION_MASK_SECTION,"\n");
+ }
+ } else {
+ parentBuilder.append(MAIN_SECTION, "");
+ parentBuilder.append(MAIN_SECTION, svg);
+ parentBuilder.append(MAIN_SECTION, "\n");
+ }
} catch (Exception e) {
// TODO: There are nodes that do not behave well when rendered to SVG. For backwards compatibility, we don't handle the exceptions.
}